Report CPU ABI in Eclair CTS Report Header

Bug 2923901

Display Build.CPU_ABI and Build.CPU_ABI2 properties in the CTS
results header like Froyo CTS. However, the internal SystemProperties
API is used to read the value for CPU_ABI2. This is turn
required commenting out LOCAL_SDK_VERSION := current in the
Android.mk.

Change-Id: If6880ddc3d37c97e4912dad479e9e0ef2ebdca5e
diff --git a/tools/device-setup/TestDeviceSetup/Android.mk b/tools/device-setup/TestDeviceSetup/Android.mk
index 3704be5..17b766f 100644
--- a/tools/device-setup/TestDeviceSetup/Android.mk
+++ b/tools/device-setup/TestDeviceSetup/Android.mk
@@ -24,9 +24,10 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner
 
-LOCAL_SDK_VERSION := current
+# Commented out due to usage of SystemProperties in DeviceInfoInstrument
+# that is just for the Eclair CTS release.
+# LOCAL_SDK_VERSION := current
 
 LOCAL_PACKAGE_NAME := TestDeviceSetup
 
 include $(BUILD_PACKAGE)
-
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
index 1ec9e9b..1d192cb 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -24,6 +24,7 @@
 import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.Bundle;
+import android.os.SystemProperties;
 import android.telephony.TelephonyManager;
 import android.util.DisplayMetrics;
 import android.util.Log;
@@ -59,6 +60,8 @@
     private static final String VERSION_SDK = "version_sdk";
     private static final String VERSION_RELEASE = "version_release";
     private static final String VERSION_INCREMENTAL = "version_incremental";
+    private static final String BUILD_ABI = "build_abi";
+    private static final String BUILD_ABI2 = "build_abi2";
     private static final String BUILD_FINGERPRINT = "build_fingerprint";
     private static final String BUILD_TAGS = "build_tags";
     private static final String BUILD_TYPE = "build_type";
@@ -91,6 +94,12 @@
         addResult(BUILD_TYPE, Build.TYPE);
         addResult(BUILD_TAGS, Build.TAGS);
         addResult(BUILD_FINGERPRINT, Build.FINGERPRINT);
+        addResult(BUILD_ABI, Build.CPU_ABI);
+
+        // The property will be replaced by a SDK constant Build.CPU_ABI_2 in future releases.
+        // If you are removing this line, then update the Android.mk to have
+        // LOCAL_SDK_VERSION := current.
+        addResult(BUILD_ABI2, SystemProperties.get("ro.product.cpu.abi2"));
 
         addResult(VERSION_INCREMENTAL, Build.VERSION.INCREMENTAL);
         addResult(VERSION_RELEASE, Build.VERSION.RELEASE);
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index bea7bab..65ff969 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -401,6 +401,8 @@
         public static final String BUILD_BRAND = "build_brand";
         public static final String BUILD_BOARD = "build_board";
         public static final String BUILD_DEVICE = "build_device";
+        public static final String BUILD_ABI = "build_abi";
+        public static final String BUILD_ABI2 = "build_abi2";
         public static final String SCREEN_HEIGHT = "screen_height";
         public static final String SCREEN_WIDTH = "screen_width";
         public static final String SCREEN_DENSITY = "screen_density";
@@ -509,6 +511,24 @@
         }
 
         /**
+         * Set the build abi
+         *
+         * @param buildAbi The build ABI
+         */
+        public void setBuildAbi(final String buildAbi) {
+            mInfoMap.put(BUILD_ABI, buildAbi);
+        }
+
+        /**
+         * Set the build abi2
+         *
+         * @param buildAbi The build ABI2
+         */
+        public void setBuildAbi2(final String buildAbi2) {
+            mInfoMap.put(BUILD_ABI2, buildAbi2);
+        }
+
+        /**
          * set the serialNumber of this device
          *
          * @param serialNumber The serial number.
@@ -608,6 +628,24 @@
         }
 
         /**
+         * Get the build ABI.
+         *
+         * @return The build ABI.
+         */
+        public String getBuildAbi() {
+            return mInfoMap.get(BUILD_ABI);
+        }
+
+        /**
+         * Get the build ABI2.
+         *
+         * @return The build ABI2.
+         */
+        public String getBuildAbi2() {
+            return mInfoMap.get(BUILD_ABI2);
+        }
+
+        /**
          * get the build id
          **
          * @return The build ID.
diff --git a/tools/host/src/com/android/cts/TestSessionLog.java b/tools/host/src/com/android/cts/TestSessionLog.java
index d04c756..6164a15 100644
--- a/tools/host/src/com/android/cts/TestSessionLog.java
+++ b/tools/host/src/com/android/cts/TestSessionLog.java
@@ -331,6 +331,10 @@
                         DeviceParameterCollector.BUILD_BOARD, bldInfo.getBuildBoard());
                 setAttribute(doc, devInfoNode,
                         DeviceParameterCollector.BUILD_DEVICE, bldInfo.getBuildDevice());
+                setAttribute(doc, devInfoNode,
+                        DeviceParameterCollector.BUILD_ABI, bldInfo.getBuildAbi());
+                setAttribute(doc, devInfoNode,
+                        DeviceParameterCollector.BUILD_ABI2, bldInfo.getBuildAbi2());
 
                 deviceSettingNode.appendChild(devInfoNode);
 
diff --git a/tools/host/src/res/cts_result.xsl b/tools/host/src/res/cts_result.xsl
index 0efc806..12e482a 100644
--- a/tools/host/src/res/cts_result.xsl
+++ b/tools/host/src/res/cts_result.xsl
@@ -94,6 +94,20 @@
                                         </TD>
                                     </TR>
                                     <TR>
+                                        <TD class="rowtitle">Build ABI</TD>
+                                        <TD>
+                                            <xsl:value-of
+                                              select="TestResult/DeviceInfo/BuildInfo/@build_abi"/>
+                                        </TD>
+                                    </TR>
+                                    <TR>
+                                        <TD class="rowtitle">Build ABI2</TD>
+                                        <TD>
+                                            <xsl:value-of
+                                              select="TestResult/DeviceInfo/BuildInfo/@build_abi2"/>
+                                        </TD>
+                                    </TR>
+                                    <TR>
                                         <TD class="rowtitle">Android Platform Version</TD>
                                         <TD>
                                             <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@androidPlatformVersion"/>