From 88f5da0903c3ae4a2f840b45669002c4ced51b7a Mon Sep 17 00:00:00 2001 From: Yan Yan Date: Fri, 5 Mar 2021 00:13:10 +0000 Subject: [PATCH] Revert "Use VERSION_CODES.S instead of VERSION_CODES.R + 1" This reverts commit 272ee7c909e138cfc8cd6c9f0c9728e688f6b1dc. Reason for revert: 1. The BUILD_VERSIONS.S is 1000, and thus it will prevent the code from requiring new algorithms on devices whose first sdk is 31 (e.g. cuttlefish), though these devices should be treated as first launched with SDK S. 2. It will break #testValidationForAlgosAddedInS, because the test code is using BUILD_VERSIONS.R to gate the test, which is inconsistent with the implementation. Bug: 181887451 Test: atest IpSecAlgorithmTest Change-Id: I5cd717c5ebd6086ae5cf9abf76311ae4fca0c6e9 --- core/java/android/net/IpSecAlgorithm.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/java/android/net/IpSecAlgorithm.java b/core/java/android/net/IpSecAlgorithm.java index 268002f1dd..8f1e2defd2 100644 --- a/core/java/android/net/IpSecAlgorithm.java +++ b/core/java/android/net/IpSecAlgorithm.java @@ -232,10 +232,11 @@ public final class IpSecAlgorithm implements Parcelable { ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_HMAC_SHA512, SDK_VERSION_ZERO); ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_CRYPT_AES_GCM, SDK_VERSION_ZERO); - ALGO_TO_REQUIRED_FIRST_SDK.put(CRYPT_AES_CTR, Build.VERSION_CODES.S); - ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_AES_XCBC, Build.VERSION_CODES.S); - ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_AES_CMAC, Build.VERSION_CODES.S); - ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_CRYPT_CHACHA20_POLY1305, Build.VERSION_CODES.S); + // STOPSHIP: b/170424293 Use Build.VERSION_CODES.S when it is defined + ALGO_TO_REQUIRED_FIRST_SDK.put(CRYPT_AES_CTR, Build.VERSION_CODES.R + 1); + ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_AES_XCBC, Build.VERSION_CODES.R + 1); + ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_AES_CMAC, Build.VERSION_CODES.R + 1); + ALGO_TO_REQUIRED_FIRST_SDK.put(AUTH_CRYPT_CHACHA20_POLY1305, Build.VERSION_CODES.R + 1); } private static final Set ENABLED_ALGOS =