Revert "Generate XML for all ABIs"

This reverts commit 5297e3f2a552d28a76bf8bb0ee1218e4f3e50dee.

Change-Id: I763e7efae4179c20835955417be876d9703a27e2
diff --git a/CtsBuild.mk b/CtsBuild.mk
index 4521b7e..86ecde8 100644
--- a/CtsBuild.mk
+++ b/CtsBuild.mk
@@ -33,6 +33,9 @@
 # File indicating which tests should be blacklisted due to unsupported abi.
 CTS_UNSUPPORTED_ABIS := cts/tests/expectations/unsupportedabis.txt
 
+# Holds the target architecture to build for.
+CTS_TARGET_ARCH := $(TARGET_ARCH)
+
 # Functions to get the paths of the build outputs.
 
 define cts-get-lib-paths
diff --git a/build/test_executable.mk b/build/test_executable.mk
index 5cccd1c..e0352ba 100644
--- a/build/test_executable.mk
+++ b/build/test_executable.mk
@@ -41,4 +41,5 @@
 						-p $(PRIVATE_TEST_PACKAGE) \
 						-e $(CTS_EXPECTATIONS) \
 						-b $(CTS_UNSUPPORTED_ABIS) \
+						-a $(CTS_TARGET_ARCH) \
 						-o $@
diff --git a/build/test_gtest_package.mk b/build/test_gtest_package.mk
index c3471ed..6868081 100644
--- a/build/test_gtest_package.mk
+++ b/build/test_gtest_package.mk
@@ -50,4 +50,5 @@
 						-p $(PRIVATE_TEST_PACKAGE) \
 						-e $(CTS_EXPECTATIONS) \
 						-b $(CTS_UNSUPPORTED_ABIS) \
+						-a $(CTS_TARGET_ARCH) \
 						-o $@
diff --git a/build/test_host_java_library.mk b/build/test_host_java_library.mk
index cb44010..baf9e75 100644
--- a/build/test_host_java_library.mk
+++ b/build/test_host_java_library.mk
@@ -36,4 +36,5 @@
 						-p $(PRIVATE_TEST_PACKAGE) \
 						-e $(CTS_EXPECTATIONS) \
 						-b $(CTS_UNSUPPORTED_ABIS) \
+						-a $(CTS_TARGET_ARCH) \
 						-o $@
diff --git a/build/test_package.mk b/build/test_package.mk
index 7f61e60..353ae07 100644
--- a/build/test_package.mk
+++ b/build/test_package.mk
@@ -58,4 +58,5 @@
 						-p $(PRIVATE_TEST_PACKAGE) \
 						-e $(CTS_EXPECTATIONS) \
 						-b $(CTS_UNSUPPORTED_ABIS) \
+						-a $(CTS_TARGET_ARCH) \
 						-o $@
diff --git a/build/test_target_java_library.mk b/build/test_target_java_library.mk
index d526805..c0d7a2a 100644
--- a/build/test_target_java_library.mk
+++ b/build/test_target_java_library.mk
@@ -41,5 +41,6 @@
 						-p $(PRIVATE_TEST_PACKAGE) \
 						-e $(CTS_EXPECTATIONS) \
 						-b $(CTS_UNSUPPORTED_ABIS) \
+						-a $(CTS_TARGET_ARCH) \
 						-x "runtimeArgs->$(PRIVATE_RUNTIME_ARGS)" \
 						-o $@
diff --git a/build/test_uiautomator.mk b/build/test_uiautomator.mk
index 7757027..5e2f07a 100644
--- a/build/test_uiautomator.mk
+++ b/build/test_uiautomator.mk
@@ -49,4 +49,5 @@
 						-r $(PRIVATE_TEST_APP_PACKAGE) \
 						-e $(CTS_EXPECTATIONS) \
 						-b $(CTS_UNSUPPORTED_ABIS) \
+						-a $(CTS_TARGET_ARCH) \
 						-o $@
diff --git a/libs/commonutil/src/com/android/cts/util/AbiUtils.java b/libs/commonutil/src/com/android/cts/util/AbiUtils.java
index f28237c..4a34c6f 100644
--- a/libs/commonutil/src/com/android/cts/util/AbiUtils.java
+++ b/libs/commonutil/src/com/android/cts/util/AbiUtils.java
@@ -100,6 +100,9 @@
      * @return a new Set containing the ABIs.
      */
     public static Set<String> getAbisForArch(String arch) {
+        if (arch == null || arch.isEmpty() || !ARCH_TO_ABIS.containsKey(arch)) {
+            return getAbisSupportedByCts();
+        }
         return new HashSet<String>(ARCH_TO_ABIS.get(arch));
     }
 
