- public boolean RootCmd(String cmd){
- Process process = null;
- DataOutputStream os = null;
- try{
- process = Runtime.getRuntime().exec("su");
- os = new DataOutputStream(process.getOutputStream());
- os.writeBytes(cmd1+ "\n");
- os.writeBytes("xxxx\n");
- os.flush();
- process.waitFor();
- } catch (Exception e) {
- return false;
- } finally {
- try {
- if (os != null) {
- os.close();
- }
- process.destroy();
- } catch (Exception e) {
- }
- }
- return true;
- }
- }
android 执行root命令
最新推荐文章于 2024-04-29 20:54:26 发布