Android System Permissions Through Root

2020-07-11 06:26发布

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.

2条回答
Lonely孤独者°
2楼-- · 2020-07-11 07:23

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.

查看更多
我想做一个坏孩纸
3楼-- · 2020-07-11 07:28

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?

查看更多
登录 后发表回答