有谁知道cyanogen-update代码中怎样实现获取root权限进入recovery模式

佳期如梦 发布于 2011/11/21 11:54
阅读 979
收藏 0
加载中
0
虫虫
虫虫
看看这个是不是 http://forum.cyanogenmod.com/topic/31572-update-236-and-re-rooting/
佳期如梦
佳期如梦
没有代码呀
0
鉴客
鉴客
代码只能要求 root 权限,不能直接获取 root 权限
0
佳期如梦
佳期如梦

那怎样才能实现下面这一步

 

一直说

Trying to get root access to reboot in recovery mode

 

 

实现这部分的代码 是这样的:

                                try {
                                          Boolean mBackup = pref.doNandroidBackup();
                                          Process p = Runtime.getRuntime().exec("su");
                                          OutputStream os = p.getOutputStream();
                                          os.write("mkdir -p /cache/recovery/\n".getBytes());
                                          os.write("echo 'boot-recovery' >/cache/recovery/command\n".getBytes());
                                          if (mBackup)
                                          os.write("echo '--nandroid'  >> /cache/recovery/command\n".getBytes());
                                          String cmd = "echo '--update_package=SDCARD:" + mUpdateFolder + "/" + mUpdateInfo.getFileName() + "' >> /cache/recovery/command\n";
                                          os.write(cmd.getBytes());
                                          os.write("reboot recovery\n".getBytes());
                                          os.flush(); 
                  Toast.makeText(ApplyUpdateActivity.this, R.string.apply_trying_to_get_root_access, Toast.LENGTH_LONG).show();
                           
                                         }catch (IOException e) {
                                    Log.e(TAG, "Unable to reboot into recovery mode:", e);
                                    Toast.makeText(ApplyUpdateActivity.this, R.string.apply_unable_to_reboot_toast, Toast.LENGTH_LONG).show();
                                       }
                

0
sndnvaps
sndnvaps

楼主,你可以参考一下,
其它人制作的ROM,
其中最为一段为,set_perm
要用到的程序有二进制文件su,

返回顶部
顶部