日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

rk3399 android 9.0 root 权限及测试应用

發布時間:2023/12/16 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 rk3399 android 9.0 root 权限及测试应用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

功能:rk3399 9.0 上root權限,第三方APP可以調用su指令。

1.修改system/extras/su/su.cpp 文件

diff --git a/su/su.cpp b/su/su.cpp
index f3e4ff0..00a41a4 100644
--- a/su/su.cpp
+++ b/su/su.cpp
@@ -80,8 +80,8 @@ void extract_uidgids(const char* uidgids, uid_t* uid, gid_t* gid, gid_t* gids, i
?}
?
?int main(int argc, char** argv) {
- ? ?uid_t current_uid = getuid();
- ? ?if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not allowed");
+ ? ?//uid_t current_uid = getuid();
+ ? ?//if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not allowed");

2.修改system/core/libcutils/libcutils/fs_config.cpp文件

diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 62e91cf..5f5a405 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -173,7 +173,7 @@ static const struct fs_path_config android_files[] = {
? ? ?// the following two files are INTENTIONALLY set-uid, but they
? ? ?// are NOT included on user builds.
? ? ?{ 06755, AID_ROOT, ? ? ?AID_ROOT, ? ? ?0, "system/xbin/procmem" },
- ? ?{ 04755, AID_ROOT, ? ? ?AID_SHELL, ? ? 0, "system/xbin/su" },
+ ? ?{ 06755, AID_ROOT, ? ? ?AID_SHELL, ? ? 0, "system/xbin/su" },

3.在device/rockchip/common/BoardConfig.mk中設置

BOARD_SELINUX_ENFORCING := false

4.APP調用su方法

1):創建類 ShellUtil.java

public class ShellUtil {public static void execShell(String[] cmds) {Process p = null;try {p = Runtime.getRuntime().exec("su");} catch (IOException e) {e.printStackTrace();}DataOutputStream os = new DataOutputStream(p.getOutputStream());for (String tmpCmd : cmds) {try {os.writeBytes(tmpCmd+"\n");os.flush();try {p.waitFor();} catch (InterruptedException e) {e.printStackTrace();}} catch (IOException e) {e.printStackTrace();}try {os.close();} catch (IOException e) {e.printStackTrace();}}} }

2):調用代碼

String[] cmds={"reboot"}; new Thread(new Runnable() {@Overridepublic void run() {ShellUtil.execShell(cmds);} }).start();

歡迎關注,有問題可以交流

總結

以上是生活随笔為你收集整理的rk3399 android 9.0 root 权限及测试应用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。