Merge "Avoid unnecessary tear down in the test"
diff --git a/compos/tests/java/android/compos/test/ComposTestCase.java b/compos/tests/java/android/compos/test/ComposTestCase.java
index 8a1b41a..eb2e072 100644
--- a/compos/tests/java/android/compos/test/ComposTestCase.java
+++ b/compos/tests/java/android/compos/test/ComposTestCase.java
@@ -80,7 +80,7 @@
@Before
public void setUp() throws Exception {
- testIfDeviceIsCapable(getDevice());
+ assumeDeviceIsCapable(getDevice());
String value = getDevice().getProperty(SYSTEM_SERVER_COMPILER_FILTER_PROP_NAME);
if (value == null) {
diff --git a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
index 7441149..8c6218c 100644
--- a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
+++ b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
@@ -89,10 +89,12 @@
@Before
public void setUp() throws Exception {
- testIfDeviceIsCapable(getDevice());
- mNeedTearDown = true;
+ mNeedTearDown = false;
mNeedToRestartPkvmStatus = false;
+ assumeDeviceIsCapable(getDevice());
+ mNeedTearDown = true;
+
getDevice().installPackage(findTestFile(APK_NAME), /* reinstall */ false);
mMetricsProcessor = new MetricsProcessor(getMetricPrefix() + "hostside/");
@@ -102,7 +104,7 @@
public void tearDown() throws Exception {
if (!mNeedTearDown) {
// If we skipped setUp, we don't need to undo it, and that avoids potential exceptions
- // incompatible hardware. (Note that tests can change what testIfDeviceIsCapable()
+ // incompatible hardware. (Note that tests can change what assumeDeviceIsCapable()
// sees, so we can't rely on that - b/268688303.)
return;
}
diff --git a/tests/hostside/helper/java/com/android/microdroid/test/host/MicrodroidHostTestCaseBase.java b/tests/hostside/helper/java/com/android/microdroid/test/host/MicrodroidHostTestCaseBase.java
index a7f7906..4807c0f 100644
--- a/tests/hostside/helper/java/com/android/microdroid/test/host/MicrodroidHostTestCaseBase.java
+++ b/tests/hostside/helper/java/com/android/microdroid/test/host/MicrodroidHostTestCaseBase.java
@@ -97,7 +97,7 @@
DeviceProperties.create(getDevice()::getProperty).getMetricsTag());
}
- public static void testIfDeviceIsCapable(ITestDevice androidDevice) throws Exception {
+ public static void assumeDeviceIsCapable(ITestDevice androidDevice) throws Exception {
assumeTrue("Need an actual TestDevice", androidDevice instanceof TestDevice);
TestDevice testDevice = (TestDevice) androidDevice;
assumeTrue(
diff --git a/tests/hostside/java/com/android/microdroid/test/MicrodroidHostTests.java b/tests/hostside/java/com/android/microdroid/test/MicrodroidHostTests.java
index 4c1dba5..2027fcd 100644
--- a/tests/hostside/java/com/android/microdroid/test/MicrodroidHostTests.java
+++ b/tests/hostside/java/com/android/microdroid/test/MicrodroidHostTests.java
@@ -971,7 +971,7 @@
@Before
public void setUp() throws Exception {
- testIfDeviceIsCapable(getDevice());
+ assumeDeviceIsCapable(getDevice());
mMetricPrefix = getMetricPrefix() + "microdroid/";
mMicrodroidDevice = null;
diff --git a/tests/hostside/java/com/android/microdroid/test/PvmfwDebugPolicyHostTests.java b/tests/hostside/java/com/android/microdroid/test/PvmfwDebugPolicyHostTests.java
index 18aa273..22131f1 100644
--- a/tests/hostside/java/com/android/microdroid/test/PvmfwDebugPolicyHostTests.java
+++ b/tests/hostside/java/com/android/microdroid/test/PvmfwDebugPolicyHostTests.java
@@ -112,7 +112,7 @@
getTestInformation().getDependencyFile(BCC_FILE_NAME, /* targetFirst= */ false);
// Check device capability
- testIfDeviceIsCapable(mAndroidDevice);
+ assumeDeviceIsCapable(mAndroidDevice);
assumeTrue(
"Protected VMs are not supported",
mAndroidDevice.supportsMicrodroid(/*protectedVm=*/ true));