软件申请获取root权限
2024-09-13 04:28:12
申请root的工具类
//获取root权限
RootManager manager=new RootManager();
manager.upgradeRootPermission(getPackageCodePath());
public class RootManager { /**
* 应用程序运行命令获取 Root权限,设备必须已破解(获得ROOT权限)
*
* @return 应用程序是/否获取Root权限
*/
public boolean upgradeRootPermission(String pkgCodePath) {
Process process = null;
DataOutputStream os = null;
try {
String cmd="chmod 777 " + pkgCodePath;
process = Runtime.getRuntime().exec("su"); //切换到root帐号
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;
} }
最新文章
- html规范
- COOKIE和SESSION关系和区别
- Crawler &; Ajax:WebBrowser C#
- 3、HelloKhala示例说明
- #include <;sstream>;
- iOS 学习资料汇总
- promise/bluebird源码
- Python爬虫(十二)_XPath与lxml类库
- python3.6 使用 pymysql 连接 Mysql 数据库及 简单的增删改查操作
- Shell脚本中获取select值
- 深入了解EntityFramework Core 2.1延迟加载(Lazy Loading)
- hive的join
- PHP获取站点根目录
- Swift中的Any 与 AnyObject、AnyClass的区别?
- 统计词语频率保存到xls
- 20145319 《网络渗透》DNS欺骗
- c# winform 中DataGridView绑定List<;T>; 不能显示数据
- origin里用c语言编程
- BETA-1
- NO.11天作业
热门文章
- ";Your computer could not be joined to the domain. You have exceeded the maximum number of computer accounts you are allowed to create in this domain. Contact your system administrator to have this limit reset or increased.";
- Key Vertex (hdu 3313 SPFA+DFS 求起点到终点路径上的割点)
- 基于CRF的中文分词
- nginx location 匹配的规则
- WordPress 获取指定分类ID的分类信息
- Eclipse Maven项目报错2之A child container failed during start
- String escape/unescape into XML
- mysql 批量数据循环插入
- windows server 2012 st 版本的php环境问题修复 与删除
- Android 多语言支持