summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHai Zhang <zhanghai@google.com>2020-08-31 18:28:41 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-09-30 00:05:42 +0000
commitda23c6e608c164642fdf250102969c15bb3fff35 (patch)
treed4e2167de0f2f3b972129db3b2915ca7c28e8efa
parent714dbd9a105bd649b84c53bde757aeb1c9adc4c9 (diff)
downloadbase-da23c6e608c164642fdf250102969c15bb3fff35.tar.gz
DO NOT MERGE Fix NPE in executeDeletePackageLIF.
The parameter allUserHandles may sometimes be null. Change-Id: Ie58cabe4bb1cae7173ad1d027e993a0b82a9f1ef Bug: 167233572 Bug: 140256621 Test: atest EphemeralTest (cherry picked from commit 01e0f4813af8502faaa683d55dbbc024b3080741)
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 7a38a4533572..c3c655d632e7 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -19198,7 +19198,8 @@ public class PackageManagerService extends IPackageManager.Stub
// We need to get the permission state before package state is (potentially) destroyed.
final SparseBooleanArray hadSuspendAppsPermission = new SparseBooleanArray();
- for (int userId : allUserHandles) {
+ // allUserHandles could be null, so call mUserManager.getUserIds() directly which is cached anyway.
+ for (int userId : mUserManager.getUserIds()) {
hadSuspendAppsPermission.put(userId, checkPermission(Manifest.permission.SUSPEND_APPS,
packageName, userId) == PERMISSION_GRANTED);
}