Merge changes from topic "am-e6889624-85e8-40a4-af07-d6190d5beac3" into oc-mr1-dev

* changes:
  [automerger] Add ability to include test report summary html report in the zip file. File is included if the flag '--html-in-zip' is present. am: 5caff88f33 am: d0655e383e
  [automerger] Add ability to include test report summary html report in the zip file. File is included if the flag '--html-in-zip' is present. am: 5caff88f33
  Add ability to include test report summary html report in the zip file. File is included if the flag '--html-in-zip' is present.
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
index 574a2a1..5427c26 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
@@ -80,6 +80,7 @@
 public class ResultReporter implements ILogSaverListener, ITestInvocationListener,
        ITestSummaryListener, IShardableListener {
 
+    public static final String INCLUDE_HTML_IN_ZIP = "html-in-zip";
     private static final String UNKNOWN_DEVICE = "unknown_device";
     private static final String RESULT_KEY = "COMPATIBILITY_TEST_RESULT";
     private static final String CTS_PREFIX = "cts:";
@@ -128,6 +129,10 @@
     @Option(name = "compress-logs", description = "Whether logs will be saved with compression")
     private boolean mCompressLogs = true;
 
+    @Option(name = INCLUDE_HTML_IN_ZIP,
+            description = "Whether failure summary report is included in the zip fie.")
+    private boolean mIncludeHtml = false;
+
     private CompatibilityBuildHelper mBuildHelper;
     private File mResultDir = null;
     private File mLogDir = null;
@@ -521,10 +526,17 @@
                 copyRetryFiles(ResultHandler.getResultDirectory(
                         mBuildHelper.getResultsDir(), mRetrySessionId), mResultDir);
             }
+            File failureReport = null;
+            if (mIncludeHtml) {
+                // Create the html report before the zip file.
+                failureReport = ResultHandler.createFailureReport(resultFile);
+            }
             File zippedResults = zipResults(mResultDir);
-            // Create failure report after zip file so extra data is not uploaded
-            File failureReport = ResultHandler.createFailureReport(resultFile);
-            if (failureReport.exists()) {
+            if (!mIncludeHtml) {
+                // Create failure report after zip file so extra data is not uploaded
+                failureReport = ResultHandler.createFailureReport(resultFile);
+            }
+            if (failureReport != null && failureReport.exists()) {
                 info("Test Result: %s", failureReport.getCanonicalPath());
             } else {
                 info("Test Result: %s", resultFile.getCanonicalPath());