Search code examples
androidandroid-permissions

Android updated system app is not granted new permission


I have an app that is installed into our custom ROM in /system/app

When I add a system permission, such as android.permission.REBOOT, and install an update to the system app, the updated app does not get the new permission added in the update.

When I add a non-system permission, such as android.permission.INTERNET, the app does see the new permission.

We are trying to understand if there is a way to get around this without OTA'ing the system app.

EDIT: here is how we are installing the package,

Class<?>[] installTypes = new Class[]{Uri.class, IPackageInstallObserver.class, int.class, String.class};
installMethod = pm.getClass().getMethod("installPackage", installTypes);
...
installMethod.invoke(pm, new Object[]{apkFile, observer, INSTALL_REPLACE_EXISTING, null});

Solution

  • System apps cannot be granted new permissions through an upgrade. The reason, I assume, is that if you ever compromised a system app, you could upgrade it and add any permission you want, including all of the dangerous permissions that can only be granted to system apps.

    If you want your system app to have a new permission, you need to perform a OTA, or otherwise get the new bits of the APK into /system/app.