开发者

Android System Permissions Through Root

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.


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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