Throw IOException when checking if invalid target defines overlayable

PackageInfo can be null for cases where the target is missing, and
this should not crash in those cases. Mirrors the behavior of
getOverlayableForTarget by converting null to an IOException.

Bug: 147255897

Change-Id: I345dc68b7e6bea65f3f5da7a49a9136e07ba3793
This commit is contained in:
Winson
2020-01-07 15:26:22 -08:00
parent 45328cdf42
commit 9d5b4df6d7

View File

@@ -1154,6 +1154,10 @@ public final class OverlayManagerService extends SystemService {
throws RemoteException, IOException {
PackageInfo packageInfo = mPackageManager.getPackageInfo(targetPackageName, 0,
userId);
if (packageInfo == null) {
throw new IOException("Unable to get target package");
}
String baseCodePath = packageInfo.applicationInfo.getBaseCodePath();
ApkAssets apkAssets = null;