Allow requested installer package name to be null

Since an installer package name may be null, switch to
TextUtils.equals to allow for this case and to stop
any NullPointerExceptions

Test: adb shell pm install --staged
      /system/app/CaptivePortalLogin/CaptivePortalLogin.apk works
Bug: 145575703

Change-Id: Ic30cc4610884657aaa8415dc96107c7cc3647ce9
This commit is contained in:
Gavin Corkery
2019-12-04 10:59:34 +00:00
parent b39135098a
commit e0ee6fe2c2

View File

@@ -494,7 +494,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
}
// Only apps with INSTALL_PACKAGES are allowed to set an installer that is not the
// caller.
if (!requestedInstallerPackageName.equals(installerPackageName)) {
if (!TextUtils.equals(requestedInstallerPackageName, installerPackageName)) {
if (mContext.checkCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES)
!= PackageManager.PERMISSION_GRANTED) {
mAppOps.checkPackage(callingUid, requestedInstallerPackageName);