/**
* 获得root权限
*
* @param cmd
* @return
*/
public boolean RootCmd(String cmd) {
Process process = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec("sudo su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(cmd + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
return false;
} finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
}
}
return true;
}
获取手机权限,如果已经root了
最新推荐文章于 2021-05-28 19:50:12 发布