Allow key downgrade during staged install of apex packages am: 16618cd836

Change-Id: I48184207d07c33a671bfbbaa8fb6e04113e8a477
This commit is contained in:
Automerger Merge Worker
2020-03-11 20:07:35 +00:00

View File

@@ -151,6 +151,14 @@ public class StagingManager {
return; return;
} }
// Verify signing details for downgrade
// Allow downgrading from B to A iff it is possible to upgrade from A to B
if (existingApexPkg.getLongVersionCode() > newApexPkg.getLongVersionCode()
&& existingSigningDetails.checkCapability(signingDetails,
PackageParser.SigningDetails.CertCapabilities.INSTALLED_DATA)) {
return;
}
throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED, throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
"APK-container signature of APEX package " + packageName + " with version " "APK-container signature of APEX package " + packageName + " with version "
+ newApexPkg.versionCodeMajor + " and path " + apexPath + " is not" + newApexPkg.versionCodeMajor + " and path " + apexPath + " is not"