Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92f0fc1e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "InstallPackageHelper: fiX the NPE problem." into main

parents 0805e0e8 03e17d9a
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -1387,7 +1387,7 @@ final class InstallPackageHelper {
        boolean systemApp = false;
        boolean systemApp = false;
        boolean replace = false;
        boolean replace = false;
        synchronized (mPm.mLock) {
        synchronized (mPm.mLock) {
            final PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName);
            PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName);
            // Check if installing already existing package
            // Check if installing already existing package
            if ((installFlags & PackageManager.INSTALL_REPLACE_EXISTING) != 0) {
            if ((installFlags & PackageManager.INSTALL_REPLACE_EXISTING) != 0) {
                String oldName = mPm.mSettings.getRenamedPackageLPr(pkgName);
                String oldName = mPm.mSettings.getRenamedPackageLPr(pkgName);
@@ -1398,14 +1398,15 @@ final class InstallPackageHelper {
                    // name.  We must continue using the original name, so
                    // name.  We must continue using the original name, so
                    // rename the new package here.
                    // rename the new package here.
                    parsedPackage.setPackageName(oldName);
                    parsedPackage.setPackageName(oldName);
                    pkgName = parsedPackage.getPackageName();
                    pkgName = oldName;
                    replace = true;
                    ps = mPm.mSettings.getPackageLPr(oldName);
                    if (DEBUG_INSTALL) {
                    if (DEBUG_INSTALL) {
                        Slog.d(TAG, "Replacing existing renamed package: oldName="
                        Slog.d(TAG, "Replacing existing renamed package: oldName="
                                + oldName + " pkgName=" + pkgName);
                                + oldName + " pkgName=" + pkgName);
                    }
                    }
                } else if (ps != null) {
                }
                    // This package, under its official name, already exists
                if (ps != null) {
                    // This package, under its official name or its old name, already exists
                    // on the device; we should replace it.
                    // on the device; we should replace it.
                    replace = true;
                    replace = true;
                    if (DEBUG_INSTALL) Slog.d(TAG, "Replace existing package: " + pkgName);
                    if (DEBUG_INSTALL) Slog.d(TAG, "Replace existing package: " + pkgName);