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
This commit is contained in:
Todd Kennedy
2017-06-06 13:44:09 -07:00
parent 4972aa30bf
commit 7e79d354a1

View File

@@ -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;
}