Process 类的方法介绍
getOutputStream()
获得与进程标准输入相连的 OutputStream ,用来向进程输入命令。
getInputStream()
获得与进程标准输出相连的 InputStream ,用来读取进程的输出信息。
getErrorStream()
获得与进程错误输出相连的 InputStream ,用来读取进程的错误信息。
waitFor()
等待进程结束,并返回进程的退出状态值,正常状态返回 0 。
destroy()
强制销毁该进程。
Process process = null;
su = Runtime.getRuntime().exec(“/system/bin/su”);
String cmd = "chmod 666 " + device.getAbsolutePath() + “\n”
+ “exit\n”;
su.getOutputStream().write(cmd.getBytes());