Support shouldTestUApis

This is needed by follow-up CL to properly skip tests on T, T-
devices.

Test: TH
Bug: 258471863
Change-Id: If292751ee7ff3bb6e3683eef50066b445e2ca731
This commit is contained in:
Junyu Lai 2022-11-14 15:34:09 +08:00
commit 28187fffcb

View file

@ -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;
}
}