diff --git a/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/CtsXmlGenerator.java b/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/CtsXmlGenerator.java
index 384466a..f194edf 100644
--- a/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/CtsXmlGenerator.java
+++ b/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/CtsXmlGenerator.java
@@ -36,10 +36,10 @@
 
     private static void usage(String[] args) {
         System.err.println("Arguments: " + Arrays.asList(args));
-        System.err.println("Usage: cts-xml-generator -p PACKAGE_NAME -n NAME [-s APP_NAME_SPACE]"
-                + " [-t TEST_TYPE] [-j JAR_PATH] [-i INSTRUMENTATION] [-m MANIFEST_FILE]"
-                + " [-e EXPECTATION_FILE] [-b UNSUPPORTED_ABI_FILE] [-o OUTPUT_FILE]"
-                + " [-x ADDITIONAL_ATTRIBUTE_KEY->VALUE]");
+        System.err.println("Usage: cts-xml-generator -p PACKAGE_NAME -n NAME [-t TEST_TYPE]"
+                + " [-j JAR_PATH] [-i INSTRUMENTATION] [-m MANIFEST_FILE] [-e EXPECTATION_FILE]"
+                + " [-b UNSUPPORTED_ABI_FILE] [-a ARCHITECTURE] [-o OUTPUT_FILE]"
+                + " [-s APP_NAME_SPACE] [-x ADDITIONAL_ATTRIBUTE_KEY->VALUE]");
         System.exit(1);
     }
 
@@ -49,6 +49,7 @@
         String outputPath = null;
         Set<File> expectationFiles = new HashSet<File>();
         Set<File> abiFiles = new HashSet<File>();
+        String architecture = null;
         File manifestFile = null;
         String instrumentation = null;
         String testType = null;
@@ -75,6 +76,8 @@
                         "Missing value for expectation store")));
             } else if ("-b".equals(args[i])) {
                 abiFiles.add(new File(getArg(args, ++i, "Missing value for abi store")));
+            } else if ("-a".equals(args[i])) {
+                architecture = getArg(args, ++i, "Missing value for architecture");
             } else if ("-o".equals(args[i])) {
                 outputPath = getArg(args, ++i, "Missing value for output file");
             } else if ("-s".equals(args[i])) {
@@ -124,9 +127,9 @@
 
         ExpectationStore failuresStore = ExpectationStore.parse(expectationFiles, ModeId.DEVICE);
         ExpectationStore abiStore = ExpectationStore.parse(abiFiles, ModeId.DEVICE);
-        XmlGenerator generator = new XmlGenerator(failuresStore, abiStore, appNameSpace,
-                appPackageName, name, runner, instrumentation, targetNameSpace, jarPath, testType,
-                outputPath, additionalAttributes);
+        XmlGenerator generator = new XmlGenerator(failuresStore, abiStore, architecture,
+                appNameSpace, appPackageName, name, runner, instrumentation, targetNameSpace,
+                jarPath, testType, outputPath, additionalAttributes);
         generator.writePackageXml();
     }
 
diff --git a/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/XmlGenerator.java b/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/XmlGenerator.java
index 4a56a8e..1680cae 100644
--- a/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/XmlGenerator.java
+++ b/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/XmlGenerator.java
@@ -79,12 +79,14 @@
     /** ExpectationStore to filter out unsupported abis. */
     private final ExpectationStore mUnsupportedAbis;
 
+    private final String mArchitecture;
+
     private final Map<String, String> mAdditionalAttributes;
 
     XmlGenerator(ExpectationStore knownFailures, ExpectationStore unsupportedAbis,
-            String appNameSpace, String appPackageName, String name, String runner,
-            String targetBinaryName, String targetNameSpace, String jarPath, String testType,
-            String outputPath, Map<String, String> additionalAttributes) {
+            String architecture, String appNameSpace, String appPackageName, String name,
+            String runner, String targetBinaryName, String targetNameSpace, String jarPath,
+            String testType, String outputPath, Map<String, String> additionalAttributes) {
         mAppNamespace = appNameSpace;
         mAppPackageName = appPackageName;
         mName = name;
@@ -96,6 +98,7 @@
         mOutputPath = outputPath;
         mKnownFailures = knownFailures;
         mUnsupportedAbis = unsupportedAbis;
+        mArchitecture = architecture;
         mAdditionalAttributes = additionalAttributes;
     }
 
@@ -202,7 +205,7 @@
             String className = nameCollector.toString();
             nameCollector.append('#').append(test.getName());
             writer.append("<Test name=\"").append(test.getName()).append("\"");
-            String abis = getSupportedAbis(mUnsupportedAbis, className).toString();
+            String abis = getSupportedAbis(mUnsupportedAbis, mArchitecture, className).toString();
             writer.append(" abis=\"" + abis.substring(1, abis.length() - 1) + "\"");
             if (isKnownFailure(mKnownFailures, nameCollector.toString())) {
                 writer.append(" expectation=\"failure\"");
@@ -229,8 +232,8 @@
 
     // Returns the list of ABIs supported by this TestCase on this architecture.
     public static Set<String> getSupportedAbis(ExpectationStore expectationStore,
-            String className) {
-        Set<String> supportedAbis = AbiUtils.getAbisSupportedByCts();
+            String architecture, String className) {
+        Set<String> supportedAbis = AbiUtils.getAbisForArch(architecture);
         Expectation e = (expectationStore == null) ? null : expectationStore.get(className);
         if (e != null && !e.getDescription().isEmpty()) {
             // Description should be written in the form "blah blah: abi1, abi2..."