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

Commit f50ff35c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "use directory timestamp during OTA" into nyc-mr1-dev

parents ee360204 095d4125
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -531,6 +531,7 @@ public class PackageManagerService extends IPackageManager.Stub {
    final String[] mSeparateProcesses;
    final boolean mIsUpgrade;
    final boolean mIsPreNUpgrade;
    final boolean mIsPreNMR1Upgrade;
    /** The location for ASEC container files on internal storage. */
    final String mAsecInternalPath;
@@ -2238,6 +2239,8 @@ public class PackageManagerService extends IPackageManager.Stub {
            // as there is no profiling data available.
            mIsPreNUpgrade = mIsUpgrade && ver.sdkVersion < Build.VERSION_CODES.N;
            mIsPreNMR1Upgrade = mIsUpgrade && ver.sdkVersion < Build.VERSION_CODES.N_MR1;
            // save off the names of pre-existing system packages prior to scanning; we don't
            // want to automatically grant runtime permissions for new system apps
            if (mPromoteSystemApps) {
@@ -6612,9 +6615,13 @@ public class PackageManagerService extends IPackageManager.Stub {
    private void collectCertificatesLI(PackageSetting ps, PackageParser.Package pkg, File srcFile,
            final int policyFlags) throws PackageManagerException {
        // When upgrading from pre-N MR1, verify the package time stamp using the package
        // directory and not the APK file.
        final long lastModifiedTime = mIsPreNMR1Upgrade
                ? new File(pkg.codePath).lastModified() : getLastModifiedTime(pkg, srcFile);
        if (ps != null
                && ps.codePath.equals(srcFile)
                && ps.timeStamp == getLastModifiedTime(pkg, srcFile)
                && ps.timeStamp == lastModifiedTime
                && !isCompatSignatureUpdateNeeded(pkg)
                && !isRecoverSignatureUpdateNeeded(pkg)) {
            long mSigningKeySetId = ps.keySetData.getProperSigningKeySet();
@@ -6636,7 +6643,7 @@ public class PackageManagerService extends IPackageManager.Stub {
            Slog.w(TAG, "PackageSetting for " + ps.name
                    + " is missing signatures.  Collecting certs again to recover them.");
        } else {
            Log.i(TAG, srcFile.toString() + " changed; collecting certs");
            Slog.i(TAG, srcFile.toString() + " changed; collecting certs");
        }
        try {