merge in ics-mr1-release history after reset to ics-mr1
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoConstants.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoConstants.java
index 57b0dad..63cbce8 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoConstants.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoConstants.java
@@ -23,6 +23,7 @@
*/
public interface DeviceInfoConstants {
+ public static final String SYS_LIBRARIES = "systemlibraries";
public static final String PARTITIONS = "partitions";
public static final String OPEN_GL_ES_VERSION = "openGlEsVersion";
public static final String PROCESSES = "processes";
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 1b705e7..ca0c803 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -131,6 +131,10 @@
String partitions = getPartitions();
addResult(PARTITIONS, partitions);
+ // System libraries
+ String sysLibraries = getSystemLibraries();
+ addResult(SYS_LIBRARIES, sysLibraries);
+
finish(Activity.RESULT_OK, mResults);
}
@@ -319,4 +323,18 @@
return "Not able to run df for partition information.";
}
}
+
+ private String getSystemLibraries() {
+ PackageManager pm = getContext().getPackageManager();
+ String list[] = pm.getSystemSharedLibraryNames();
+
+ StringBuilder builder = new StringBuilder();
+ for (String lib : list) {
+ builder.append(lib);
+ builder.append(";");
+ }
+
+ return builder.toString();
+ }
+
}
diff --git a/tools/tradefed-host/res/report/cts_result.xsd b/tools/tradefed-host/res/report/cts_result.xsd
index 665795f..2a40943 100644
--- a/tools/tradefed-host/res/report/cts_result.xsd
+++ b/tools/tradefed-host/res/report/cts_result.xsd
@@ -81,6 +81,7 @@
</xs:element>
<xs:element name="FeatureInfo" type="featureInfoType"/>
<xs:element name="ProcessInfo" type="processInfoType"/>
+ <xs:element name="SystemLibrariesInfo" type="systemLibrariesInfoType"/>
</xs:sequence>
</xs:complexType>
@@ -139,6 +140,16 @@
</xs:sequence>
</xs:complexType>
+<xs:complexType name="systemLibrariesInfoType">
+ <xs:sequence>
+ <xs:element name="Library" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+</xs:complexType>
+
<xs:complexType name="summaryType">
<xs:attribute name="failed" type="xs:integer"/>
<xs:attribute name="notExecuted" type="xs:integer"/>
diff --git a/tools/tradefed-host/res/report/cts_result.xsl b/tools/tradefed-host/res/report/cts_result.xsl
index a542c8a..ae6f450 100644
--- a/tools/tradefed-host/res/report/cts_result.xsl
+++ b/tools/tradefed-host/res/report/cts_result.xsl
@@ -265,6 +265,16 @@
</UL>
</TD>
</TR>
+ <TR>
+ <TD class="rowtitle">System Libraries</TD>
+ <TD>
+ <UL>
+ <xsl:for-each select="TestResult/DeviceInfo/SystemLibrariesInfo/Library">
+ <LI><xsl:value-of select="@name" /></LI>
+ </xsl:for-each>
+ </UL>
+ </TD>
+ </TR>
</TABLE>
</div>
</TD>
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
index e95ab71..a5519e6 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
@@ -56,7 +56,7 @@
private static final String LOG_TAG = "CtsXmlResultReporter";
static final String TEST_RESULT_FILE_NAME = "testResult.xml";
- private static final String CTS_RESULT_FILE_VERSION = "1.11";
+ private static final String CTS_RESULT_FILE_VERSION = "1.12";
private static final String[] CTS_RESULT_RESOURCES = {"cts_result.xsl", "cts_result.css",
"logo.gif", "newrule-green.png"};
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/DeviceInfoResult.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/DeviceInfoResult.java
index 102e998..28f818a 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/DeviceInfoResult.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/result/DeviceInfoResult.java
@@ -46,6 +46,9 @@
private static final String FEATURE_TAG = "Feature";
private static final String FEATURE_ATTR_DELIM = ":";
private static final String FEATURE_DELIM = ";";
+ private static final String SYSLIB_INFO_TAG = "SystemLibrariesInfo";
+ private static final String SYSLIB_TAG = "Library";
+ private static final String SYSLIB_DELIM = ";";
private static final String PROCESS_INFO_TAG = "ProcessInfo";
private static final String PROCESS_TAG = "Process";
private static final String PROCESS_DELIM = ";";
@@ -83,6 +86,7 @@
String featureData = getMetric(metricsCopy, DeviceInfoConstants.FEATURES);
String processData = getMetric(metricsCopy, DeviceInfoConstants.PROCESSES);
+ String sysLibData = getMetric(metricsCopy, DeviceInfoConstants.SYS_LIBRARIES);
// dump the remaining metrics without translation
serializer.startTag(ns, BUILD_TAG);
@@ -93,6 +97,7 @@
serializeFeatureInfo(serializer, featureData);
serializeProcessInfo(serializer, processData);
+ serializeSystemLibrariesInfo(serializer, sysLibData);
} else {
// this might be expected, if device info collection was turned off
CLog.d("Could not find device info");
@@ -183,6 +188,39 @@
serializer.endTag(ns, PROCESS_INFO_TAG);
}
+
+ /**
+ * Prints XML data listing available system libraries.
+ * It parses a string from the rootLibraries argument that is in the form of
+ * "libName1;libName2;..." with a trailing semi-colon.
+ *
+ * <pre>
+ * <SystemLibrariesInfo>
+ * <Library name="a.b.c" />
+ * ...
+ * </SystemLibrariesInfo>
+ * </pre>
+ */
+ private void serializeSystemLibrariesInfo(KXmlSerializer serializer, String rootLibraries)
+ throws IOException {
+ serializer.startTag(ns, SYSLIB_INFO_TAG);
+
+ if (rootLibraries == null) {
+ rootLibraries = "";
+ }
+
+ String[] libNames = rootLibraries.split(SYSLIB_DELIM);
+ for (String libName : libNames) {
+ libName = libName.trim();
+ if (libName.length() > 0) {
+ serializer.startTag(ns, SYSLIB_TAG);
+ serializer.attribute(ns, "name", libName);
+ serializer.endTag(ns, SYSLIB_TAG);
+ }
+ }
+ serializer.endTag(ns, SYSLIB_INFO_TAG);
+ }
+
/**
* Populates this class with package result data parsed from XML.
*
@@ -210,6 +248,10 @@
// store processes into metrics map, in the same format as when collected from
// device
mMetrics.put(DeviceInfoConstants.PROCESSES, parseProcess(parser));
+ } else if (parser.getName().equals(SYSLIB_INFO_TAG)) {
+ // store system libs into metrics map, in the same format as when collected from
+ // device
+ mMetrics.put(DeviceInfoConstants.SYS_LIBRARIES, parseSystemLibraries(parser));
}
} else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(TAG)) {
return;
@@ -271,6 +313,31 @@
}
+
+ /**
+ * Parse JavaLibrariesInfo XML, and return its contents as a delimited String
+ */
+ private String parseSystemLibraries(XmlPullParser parser) throws XmlPullParserException, IOException {
+ if (!parser.getName().equals(SYSLIB_INFO_TAG)) {
+ throw new XmlPullParserException(String.format(
+ "invalid XML: Expected %s tag but received %s", SYSLIB_INFO_TAG,
+ parser.getName()));
+ }
+ StringBuilder libsString = new StringBuilder();
+ int eventType = parser.getEventType();
+ while (eventType != XmlPullParser.END_DOCUMENT) {
+ if (eventType == XmlPullParser.START_TAG && parser.getName().equals(SYSLIB_TAG)) {
+ libsString.append(getAttribute(parser, "name"));
+ libsString.append(SYSLIB_DELIM);
+ } else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(
+ SYSLIB_INFO_TAG)) {
+ return libsString.toString();
+ }
+ eventType = parser.next();
+ }
+ return libsString.toString();
+ }
+
/**
* Adds all attributes from the current XML tag to metrics as name-value pairs
*/
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/CtsXmlResultReporterTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/CtsXmlResultReporterTest.java
index 190aa77..4162c65 100644
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/CtsXmlResultReporterTest.java
+++ b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/CtsXmlResultReporterTest.java
@@ -83,7 +83,7 @@
final String expectedHeaderOutput = "<?xml version='1.0' encoding='UTF-8' standalone='no' ?>" +
"<?xml-stylesheet type=\"text/xsl\" href=\"cts_result.xsl\"?>";
final String expectedTestOutput =
- "<TestResult testPlan=\"NA\" starttime=\"ignore\" endtime=\"ignore\" version=\"1.11\"> ";
+ "<TestResult testPlan=\"NA\" starttime=\"ignore\" endtime=\"ignore\" version=\"1.12\"> ";
final String expectedSummaryOutput =
"<Summary failed=\"0\" notExecuted=\"0\" timeout=\"0\" pass=\"0\" />";
final String expectedEndTag = "</TestResult>";