From 30f349d2ef3f2220c1d478b0faff4c38eaadf12c Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Fri, 5 Sep 2014 14:52:26 -0700 Subject: Don't crash in addPackageHoldingPermissions()... ...in cases involving uninstalled apps, or apps whose install state varies across different users. Bug 17398315 Change-Id: I7297d82f8bf5d49c50a7fd53d795a706bf2d2313 --- .../android/server/pm/PackageManagerService.java | 26 +++++++++++++--------- 1 file 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 d2a627e..3a7dc99 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