Fix CTS Media Utils, change MediaPreparer default max resolution

bug:33573055
bug:31443110
Test: cts-tradefed run cts -m CtsMediaStressTestCases
Change-Id: I5b9c4a54174355ddb8a081390d349ee3a72f63e4
diff --git a/libs/deviceutil/src/android/cts/util/MediaUtils.java b/libs/deviceutil/src/android/cts/util/MediaUtils.java
index 2c6aeae..56868a5 100644
--- a/libs/deviceutil/src/android/cts/util/MediaUtils.java
+++ b/libs/deviceutil/src/android/cts/util/MediaUtils.java
@@ -154,12 +154,11 @@
     public static void skipTest(String tag, String reason) {
         Log.i(tag, "SKIPPING " + getTestName() + "(): " + reason);
         DeviceReportLog log = new DeviceReportLog("CtsMediaSkippedTests", "test_skipped");
-        log.addValue("reason", reason, ResultType.NEUTRAL, ResultUnit.NONE);
-        log.addValue(
-                "test", getTestNameWithClass(), ResultType.NEUTRAL, ResultUnit.NONE);
-        // TODO: replace with submit() when it is added to DeviceReportLog
         try {
-            log.submit(null);
+            log.addValue("reason", reason, ResultType.NEUTRAL, ResultUnit.NONE);
+            log.addValue(
+                    "test", getTestNameWithClass(), ResultType.NEUTRAL, ResultUnit.NONE);
+            log.submit();
         } catch (NullPointerException e) { }
     }
 
diff --git a/tests/tests/mediastress/preconditions/src/android/mediastress/cts/preconditions/MediaPreparer.java b/tests/tests/mediastress/preconditions/src/android/mediastress/cts/preconditions/MediaPreparer.java
index 29aa4ab..2863410 100644
--- a/tests/tests/mediastress/preconditions/src/android/mediastress/cts/preconditions/MediaPreparer.java
+++ b/tests/tests/mediastress/preconditions/src/android/mediastress/cts/preconditions/MediaPreparer.java
@@ -102,7 +102,13 @@
     /* Key to retrieve resolution string in metrics upon MediaPreparerListener.testEnded() */
     private static final String RESOLUTION_STRING_KEY = "resolution";
 
-    protected static final Resolution DEFAULT_MAX_RESOLUTION = new Resolution(1920, 1080);
+    /*
+     * In the case of MediaPreparer error, the default maximum resolution to push to the device.
+     * Pushing higher resolutions may lead to insufficient storage for installing test APKs.
+     * TODO(aaronholden): When the new detection of max resolution is proven stable, throw
+     * a TargetSetupError when detection results in error
+     */
+    protected static final Resolution DEFAULT_MAX_RESOLUTION = new Resolution(480, 360);
 
     protected static final Resolution[] RESOLUTIONS = {
             new Resolution(176, 144),
diff --git a/tests/tests/mediastress/preconditions/tests/src/android/mediastress/cts/preconditions/MediaPreparerTest.java b/tests/tests/mediastress/preconditions/tests/src/android/mediastress/cts/preconditions/MediaPreparerTest.java
index fd736d5..04c3900 100644
--- a/tests/tests/mediastress/preconditions/tests/src/android/mediastress/cts/preconditions/MediaPreparerTest.java
+++ b/tests/tests/mediastress/preconditions/tests/src/android/mediastress/cts/preconditions/MediaPreparerTest.java
@@ -77,8 +77,8 @@
                     resolution.toString());
             String fullFile = String.format("%s%s", mMediaPreparer.mBaseDeviceFullDir,
                     resolution.toString());
-            EasyMock.expect(mMockDevice.doesFileExist(shortFile)).andReturn(true).once();
-            EasyMock.expect(mMockDevice.doesFileExist(fullFile)).andReturn(true).once();
+            EasyMock.expect(mMockDevice.doesFileExist(shortFile)).andReturn(true).anyTimes();
+            EasyMock.expect(mMockDevice.doesFileExist(fullFile)).andReturn(true).anyTimes();
         }
         EasyMock.replay(mMockDevice);
         assertTrue(mMediaPreparer.mediaFilesExistOnDevice(mMockDevice));