Allow key downgrade during staged install of apex packages
Downgrade is permitted only for the system server initiated sessions. This is enforced by INSTALL_ALLOW_DOWNGRADE flag parameter. Bug: 136002636 Test: atest RollbackManagerHostTest#testApexKeyRotationStagedRollback Change-Id: I0c0e6eaee65a6c77f62425c3929ffa805d1e0f47 Merged-In: I0c0e6eaee65a6c77f62425c3929ffa805d1e0f47
This commit is contained in:
@@ -150,6 +150,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"
|
||||||
|
|||||||
Reference in New Issue
Block a user