Don't blindly reference package object
This is a workaround for the bug that prevents the device from booting. Will keep the bug open to address the core issue. Also added some debug logs to try to catch this in the wild. Bug: 68260103 Test: Manual. Device boots. Change-Id: Ifed80c74897cc54eff2ee73df6dcc3b1e6f79170
This commit is contained in:
@@ -288,7 +288,21 @@ public class PermissionManagerService {
|
||||
|
||||
final String[] packages = mContext.getPackageManager().getPackagesForUid(uid);
|
||||
if (packages != null && packages.length > 0) {
|
||||
final PackageParser.Package pkg = mPackageManagerInt.getPackage(packages[0]);
|
||||
Slog.e(TAG, "TODD: Packages: " + Arrays.toString(packages));
|
||||
PackageParser.Package pkg = null;
|
||||
for (String packageName : packages) {
|
||||
pkg = mPackageManagerInt.getPackage(packageName);
|
||||
if (pkg != null) {
|
||||
Slog.e(TAG, "TODD: Using packge: " + packageName);
|
||||
break;
|
||||
} else {
|
||||
Slog.e(TAG, "TODD: Missing packge: " + packageName);
|
||||
}
|
||||
}
|
||||
if (pkg == null) {
|
||||
Slog.e(TAG, "TODD: No package not found; UID: " + uid);
|
||||
return PackageManager.PERMISSION_DENIED;
|
||||
}
|
||||
if (pkg.mSharedUserId != null) {
|
||||
if (isCallerInstantApp) {
|
||||
return PackageManager.PERMISSION_DENIED;
|
||||
|
||||
Reference in New Issue
Block a user