Grant permissions to updated system packages
isSystemPackage calls isSysComponentOrPersistentPlatformSignedPrivApp
which checks the uid of the app.
If we call getSystemPackageInfo on an updated system package we get
the info for the original apk installed on the system permission, not
the updated apk.
This original is not a currently registered package, hence it does not
have an uid and reports -1.
Hence if you pass the result of getSystemPackageInfo into
isSysComponentOrPersistentPlatformSignedPrivApp the first check always
triggers which then makes isSystemPackage assume the package is not a
system package.
Fixes: 115854330
Test: Executed steps in the bug (updated gmscore, restarted, tried to
add second user which triggers default grant policy for the second user)
Change-Id: I74745f8985082490a1f770d7682a964518782dd1
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index d9eb7e8..3c9dd63 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -946,7 +946,7 @@
}
private boolean isSystemPackage(String packageName) {
- return isSystemPackage(getSystemPackageInfo(packageName));
+ return isSystemPackage(getPackageInfo(packageName));
}
private boolean isSystemPackage(PackageInfo pkg) {