Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
bugfix: properly acquire package state from original package
Browse files Browse the repository at this point in the history
This resolves the NPE crash when updating an application under the new
package name that initially had the original package as package name.
  • Loading branch information
quh4gko8 authored and thestinger committed Mar 13, 2024
1 parent a862c18 commit 3fd0aae
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ private void preparePackageLI(InstallRequest request) throws PrepareFailure {
boolean systemApp = false;
boolean replace = false;
synchronized (mPm.mLock) {
final PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName);
PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName);
// Check if installing already existing package
if ((installFlags & PackageManager.INSTALL_REPLACE_EXISTING) != 0) {
String oldName = mPm.mSettings.getRenamedPackageLPr(pkgName);
Expand All @@ -1276,6 +1276,7 @@ private void preparePackageLI(InstallRequest request) throws PrepareFailure {
parsedPackage.setPackageName(oldName);
pkgName = parsedPackage.getPackageName();
replace = true;
ps = mPm.mSettings.getPackageLPr(pkgName);
if (DEBUG_INSTALL) {
Slog.d(TAG, "Replacing existing renamed package: oldName="
+ oldName + " pkgName=" + pkgName);
Expand Down

0 comments on commit 3fd0aae

Please sign in to comment.