am 6737bf09: am 21cc4803: am bb447725: Extending cts test creation timeout and fix compile error.

* commit '6737bf09bddb4404a9294a1c11621ff17cd7104a':
  Extending cts test creation timeout and fix compile error.
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 6bcab73..1c90d83 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
@@ -25,6 +25,7 @@
 import com.android.tradefed.build.IFolderBuildInfo;
 import com.android.tradefed.config.Option;
 import com.android.tradefed.result.CollectingTestListener;
+import com.android.tradefed.result.InputStreamSource;
 import com.android.tradefed.result.LogDataType;
 import com.android.tradefed.result.TestResult;
 import com.android.tradefed.result.TestRunResult;
@@ -116,7 +117,7 @@
      * {@inheritDoc}
      */
     @Override
-    public void testLog(String dataName, LogDataType dataType, InputStream dataStream) {
+    public void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream) {
         // save as zip file in report dir
         // TODO: ensure uniqueness of file name
         // TODO: use dataType.getFileExt() when its made public
@@ -124,7 +125,7 @@
         // TODO: consider compressing large files
         File logFile = new File(mReportDir, fileName);
         try {
-            FileUtil.writeToFile(dataStream, logFile);
+            FileUtil.writeToFile(dataStream.createInputStream(), logFile);
         } catch (IOException e) {
             Log.e(LOG_TAG, String.format("Failed to write log %s", logFile.getAbsolutePath()));
         }
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
index 6ed55d3..2834793 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
@@ -32,6 +32,7 @@
 import com.android.tradefed.testtype.IRemoteTest;
 import com.android.tradefed.testtype.IResumableTest;
 import com.android.tradefed.testtype.IShardableTest;
+import com.android.tradefed.testtype.InstrumentationTest;
 import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
 
 import java.io.BufferedInputStream;
@@ -248,6 +249,12 @@
             if (test instanceof IDeviceTest) {
                 ((IDeviceTest)test).setDevice(getDevice());
             }
+            // Increment the timeout for collecting the tests.
+            // TODO: move this to testPackage.createTest() instead and only increase timeout when
+            // tests number is large.
+            if (test instanceof InstrumentationTest) {
+                ((InstrumentationTest)test).setCollectsTestsShellTimeout(10*60*1000);
+            }
             ResultFilter filter = new ResultFilter(listener, testPair.getKnownTests());
             test.run(filter);
             mRemainingTests.remove(0);