OSDN Git Service

Fix inconsistent getPackageInfo() calls when parsing exceptions.
authorHai Zhang <zhanghai@google.com>
Thu, 4 Oct 2018 21:53:04 +0000 (14:53 -0700)
committerHai Zhang <zhanghai@google.com>
Thu, 4 Oct 2018 22:05:56 +0000 (15:05 -0700)
This change makes the two checks check against the same PackageInfo to
be more consistent. Previously the former check was checking the one
returned by getPackageInfo() and the latter check was checking the one
returned by getSystemPackageInfo().

Bug: 117246830
Test: manual
Change-Id: I01a677f10634c45e5a9a967b0f5287a66f3e7482

services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java

index 6f644dd..014a006 100644 (file)
@@ -1293,14 +1293,15 @@ public final class DefaultPermissionGrantPolicy {
                         outGrantExceptions.get(packageName);
                 if (packageExceptions == null) {
                     // The package must be on the system image
-                    if (!isSystemPackage(packageName)) {
-                        Log.w(TAG, "Unknown package:" + packageName);
+                    PackageInfo packageInfo = getSystemPackageInfo(packageName);
+                    if (!isSystemPackage(packageInfo)) {
+                        Log.w(TAG, "Unknown system package:" + packageName);
                         XmlUtils.skipCurrentTag(parser);
                         continue;
                     }
 
                     // The package must support runtime permissions
-                    if (!doesPackageSupportRuntimePermissions(getSystemPackageInfo(packageName))) {
+                    if (!doesPackageSupportRuntimePermissions(packageInfo)) {
                         Log.w(TAG, "Skipping non supporting runtime permissions package:"
                                 + packageName);
                         XmlUtils.skipCurrentTag(parser);