Fix actual dessert finding logic.
Pre-release devices and CF report Build.VERSION.SDK_INT=30,
eventhough they are S devices, not R.
Bug: 183459854
Test: atest MtsTimeZoneDataTestCases
Change-Id: Ie0334fddf5ad08b1c90e2d5c41ac48f325e1ab7e
diff --git a/apex/tests/src/java/android/tzdata/mts/TimeZoneVersionTest.java b/apex/tests/src/java/android/tzdata/mts/TimeZoneVersionTest.java
index e25c52e..3b0df26 100644
--- a/apex/tests/src/java/android/tzdata/mts/TimeZoneVersionTest.java
+++ b/apex/tests/src/java/android/tzdata/mts/TimeZoneVersionTest.java
@@ -16,6 +16,7 @@
package android.tzdata.mts;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import android.icu.util.VersionInfo;
import android.os.Build;
@@ -44,19 +45,23 @@
public void timeZoneModuleIsCompatibleWithThisRelease() throws Exception {
String majorVersion = readMajorFormatVersionFromModuleVersionFile();
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {
-
- // TODO Hack for master: This ain't Q. Remove this after R devices are behaving
+ assertEquals("003", majorVersion);
+ } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
+ // TODO Hack for master: This ain't R. Remove this after R devices are behaving
// properly.
- if (VersionInfo.ICU_VERSION.getMajor() > 63) {
+ if (VersionInfo.ICU_VERSION.getMajor() > 66) {
+ // S is 5.x.
+ assertEquals("005", majorVersion);
+ } else {
// R is 4.x.
assertEquals("004", majorVersion);
- } else {
- // Q is 3.x.
- assertEquals("003", majorVersion);
}
- } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
- // R is 4.x.
- assertEquals("004", majorVersion);
+ } else {
+ // If this fails, a new API level has likely been finalized and can be made
+ // an explicit case. Keep this clause and add an explicit "else if" above.
+ // Consider removing any checks for pre-release devices too if they're not
+ // needed for now.
+ fail("Unhandled SDK_INT version:" + Build.VERSION.SDK_INT);
}
}