am 9afe698a: Merge changes Id93f0efb,I691414d4 into lmp-dev

* commit '9afe698a2605aa52b25454fd740848ac2d097bcd':
  Fixes run cts --class
  Fixes metrics reporting
diff --git a/libs/deviceutil/src/android/cts/util/DeviceReportLog.java b/libs/deviceutil/src/android/cts/util/DeviceReportLog.java
index 88565a7..63b07b7 100644
--- a/libs/deviceutil/src/android/cts/util/DeviceReportLog.java
+++ b/libs/deviceutil/src/android/cts/util/DeviceReportLog.java
@@ -24,12 +24,12 @@
 
 public class DeviceReportLog extends ReportLog {
     private static final String TAG = "DeviceCtsReport";
-    private static final String CTS_RESULT = "CTS_TEST_RESULT";
+    private static final String CTS_RESULT_KEY = "CTS_TEST_RESULT";
     private static final int INST_STATUS_IN_PROGRESS = 2;
     private static final int BASE_DEPTH = 4;
 
     public DeviceReportLog() {
-        mDepth = BASE_DEPTH;
+        this(0);
     }
 
     public DeviceReportLog(int depth) {
@@ -46,7 +46,7 @@
         String report = generateReport();
         if (!report.equals("")) {
             Bundle output = new Bundle();
-            output.putString(CTS_RESULT, report);
+            output.putString(CTS_RESULT_KEY, report);
             instrumentation.sendStatus(INST_STATUS_IN_PROGRESS, output);
         }
     }
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestPackageResult.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestPackageResult.java
index 96c3fd6..29a9bde 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestPackageResult.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestPackageResult.java
@@ -46,7 +46,6 @@
     static final String TAG = "TestPackage";
 
     public static final String CTS_RESULT_KEY = "CTS_TEST_RESULT";
-    public static final String CTS_ABI_KEY = "CTS_TEST_ABI";
 
     private static final String DIGEST_ATTR = "digest";
     private static final String APP_PACKAGE_NAME_ATTR = "appPackageName";
@@ -250,11 +249,7 @@
         // Collect performance results
         for (TestIdentifier test : mTestMetrics.keySet()) {
             // device test can have performance results in test metrics
-            String perfResult = null;
-            Map<String, String> map = mTestMetrics.get(test);
-            if(mAbi.equals(map.get(CTS_ABI_KEY))) {
-                perfResult = map.get(CTS_RESULT_KEY);
-            }
+            String perfResult = mTestMetrics.get(test).get(CTS_RESULT_KEY);
             // host test should be checked in CtsHostStore.
             if (perfResult == null) {
                 perfResult = CtsHostStore.removeCtsResult(mDeviceSerial, mAbi, test.toString());
@@ -300,7 +295,11 @@
             result.setResultStatus(CtsTestStatus.PASS);
         }
         result.updateEndTime();
+        if (mTestMetrics.containsKey(test)) {
+            CLog.e("Test metrics already contains key: " + test);
+        }
         mTestMetrics.put(test, testMetrics);
+        CLog.i("Test metrics:" + testMetrics);
     }
 
     /**
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
index 6d10244..7b57a44 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
@@ -161,10 +161,10 @@
     @Override
     public Set<String> findPackageIdsForTest(String testClassName) {
         Set<String> ids = new HashSet<String>();
-        for (Map<String, TestPackageDef> map : mTestMap.values()) {
-            for (Entry<String, TestPackageDef> entry : map.entrySet()) {
-                if (entry.getValue().isKnownTestClass(testClassName)) {
-                    ids.add(entry.getKey());
+        for (String abi : mTestMap.keySet()) {
+            for (String name : mTestMap.get(abi).keySet()) {
+                if (mTestMap.get(abi).get(name).isKnownTestClass(testClassName)) {
+                    ids.add(AbiUtils.createId(abi, name));
                 }
             }
         }
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/util/HostReportLog.java b/tools/tradefed-host/src/com/android/cts/tradefed/util/HostReportLog.java
index da0d4bb..25676ba 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/util/HostReportLog.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/util/HostReportLog.java
@@ -24,22 +24,22 @@
  */
 public class HostReportLog extends ReportLog {
     private String mDeviceSerial;
-    private String mAbi;
+    private String mAbiName;
     private String mClassMethodName;
 
     /**
      * @param deviceSerial serial number of the device
-     * @param abi abi the test was run on
+     * @param abiName the name of the ABI on which the test was run
      * @param classMethodName class name and method name of the test in class#method format.
      *        Note that ReportLog.getClassMethodNames() provide this.
      */
-    public HostReportLog(String deviceSerial, String abi, String classMethodName) {
+    public HostReportLog(String deviceSerial, String abiName, String classMethodName) {
         mDeviceSerial = deviceSerial;
-        mAbi = abi;
+        mAbiName = abiName;
         mClassMethodName = classMethodName;
     }
 
     public void deliverReportToHost() {
-        CtsHostStore.storeCtsResult(mDeviceSerial, mAbi, mClassMethodName, generateReport());
+        CtsHostStore.storeCtsResult(mDeviceSerial, mAbiName, mClassMethodName, generateReport());
     }
 }