OrangePi之Android_7.0获取Root权限

准备工作:

  1. Orange Pi PC H3 // 开发板一块
  2. OrangePi_Pc_One_Android_7.0_beta_v1.1.img // 系统镜像 Android 7.0
    http://www.orangepi.cn/downloadresourcescn/
  3. Magisk Manager v7.5.1 // 下载  Magisk Manager APK
    https://github.com/topjohnwu/Magisk/releases 
开始:

  1. OrangePi_Pc_One_Android_7.0_beta_v1.1.img 刷入 Orange Pi PC H3 并启动 ...
  2. 开发者选项 -> 开启 USB调试 and USB0切换到设备模式,并且 usb 连接到电脑 ...
  3. adb install MagiskManager-v7.5.1.apk 安装 Magisk Manager APK ...
  4. adb shell -> dd if=/dev/block/by-name/boot of=/sdcard/boot.img 克隆引导镜像 ...
  5. adb pull /sdcard/boot.img boot.img 拷贝引导镜像到本地 ...
  6. 复制 boot.img 到u盘,并将u盘插入到 Orange Pi PC H3 上 ...
  7. 打开 Magisk Manager 选择 Magisk 安装 -> 选择并修补一个文件 -> 选择u盘中的 boot.img ...
  8. 完成后 /storage/emulated/0/Download/magisk_patched.img 文件拷贝到u盘中备份 ...
  9. 回写 dd if=/sdcard/MagiskManager/magisk_patched.img of=/dev/block/by-name/boot
  10. 完成后重启即可 ...
翻墙:

  1. Magisk Manager 侧边栏 -> 设置 -> 更新通道 -> 自定义 
  通道1:http://101.133.237.130/Magisk/Magisk_Latest.json(基本和官方同步)
  通道2:http://magisk.tsyinpin.com/canary.json(美化测试版面具)
  通道3:https://qianyegroup.gitee.io/magiskbuilds/updates/custom.json (备用通道)
  通道4: https://api.pearik.com/magisk/stable.json
{
  "app": {
    "version": "7.4.0",
    "versionCode": "253",
    "link": "http://101.133.237.130/Magisk/Magisk_APP/MagiskManager-v7.4.0.apk",
    "note": "https://github.com/topjohnwu/Magisk/blob/manager-v7.4.0/app/src/main/res/raw/changelog.md"
  },
  "uninstaller": {
    "link": "https://github.com/topjohnwu/Magisk/releases/download/v19.3/Magisk-uninstaller-20190604.zip"
  },
  "magisk": {
    "version": "20.4",
    "versionCode": "20400",
    "link": "http://101.133.237.130/Magisk/Magisk_zip/Magisk-v20.4.zip",
    "md5": "9503fc692e03d60cb8897ff2753c193f"
  },
  "message":{
    "Power By":"Mintimate",
    "Address":"https://www.mintimate.cn"
  }
}
测试:

    static boolean checkRootExecutable() {

    Process process = null;
    DataOutputStream os = null;
    try {
        process = Runtime.getRuntime().exec("su");
        os = new DataOutputStream(process.getOutputStream());
        os.writeBytes("exit\n");
        os.flush();
        int exitValue = process.waitFor();
        if (exitValue == 0) {
        return true;
        } else {
        return false;
        }
    } catch (Exception e) {
        Log.d("*** DEBUG ***", "Unexpected error - Here is what I know: " + e.getMessage());
        return false;
    } finally {
        try {
        if (os != null) {
            os.close();
        }
        process.destroy();
        } catch (Exception e) {
        e.printStackTrace();
        }
    }
    }