use directory timestamp during OTA am: 095d4125be

am: 9366047713

Change-Id: I7b94106395ccec00298a30f82447252e6252adb8
This commit is contained in:
Todd Kennedy
2016-08-24 02:22:22 +00:00
committed by android-build-merger

View File

@@ -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 {