From 6499a85a30e59a33ee643e9fda7d36d794716769 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Wed, 2 Sep 2015 13:53:05 -0700 Subject: [PATCH] Don't drop runtime permissions on older system app update. We have a device with an installed version of an app that is not preinstalled and has some runtime permissions granted. Now we get OTA with an older version of the app which does not request these runtime permissions. We first scan system packages and then installed apps. During the scan we encounter the newly appeared system package and determine it is older than the one we have installed and disable it. However, before we disable the package we update the permissions for this package but since the one on the system partition (the one we found so far) doesn't request some of the runtime permissions granted to the installed version of the app, they get dropped on the floor. This grant attempt is not necessary as the permission the installed package has depends entirely on the permissions it requests. In this process we may look at the requested permissions on the disabled system package but in general the updated package cannot have a permission that it does not request regardless whether the disabled system app requests it or on. bug:23718806 Change-Id: I187bc11750eb270c3233c314992186f5d58d9d82 --- .../java/com/android/server/pm/PackageManagerService.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index c650b6de8c49b..7f57b577ae5f4 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -5929,12 +5929,6 @@ public class PackageManagerService extends IPackageManager.Stub { */ if (shouldHideSystemApp) { synchronized (mPackages) { - /* - * We have to grant systems permissions before we hide, because - * grantPermissions will assume the package update is trying to - * expand its permissions. - */ - grantPermissionsLPw(pkg, true, pkg.packageName); mSettings.disableSystemPackageLPw(pkg.packageName); } }