summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2014-09-05 22:23:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-05 22:23:07 +0000
commita0c9962388361522257b4ff2f55ac7cea0d559f3 (patch)
tree221e49b89fecd2d763066a9c54d3c3290ffe86d3
parentc378b3e079b2e74ab4605c3d6645db9026e75136 (diff)
parent30f349d2ef3f2220c1d478b0faff4c38eaadf12c (diff)
downloadframeworks_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.java26
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