AuthFsHostTestCases: Also skip beforeClassWithDevice am: 2ffc9278a7 am: 27fa790808

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/20839129

Change-Id: I0cf0cd17293ac047089db0bd81c50328914582bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java b/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java
index 67275c1..b18fbae 100644
--- a/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java
+++ b/authfs/tests/java/src/com/android/fs/AuthFsHostTest.java
@@ -125,6 +125,11 @@
         ITestDevice androidDevice = testInfo.getDevice();
         sAndroid = new CommandRunner(androidDevice);
 
+        if (isCuttlefish(androidDevice)) {
+            sAssumptionFailed = true;
+            return;
+        }
+
         try {
             testIfDeviceIsCapable(androidDevice);
         } catch (AssumptionViolatedException e) {
@@ -173,7 +178,6 @@
     @Before
     public void setUp() throws Exception {
         assumeFalse(sAssumptionFailed);
-        assumeFalse(isCuttlefish());
         sAndroid.run("mkdir " + TEST_OUTPUT_DIR);
     }
 
diff --git a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
index dae4231..8e2d0ee 100644
--- a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
+++ b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
@@ -401,7 +401,11 @@
     }
 
     protected boolean isCuttlefish() throws Exception {
-        String productName = getDevice().getProperty("ro.product.name");
+        return isCuttlefish(getDevice());
+    }
+
+    protected static boolean isCuttlefish(ITestDevice device) throws Exception {
+        String productName = device.getProperty("ro.product.name");
         return (null != productName)
                 && (productName.startsWith("aosp_cf_x86")
                         || productName.startsWith("aosp_cf_arm")