您的位置:首页 > 运维架构 > Linux

Android 修改文件权限 LINUX 命令

2016-08-26 12:28 274 查看

FileModelTool.getRoot("chmod -R 777 /data/data/XXX");



public synchronized static boolean getRoot(String paramString)
{
Process process = null;
DataOutputStream os = null;
try
{
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(paramString + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception localException)
{
System.out.println("@@@@root cmd error:"+localException);
//localException.printStackTrace();
return false;
}finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
System.out.println("###root cmd error:"+e);
}
}
return true;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: