AuthFsHostTestCases: Also skip beforeClassWithDevice

I624b041a31546823290f927812a61a802005a995 skipped the tests on
Cuttlefish but this did not address the problem fully. Skip earlier,
before the shared VM is created.

Bug: 261861853
Test: TH
Merged-In: Ided6b9d71d87bc054cffa95b95af407778ef51f0
Change-Id: Ifea13fc5183e94c55d591f6b8dc7be18a0febb95
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")