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

Commit 16523acf authored by Hyangseok Chae's avatar Hyangseok Chae Committed by android-build-merger
Browse files

Merge "Reset the profile when system application change version."

am: 1771240c

Change-Id: I26a2d40a4a86840e48f49a17c0e43748a31af695
parents 989d72ce 1771240c
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -9206,6 +9206,29 @@ public class PackageManagerService extends IPackageManager.Stub
        }
    }
    /**
     * Clear the package profile if this was an upgrade and the package
     * version was updated.
     */
    private void maybeClearProfilesForUpgradesLI(
            @Nullable PackageSetting originalPkgSetting,
            @NonNull PackageParser.Package currentPkg) {
        if (originalPkgSetting == null || !isUpgrade()) {
          return;
        }
        if (originalPkgSetting.versionCode == currentPkg.mVersionCode) {
          return;
        }
        clearAppProfilesLIF(currentPkg, UserHandle.USER_ALL);
        if (DEBUG_INSTALL) {
            Slog.d(TAG, originalPkgSetting.name
                  + " clear profile due to version change "
                  + originalPkgSetting.versionCode + " != "
                  + currentPkg.mVersionCode);
        }
    }
    /**
     *  Traces a package scan.
     *  @see #scanPackageLI(File, int, int, long, UserHandle)
@@ -9491,6 +9514,9 @@ public class PackageManagerService extends IPackageManager.Stub
        // Verify certificates against what was last scanned
        collectCertificatesLI(ps, pkg, scanFile, policyFlags);
        // Reset profile if the application version is changed
        maybeClearProfilesForUpgradesLI(ps, pkg);
        /*
         * A new system app appeared, but we already had a non-system one of the
         * same name installed earlier.