aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Groover <mpgroover@google.com>2021-11-11 13:51:57 -0800
committerMichael Groover <mpgroover@google.com>2021-11-11 13:51:57 -0800
commit45f34cf07116cf9b13809bd0d24f37670558c0b9 (patch)
treedbeac2eb266b3897b31ed50998493ea0541dbf61
parent72fd03affc104d64f3131f19cada85eaff4bff76 (diff)
downloadapksig-45f34cf07116cf9b13809bd0d24f37670558c0b9.tar.gz
Update minSdkVersion for v3.1 block to Sv2 API level (32)
During the development of a new platform, the SDK version of the most recently finalized platform release is used. Initially T used the SDK version of S (31), but recently Sv2 was finalized and the SDK version was bumped to 32. In order for the v3.1 signing block to be recognized on a device running T, the device SDK version must fall within the bounds of the v3.1 signer's min / max SDK version. The v3.1 signature scheme will still work on devices running T with the new SDK version of 32 since apksig was using 31 as the min SDK version, but this value is also used as the max SDK version for the v3.0 signer. Since Sv2 is also using 32 as its API level, the max SDK version of 31 written to the v3.0 signer block prevents the device from recognizing a proper v3.0 signer. This commit updates the API level used for the v3.1 signer block to 32 which will also update the v3.0 signing block to use 32 as the max SDK version allowing APKs signed with the v3.1 signature scheme targeting T for rotation to properly install with the original signer on a device running Sv2 with the finalized SDK. Fixes: 205551461 Test: gradlew test Change-Id: I44d65c36adfea4d792ae97afa1aac6ddfd09bdd3
-rw-r--r--src/main/java/com/android/apksig/internal/apk/v3/V3SchemeConstants.java4
-rw-r--r--src/test/java/com/android/apksig/ApkSignerTest.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/android/apksig/internal/apk/v3/V3SchemeConstants.java b/src/main/java/com/android/apksig/internal/apk/v3/V3SchemeConstants.java
index 33d3fe4..834e3cc 100644
--- a/src/main/java/com/android/apksig/internal/apk/v3/V3SchemeConstants.java
+++ b/src/main/java/com/android/apksig/internal/apk/v3/V3SchemeConstants.java
@@ -35,9 +35,9 @@ public class V3SchemeConstants {
* The v3.1 signature scheme is initially intended for the T development release, but until
* the T SDK is finalized it is using the SDK version of the latest platform release. To support
* testing of the v3.1 signature scheme and key rotation on the T development release, the
- * rotation-min-sdk-version should use the SDK version of S in the v3.1 signer block.
+ * rotation-min-sdk-version should use the SDK version of Sv2 in the v3.1 signer block.
*/
- public static final int DEV_RELEASE_ROTATION_MIN_SDK_VERSION = AndroidSdkVersion.S;
+ public static final int DEV_RELEASE_ROTATION_MIN_SDK_VERSION = AndroidSdkVersion.Sv2;
/**
* This attribute is intended to be written to the V3.0 signer block as an additional attribute
diff --git a/src/test/java/com/android/apksig/ApkSignerTest.java b/src/test/java/com/android/apksig/ApkSignerTest.java
index efadd7c..46126bb 100644
--- a/src/test/java/com/android/apksig/ApkSignerTest.java
+++ b/src/test/java/com/android/apksig/ApkSignerTest.java
@@ -1590,7 +1590,7 @@ public class ApkSignerTest {
SECOND_RSA_2048_SIGNER_RESOURCE_NAME);
// Since T is still under development, it is using the SDK version of the previous platform
// release, so to test v3.1 on T the rotation-min-sdk-version must target the SDK version
- // of S.
+ // of Sv2.
assertV31SignerTargetsMinApiLevel(resultMinRotationT, SECOND_RSA_2048_SIGNER_RESOURCE_NAME,
V3SchemeConstants.DEV_RELEASE_ROTATION_MIN_SDK_VERSION);
assertVerified(resultMinRotationU);
@@ -1685,7 +1685,7 @@ public class ApkSignerTest {
// Since T is still under development, it is using the SDK version of the previous platform
// release, so to test v3.1 on T the rotation-min-sdk-version must target the SDK version
- // of S.
+ // of Sv2.
assertResultContainsSigners(result, true, FIRST_RSA_2048_SIGNER_RESOURCE_NAME,
SECOND_RSA_2048_SIGNER_RESOURCE_NAME);
assertV31SignerTargetsMinApiLevel(result, SECOND_RSA_2048_SIGNER_RESOURCE_NAME,