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
1 file changed