Consider supported abis in the rest of CtsExtractNativeLibsHostTest.

This adds an assumption that checks the desired bit support of
the tests before running them.

Test: run cts -m CtsExtractNativeLibsHostTestCases
Cuttlefish (both 32/64 bit):
Before: 106 pass, 0 fail, 64 skip
After: 106 pass, 0 fail, 64 skip

Goldfish:
Before: 23 pass, 30 fail, 32 skip
After: 21 pass, 0 fail, 64 skip

NOTE: There are two tests that previously passed that are now
skipped. These should have been failing and are being tracked
in a separate issue.

Bug: 186678400

Change-Id: I839f11906b54504c8653c516d523c9d4d73f278d
diff --git a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java
index f20922b..a0ee10c 100644
--- a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java
+++ b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java
@@ -205,6 +205,14 @@
         return new HashSet<String>(Arrays.asList(abiArray));
     }
 
+    final Set<String> getDeviceAbiSuffixes() throws Exception {
+        HashSet<String> abiSuffixes = new HashSet<String>();
+        for (String abi : getDevice().getProperty("ro.product.cpu.abilist").split(",")) {
+            abiSuffixes.add(AbiUtils.getBitness(abi));
+        }
+        return abiSuffixes;
+    }
+
     private void installPackageIncremental(String apkName, String abi) throws Exception {
         CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(getBuild());
         final File apk = buildHelper.getTestFile(apkName);
diff --git a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java
index 53575c8..ca82dec 100644
--- a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java
+++ b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java
@@ -23,8 +23,6 @@
 import android.cts.host.utils.DeviceJUnit4Parameterized;
 import android.platform.test.annotations.AppModeFull;
 
-import com.android.tradefed.util.AbiUtils;
-
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -74,10 +72,9 @@
             // Skip incremental installations for non-incremental devices
             assumeTrue(isIncrementalInstallSupported());
         }
-        if (mAbiSuffix.equals("64")) {
-            // Only run 64-bit tests if device supports both 32-bit and 64-bit
-            final String deviceAbi = getDeviceAbi();
-            assumeTrue(AbiUtils.getBitness(deviceAbi).equals("64"));
+        if (!mAbiSuffix.equals("Both")) {
+            // Skip tests for unsupported abi suffixes.
+            assumeTrue(getDeviceAbiSuffixes().contains(mAbiSuffix));
         }
         super.setUp();
     }
diff --git a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java
index eec8fc2..9ad35f1 100644
--- a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java
+++ b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java
@@ -23,8 +23,6 @@
 import android.cts.host.utils.DeviceJUnit4Parameterized;
 import android.platform.test.annotations.AppModeFull;
 
-import com.android.tradefed.util.AbiUtils;
-
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -83,10 +81,12 @@
             // Skip incremental installations for non-incremental devices
             assumeTrue(isIncrementalInstallSupported());
         }
-        if (mFirstAbiSuffix.equals("64") || mSecondAbiSuffix.equals("64")) {
-            // Only run 64-bit tests if device supports both 32-bit and 64-bit
-            final String deviceAbi = getDeviceAbi();
-            assumeTrue(AbiUtils.getBitness(deviceAbi).equals("64"));
+        // Skip unsupported abi suffixes.
+        if (!mFirstAbiSuffix.equals("Both")) {
+            assumeTrue(getDeviceAbiSuffixes().contains(mFirstAbiSuffix));
+        }
+        if (!mSecondAbiSuffix.equals("Both")) {
+            assumeTrue(getDeviceAbiSuffixes().contains(mSecondAbiSuffix));
         }
         super.setUp();
     }