How to modify AOSP to allow specific apps to get root access?

前端 未结 2 1830
情歌与酒
情歌与酒 2020-12-14 20:58

I\'m working on AOSP. I\'ve successfully added my apk to build. Now I want to give root access to my app. I don\'t want to provide root access to other apps

相关标签:
2条回答
  • 2020-12-14 21:34

    You're moving in the right direction. You need to check the sources for su.c The only problem that you can face is how to run your program as root. To do this you need to set SUID sticky bit for the executable of your application. To do this you need to modify system/core/include/private/android_filesystem_config.h file (structure android_files[]), for instance for su program you can see how this bit is set:

    { 06755, AID_ROOT,      AID_ROOT,      "system/xbin/su" },
    
    0 讨论(0)
  • 2020-12-14 21:46

    ChainFire has written a a guide on su and how to use it for normal apps. If you're intending on working with anything other than your own phone I suggest this is the approach you follow.

    0 讨论(0)
提交回复
热议问题