From 28187fffcba01e9159aa8a624aeffa97db42ce8d Mon Sep 17 00:00:00 2001 From: Junyu Lai Date: Mon, 14 Nov 2022 15:34:09 +0800 Subject: [PATCH] Support shouldTestUApis This is needed by follow-up CL to properly skip tests on T, T- devices. Test: TH Bug: 258471863 Change-Id: If292751ee7ff3bb6e3683eef50066b445e2ca731 --- tests/cts/net/src/android/net/cts/TestUtils.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/cts/net/src/android/net/cts/TestUtils.java b/tests/cts/net/src/android/net/cts/TestUtils.java index 001aa01799..61808450c6 100644 --- a/tests/cts/net/src/android/net/cts/TestUtils.java +++ b/tests/cts/net/src/android/net/cts/TestUtils.java @@ -16,8 +16,6 @@ package android.net.cts; -import static com.android.testutils.DevSdkIgnoreRuleKt.SC_V2; - import android.os.Build; import com.android.modules.utils.build.SdkLevel; @@ -37,11 +35,18 @@ public class TestUtils { } /** - * Whether to test T+ APIs. This requires a) that the test be running on an S+ device, and + * Whether to test T+ APIs. This requires a) that the test be running on an T+ device, and * b) that the code be compiled against shims new enough to access these APIs. */ public static boolean shouldTestTApis() { - // TODO: replace SC_V2 with Build.VERSION_CODES.S_V2 when it's available in mainline branch. - return SdkLevel.isAtLeastT() && ConstantsShim.VERSION > SC_V2; + return SdkLevel.isAtLeastT() && ConstantsShim.VERSION > Build.VERSION_CODES.S_V2; + } + + /** + * Whether to test U+ APIs. This requires a) that the test be running on an U+ device, and + * b) that the code be compiled against shims new enough to access these APIs. + */ + public static boolean shouldTestUApis() { + return SdkLevel.isAtLeastU() && ConstantsShim.VERSION > Build.VERSION_CODES.TIRAMISU; } }