DO NOT MERGE Fix PermissionManagerService throwing exception for unknown package.

The package might have been uninstalled asynchronously because we are
not holding the mPackages lock, so just log the error and return.

Fixes: 138670149
Test: presubmit
Change-Id: I7feeea85d2ab446e83e2101833e448cc962dd448
This commit is contained in:
Hai Zhang
2019-07-31 14:07:17 -07:00
parent 7acde27742
commit 03bb8eeeaa

View File

@@ -2098,7 +2098,8 @@ public class PermissionManagerService {
final PackageParser.Package pkg = mPackageManagerInt.getPackage(packageName);
if (pkg == null || pkg.mExtras == null) {
throw new IllegalArgumentException("Unknown package: " + packageName);
Log.e(TAG, "Unknown package: " + packageName);
return;
}
final BasePermission bp;
synchronized(mLock) {
@@ -2239,7 +2240,8 @@ public class PermissionManagerService {
final PackageParser.Package pkg = mPackageManagerInt.getPackage(packageName);
if (pkg == null || pkg.mExtras == null) {
throw new IllegalArgumentException("Unknown package: " + packageName);
Log.e(TAG, "Unknown package: " + packageName);
return;
}
if (mPackageManagerInt.filterAppAccess(pkg, Binder.getCallingUid(), userId)) {
throw new IllegalArgumentException("Unknown package: " + packageName);