Android System Permissions Through Root

强颜欢笑 提交于 2019-12-12 08:47:48

问题


W/PackageManager(61): Not granting permission android.permission.SET_ACTIVITY_WATCHER to package 

This is one such example of a permission that will not be granted to applications without being signed using the platform signature. With that said I would like to know how any application running on a rooted device (with /system/bin/su and SuperUser.apk) can be granted any of these permissions.

Process p = Runtime.getRuntime().exec("su");
p.waitFor();

Doing this prompts the super user dialog with "accept" or "reject," but SecurityExceptions are still thrown.


回答1:


You can declare your app to run as a system app by setting the sharedUserId as follows in the AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="[your package name]"
        android:sharedUserId="android.uid.system">

More details can be found here: How to sign Android app with system signature?




回答2:


you need to copy your apk file to '/system/apps'. It can be done programatically. you can do this only if you have root permissions. once copied, reboot the device(reboot can also be done programatically if you have root) and you'll be granted all permissions mentioned in your manifest file. You can also distribute this on market.



来源:https://stackoverflow.com/questions/7707889/android-system-permissions-through-root

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!