我需要将 android 文件系统重新挂载为读写而不是只读。我知道如何通过命令提示符进行操作,也知道如何进行应用程序开发。
但我正在调整 android 源代码,如果我使用的话
Process proc=Runtime.getRuntime.exec("su");
它不起作用。因此我需要使用 android.os.process
对象,我被困在这里任何人都可以帮助我。
最佳答案
尝试此代码以获得 super 用户访问权限(您需要安装了 super 用户的root 手机):
try { // Perform su to get root privledges Process p = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(p.getOutputStream()); os.writeBytes("<..... here you may write commands ....>\n"); // Close the terminal os.writeBytes("exit\n"); os.flush(); } catch (IOException e) { toastMessage("not root"); }
一旦您拥有 super 用户访问权限,您就可以启动
adbd
监听一些 TCP 端口,使用:setprop service.adb.tcp.port 5555 adbd & setprop service.adb.tcp.port -1
打开到所选端口的 TCP 连接并发出
remount
命令。
关于android - 通过java重新挂载Android文件系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10528090/