From 7e79d354a1f2426ede5bd08384c0dbda665e0cac Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Tue, 6 Jun 2017 13:44:09 -0700 Subject: [PATCH] Handle renamed packages during default grants If a device has a privileged app on the system image which was updated and a future OTA renames the app package (supported only for privileged apps) we end up with a disabled system package setting with no package information. Since we are not doing a null check of the package we get from the disabled package settings during default grants we crash leaving the system in a bad state. Test: Manual Change-Id: Id7255c92a4a52e368266739cd331977256eee2d3 Fixes: 62376260 --- .../com/android/server/pm/DefaultPermissionGrantPolicy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java index ac7b763600a7a..d1aecb1b8d1dd 100644 --- a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java @@ -936,7 +936,7 @@ final class DefaultPermissionGrantPolicy { // permissions if the version on the system image does not declare them. if (!isDefaultPhoneOrSms && pkg.isUpdatedSystemApp()) { PackageSetting sysPs = mService.mSettings.getDisabledSystemPkgLPr(pkg.packageName); - if (sysPs != null) { + if (sysPs != null && sysPs.pkg != null) { if (sysPs.pkg.requestedPermissions.isEmpty()) { return; }