diff options
author | Christopher Tate <ctate@google.com> | 2014-09-05 22:23:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-05 22:23:07 +0000 |
commit | a0c9962388361522257b4ff2f55ac7cea0d559f3 (patch) | |
tree | 221e49b89fecd2d763066a9c54d3c3290ffe86d3 | |
parent | c378b3e079b2e74ab4605c3d6645db9026e75136 (diff) | |
parent | 30f349d2ef3f2220c1d478b0faff4c38eaadf12c (diff) | |
download | frameworks_base-a0c9962388361522257b4ff2f55ac7cea0d559f3.zip frameworks_base-a0c9962388361522257b4ff2f55ac7cea0d559f3.tar.gz frameworks_base-a0c9962388361522257b4ff2f55ac7cea0d559f3.tar.bz2 |
Merge "Don't crash in addPackageHoldingPermissions()..." into lmp-dev
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index aea00da..7b4270b 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3783,21 +3783,25 @@ public class PackageManagerService extends IPackageManager.Stub { } else { pi = generatePackageInfoFromSettingsLPw(ps.name, flags, userId); } - if ((flags&PackageManager.GET_PERMISSIONS) == 0) { - if (numMatch == permissions.length) { - pi.requestedPermissions = permissions; - } else { - pi.requestedPermissions = new String[numMatch]; - numMatch = 0; - for (int i=0; i<permissions.length; i++) { - if (tmp[i]) { - pi.requestedPermissions[numMatch] = permissions[i]; - numMatch++; + // The above might return null in cases of uninstalled apps or install-state + // skew across users/profiles. + if (pi != null) { + if ((flags&PackageManager.GET_PERMISSIONS) == 0) { + if (numMatch == permissions.length) { + pi.requestedPermissions = permissions; + } else { + pi.requestedPermissions = new String[numMatch]; + numMatch = 0; + for (int i=0; i<permissions.length; i++) { + if (tmp[i]) { + pi.requestedPermissions[numMatch] = permissions[i]; + numMatch++; + } } } } + list.add(pi); } - list.add(pi); } @Override |