Merge "[pm] fail install-existing for apps deleted with KEEP_DATA" into udc-dev

This commit is contained in:
Song Chun Fan
2023-05-04 15:49:10 +00:00
committed by Android (Google) Code Review
2 changed files with 2 additions and 1 deletions

View File

@@ -453,6 +453,7 @@ final class DeletePackageHelper {
// We need to set it back to 'installed' so the uninstall
// broadcasts will be sent correctly.
if (DEBUG_REMOVE) Slog.d(TAG, "Not installed by other users, full delete");
ps.setPkg(null);
ps.setInstalled(true, userId);
mPm.mSettings.writeKernelMappingLPr(ps);
clearPackageStateAndReturn = false;

View File

@@ -654,7 +654,7 @@ final class InstallPackageHelper {
synchronized (mPm.mLock) {
final Computer snapshot = mPm.snapshotComputer();
pkgSetting = mPm.mSettings.getPackageLPr(packageName);
if (pkgSetting == null) {
if (pkgSetting == null || pkgSetting.getPkg() == null) {
return PackageManager.INSTALL_FAILED_INVALID_URI;
}
if (!snapshot.canViewInstantApps(callingUid, UserHandle.getUserId(callingUid))) {