Merge "Test Sensor Feature Reporting" into froyo
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 a54ee4c..311cf61 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -40,6 +40,7 @@
 
     private static final String TAG = "DeviceInfoInstrument";
 
+    private static final String OPEN_GL_ES_VERSION = "opengles_version";
     private static final String PROCESSES = "processes";
     private static final String FEATURES = "features";
     private static final String PHONE_NUMBER = "phoneNumber";
@@ -144,6 +145,11 @@
         String processes = getProcesses();
         addResult(PROCESSES, processes);
 
+        // OpenGL ES version
+        String openGlEsVersion = getOpenGlEsVersion();
+        addResult(OPEN_GL_ES_VERSION, openGlEsVersion);
+
+
         finish(Activity.RESULT_OK, mResults);
     }
 
@@ -256,4 +262,19 @@
 
         return builder.toString();
     }
+
+    /** @return a string containing the Open GL ES version number or an error message */
+    private String getOpenGlEsVersion() {
+        PackageManager packageManager = getContext().getPackageManager();
+        FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
+        if (featureInfos != null && featureInfos.length > 0) {
+            for (FeatureInfo featureInfo : featureInfos) {
+                // Null feature name means this feature is the open gl es version feature.
+                if (featureInfo.name == null) {
+                    return featureInfo.getGlEsVersion();
+                }
+            }
+        }
+        return "No feature for Open GL ES version.";
+    }
 }
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index 690742d..65ff969 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -420,6 +420,7 @@
         public static final String PHONE_NUMBER = "phoneNumber";
         public static final String FEATURES = "features";
         public static final String PROCESSES = "processes";
+        public static final String OPEN_GL_ES_VERSION = "opengles_version";
 
         private HashMap<String, String> mInfoMap;
 
@@ -805,6 +806,15 @@
         public String getProcesses() {
             return mInfoMap.get(PROCESSES);
         }
+
+        /**
+         * Get Open GL ES version.
+         *
+         * @return version or error message.
+         */
+        public String getOpenGlEsVersion() {
+            return mInfoMap.get(OPEN_GL_ES_VERSION);
+        }
     }
 
     /**
diff --git a/tools/host/src/com/android/cts/TestSessionLog.java b/tools/host/src/com/android/cts/TestSessionLog.java
index b37e5a2..6164a15 100644
--- a/tools/host/src/com/android/cts/TestSessionLog.java
+++ b/tools/host/src/com/android/cts/TestSessionLog.java
@@ -46,7 +46,7 @@
     private static final String ATTRIBUTE_KNOWN_FAILURE = "KnownFailure";
 
     public static final String CTS_RESULT_FILE_NAME = "testResult.xml";
-    private static final String CTS_RESULT_FILE_VERSION = "1.2";
+    private static final String CTS_RESULT_FILE_VERSION = "1.5";
 
     static final String ATTRIBUTE_STARTTIME = "starttime";
     static final String ATTRIBUTE_ENDTIME = "endtime";
@@ -72,6 +72,7 @@
     static final String ATTRIBUTE_AVAILABLE = "available";
     static final String ATTRIBUTE_TYPE = "type";
     static final String ATTRIBUTE_UID = "uid";
+    static final String ATTRIBUTE_OPEN_GL_ES_VERSION = "openGlEsVersion";
 
     static final String ATTRIBUTE_PASS = "pass";
     static final String ATTRIBUTE_FAILED = "failed";
@@ -315,6 +316,8 @@
                 setAttribute(doc, devInfoNode, ATTRIBUTE_NETWORK, bldInfo.getNetwork());
                 setAttribute(doc, devInfoNode, ATTRIBUTE_IMEI, bldInfo.getIMEI());
                 setAttribute(doc, devInfoNode, ATTRIBUTE_IMSI, bldInfo.getIMSI());
+                setAttribute(doc, devInfoNode, ATTRIBUTE_OPEN_GL_ES_VERSION,
+                        bldInfo.getOpenGlEsVersion());
 
                 setAttribute(doc, devInfoNode,
                         DeviceParameterCollector.BUILD_FINGERPRINT, bldInfo.getBuildFingerPrint());
diff --git a/tools/host/src/res/cts_result.xsl b/tools/host/src/res/cts_result.xsl
index 72b0f86..12e482a 100644
--- a/tools/host/src/res/cts_result.xsl
+++ b/tools/host/src/res/cts_result.xsl
@@ -182,6 +182,12 @@
                                         </TD>
                                     </TR>
                                     <TR>
+                                        <TD class="rowtitle">Open GL ES Version</TD>
+                                        <TD>
+                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@openGlEsVersion"/>
+                                        </TD>
+                                    </TR>
+                                    <TR>
                                         <TD class="rowtitle">Features</TD>
                                         <TD>
                                             <xsl:for-each select="TestResult/DeviceInfo/FeatureInfo/Feature[@type='sdk']">