Merge "Use test app in separate package from assistant." into mnc-dev
diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py
index dec37db..756f959 100644
--- a/apps/CameraITS/pymodules/its/device.py
+++ b/apps/CameraITS/pymodules/its/device.py
@@ -58,6 +58,7 @@
 
     # Seconds timeout on each socket operation.
     SOCK_TIMEOUT = 10.0
+    SEC_TO_NSEC = 1000*1000*1000.0
 
     PACKAGE = 'com.android.cts.verifier.camera.its'
     INTENT_START = 'com.android.cts.verifier.camera.its.START'
@@ -580,6 +581,18 @@
                 "dng" in formats and "raw10" in formats or \
                 "raw" in formats and "raw10" in formats:
             raise its.error.Error('Different raw formats not supported')
+
+        # Detect long exposure time and set timeout accordingly
+        longest_exp_time = 0
+        for req in cmd["captureRequests"]:
+            if "android.sensor.exposureTime" in req and \
+                    req["android.sensor.exposureTime"] > longest_exp_time:
+                longest_exp_time = req["android.sensor.exposureTime"]
+
+        extended_timeout = longest_exp_time / self.SEC_TO_NSEC + \
+                self.SOCK_TIMEOUT
+        self.sock.settimeout(extended_timeout)
+
         print "Capturing %d frame%s with %d format%s [%s]" % (
                   ncap, "s" if ncap>1 else "", nsurf, "s" if nsurf>1 else "",
                   ",".join(formats))
@@ -621,6 +634,7 @@
                 obj["metadata"] = mds[i]
                 objs.append(obj)
             rets.append(objs if ncap>1 else objs[0])
+        self.sock.settimeout(self.SOCK_TIMEOUT)
         return rets if len(rets)>1 else rets[0]
 
 def get_device_id():
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
index 15e80b7..a76bb7f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
@@ -1156,25 +1156,34 @@
             }
 
             // Initiate the captures.
+            long maxExpTimeNs = -1;
             for (int i = 0; i < requests.size(); i++) {
+                CaptureRequest.Builder req = requests.get(i);
                 // For DNG captures, need the LSC map to be available.
                 if (mCaptureRawIsDng) {
-                    requests.get(i).set(CaptureRequest.STATISTICS_LENS_SHADING_MAP_MODE, 1);
+                    req.set(CaptureRequest.STATISTICS_LENS_SHADING_MAP_MODE, 1);
+                }
+                Long expTimeNs = req.get(CaptureRequest.SENSOR_EXPOSURE_TIME);
+                if (expTimeNs != null && expTimeNs > maxExpTimeNs) {
+                    maxExpTimeNs = expTimeNs;
                 }
 
-                CaptureRequest.Builder req = requests.get(i);
                 for (int j = 0; j < numSurfaces; j++) {
                     req.addTarget(mOutputImageReaders[j].getSurface());
                 }
                 mSession.capture(req.build(), mCaptureResultListener, mResultHandler);
             }
 
+            long timeout = TIMEOUT_CALLBACK * 1000;
+            if (maxExpTimeNs > 0) {
+                timeout += maxExpTimeNs / 1000000; // ns to ms
+            }
             // Make sure all callbacks have been hit (wait until captures are done).
             // If no timeouts are received after a timeout, then fail.
             int currentCount = mCountCallbacksRemaining.get();
             while (currentCount > 0) {
                 try {
-                    Thread.sleep(TIMEOUT_CALLBACK*1000);
+                    Thread.sleep(timeout);
                 } catch (InterruptedException e) {
                     throw new ItsException("Timeout failure", e);
                 }
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
index f01db4f..7fe0b80 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
@@ -26,12 +26,14 @@
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -166,6 +168,21 @@
         return paths;
     }
 
+    public static List<File> getMountPaths() throws IOException {
+        final List<File> paths = new ArrayList<>();
+        final BufferedReader br = new BufferedReader(new FileReader("/proc/self/mounts"));
+        try {
+            String line;
+            while ((line = br.readLine()) != null) {
+                final String[] fields = line.split(" ");
+                paths.add(new File(fields[1]));
+            }
+        } finally {
+            br.close();
+        }
+        return paths;
+    }
+
     private static File[] dropFirst(File[] before) {
         final File[] after = new File[before.length - 1];
         System.arraycopy(before, 1, after, 0, after.length);
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/ExternalStorageTest.java b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/ExternalStorageTest.java
index 7dc462a..6030f1c 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/ExternalStorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/ExternalStorageTest.java
@@ -17,8 +17,10 @@
 package com.android.cts.externalstorageapp;
 
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertDirNoAccess;
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertDirNoWriteAccess;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertDirReadWriteAccess;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getAllPackageSpecificPaths;
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getMountPaths;
 
 import android.app.DownloadManager;
 import android.app.DownloadManager.Query;
@@ -34,7 +36,9 @@
 import android.test.AndroidTestCase;
 import android.text.format.DateUtils;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
@@ -76,6 +80,25 @@
     }
 
     /**
+     * Verify that we don't have read access to any storage mountpoints.
+     */
+    public void testMountPointsNotReadable() throws Exception {
+        final String userId = Integer.toString(android.os.Process.myUid() / 100000);
+        final List<File> mountPaths = getMountPaths();
+        for (File path : mountPaths) {
+            if (path.getAbsolutePath().startsWith("/mnt/")
+                    || path.getAbsolutePath().startsWith("/storage/")) {
+                // Mount points could be multi-user aware, so try probing both
+                // top level and user-specific directory.
+                final File userPath = new File(path, userId);
+
+                assertDirNoAccess(path);
+                assertDirNoAccess(userPath);
+            }
+        }
+    }
+
+    /**
      * Verify that we can't download things outside package directory.
      */
     public void testDownloadManager() throws Exception {
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/src/com/android/cts/readexternalstorageapp/ReadExternalStorageTest.java b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/src/com/android/cts/readexternalstorageapp/ReadExternalStorageTest.java
index 71faab2..995da90 100644
--- a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/src/com/android/cts/readexternalstorageapp/ReadExternalStorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/src/com/android/cts/readexternalstorageapp/ReadExternalStorageTest.java
@@ -16,9 +16,11 @@
 
 package com.android.cts.readexternalstorageapp;
 
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertDirNoWriteAccess;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertDirReadOnlyAccess;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertDirReadWriteAccess;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getAllPackageSpecificPaths;
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getMountPaths;
 
 import android.os.Environment;
 import android.test.AndroidTestCase;
@@ -64,4 +66,23 @@
             }
         }
     }
+
+    /**
+     * Verify that we don't have write access to any mountpoints.
+     */
+    public void testMountPointsNotWritable() throws Exception {
+        final String userId = Integer.toString(android.os.Process.myUid() / 100000);
+        final List<File> mountPaths = getMountPaths();
+        for (File path : mountPaths) {
+            if (path.getAbsolutePath().startsWith("/mnt/")
+                    || path.getAbsolutePath().startsWith("/storage/")) {
+                // Mount points could be multi-user aware, so try probing both
+                // top level and user-specific directory.
+                final File userPath = new File(path, userId);
+
+                assertDirNoWriteAccess(path);
+                assertDirNoWriteAccess(userPath);
+            }
+        }
+    }
 }
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java
index badc852..5e6aa3e 100644
--- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java
@@ -24,6 +24,7 @@
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.buildProbeFile;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.deleteContents;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getAllPackageSpecificPaths;
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getMountPaths;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getPrimaryPackageSpecificPaths;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.getSecondaryPackageSpecificPaths;
 import static com.android.cts.externalstorageapp.CommonExternalStorageTest.readInt;
@@ -35,9 +36,7 @@
 
 import com.android.cts.externalstorageapp.CommonExternalStorageTest;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.util.List;
 import java.util.Random;
 
@@ -273,28 +272,29 @@
      * {@link CommonExternalStorageTest#testAllPackageDirsWritable()}.
      */
     public void testSecondaryMountPointsNotWritable() throws Exception {
+        // Probe path could be /storage/emulated/0 or /storage/1234-5678
         final File probe = buildProbeFile(Environment.getExternalStorageDirectory());
         assertTrue(probe.createNewFile());
 
-        final BufferedReader br = new BufferedReader(new FileReader("/proc/self/mounts"));
-        try {
-            String line;
-            while ((line = br.readLine()) != null) {
-                final String[] fields = line.split(" ");
-                final File testMount = new File(fields[1]);
-                final File testProbe = new File(testMount, probe.getName());
-                if (testProbe.exists()) {
-                    Log.d(TAG, "Primary external mountpoint " + testMount);
-                } else {
-                    // This mountpoint is not primary external storage; we must
-                    // not be able to write.
-                    Log.d(TAG, "Other mountpoint " + testMount);
-                    assertDirNoWriteAccess(testProbe.getParentFile());
-                }
+        final String userId = Integer.toString(android.os.Process.myUid() / 100000);
+        final List<File> mountPaths = getMountPaths();
+        for (File path : mountPaths) {
+            // Mount points could be multi-user aware, so try probing both top
+            // level and user-specific directory.
+            final File userPath = new File(path, userId);
+
+            final File testProbe = new File(path, probe.getName());
+            final File testUserProbe = new File(userPath, probe.getName());
+
+            if (testProbe.exists() || testUserProbe.exists()) {
+                Log.d(TAG, "Primary external mountpoint " + path);
+            } else {
+                // This mountpoint is not primary external storage; we must
+                // not be able to write.
+                Log.d(TAG, "Other mountpoint " + path);
+                assertDirNoWriteAccess(path);
+                assertDirNoWriteAccess(userPath);
             }
-       } finally {
-           br.close();
-           probe.delete();
-       }
+        }
     }
 }
diff --git a/hostsidetests/dumpsys/src/android/dumpsys/cts/DumpsysHostTest.java b/hostsidetests/dumpsys/src/android/dumpsys/cts/DumpsysHostTest.java
index 4ce06af..0589792 100644
--- a/hostsidetests/dumpsys/src/android/dumpsys/cts/DumpsysHostTest.java
+++ b/hostsidetests/dumpsys/src/android/dumpsys/cts/DumpsysHostTest.java
@@ -576,10 +576,10 @@
     }
 
     private void checkKernelWakelock(String[] parts) {
-        assertEquals(7, parts.length);
-        assertNotNull(parts[4]); // kernel wakelock
-        assertInteger(parts[5]); // totalTime
-        assertInteger(parts[6]); // count
+        assertTrue(parts.length >= 7);
+	assertNotNull(parts[4]); // Kernel wakelock
+	assertInteger(parts[parts.length-2]); // totalTime
+        assertInteger(parts[parts.length-1]); // count
     }
 
     private void checkWakeupReason(String[] parts) {
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/CaptureRequestTest.java b/tests/tests/hardware/src/android/hardware/camera2/cts/CaptureRequestTest.java
index 4b96636..235c1f8 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/CaptureRequestTest.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/CaptureRequestTest.java
@@ -1205,7 +1205,9 @@
                 changeExposure(requestBuilder, expTimes[i], sensitivities[j]);
                 mSession.capture(requestBuilder.build(), listener, mHandler);
 
-                CaptureResult result = listener.getCaptureResult(WAIT_FOR_RESULT_TIMEOUT_MS);
+                // make sure timeout is long enough for long exposure time
+                long timeout = WAIT_FOR_RESULT_TIMEOUT_MS + expTimes[i];
+                CaptureResult result = listener.getCaptureResult(timeout);
                 long resultExpTime = getValueNotNull(result, CaptureResult.SENSOR_EXPOSURE_TIME);
                 int resultSensitivity = getValueNotNull(result, CaptureResult.SENSOR_SENSITIVITY);
                 validateExposureTime(expTimes[i], resultExpTime);
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraGLTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraGLTest.java
index d8f8a1d..380e47d 100755
--- a/tests/tests/hardware/src/android/hardware/cts/CameraGLTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraGLTest.java
@@ -497,7 +497,7 @@
      * TODO: This should be made stricter once SurfaceTexture timestamps are generated by the drivers.
      */
     @UiThreadTest
-    @TimeoutReq(minutes = 20)
+    @TimeoutReq(minutes = 30)
     public void testCameraToSurfaceTextureMetadata() throws Exception {
         runForAllCameras(testCameraToSurfaceTextureMetadataByCamera);
     }
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 33706dd..6869ed1 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -45,6 +45,7 @@
 import android.util.Log;
 import android.view.SurfaceHolder;
 
+import com.android.cts.util.TimeoutReq;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -1770,6 +1771,7 @@
     }
 
     @UiThreadTest
+    @TimeoutReq(minutes = 30)
     public void testPreviewPictureSizesCombination() throws Exception {
         int nCameras = Camera.getNumberOfCameras();
         for (int id = 0; id < nCameras; id++) {
diff --git a/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java b/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
index 18796d4..68efef0 100755
--- a/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
@@ -97,15 +97,15 @@
             } else {
                 assertMinMemoryMb(424);
             }
-        } else if (greaterThanDpi(density, DENSITY_XHIGH, screenSize,
+        } else if (greaterThanDpi(density, DENSITY_560, screenSize,
                 SCREENLAYOUT_SIZE_NORMAL, SCREENLAYOUT_SIZE_SMALL) ||
-                greaterThanDpi(density, DENSITY_TV, screenSize, SCREENLAYOUT_SIZE_LARGE) ||
-                greaterThanDpi(density, DENSITY_MEDIUM, screenSize, SCREENLAYOUT_SIZE_XLARGE)) {
+                greaterThanDpi(density, DENSITY_400, screenSize, SCREENLAYOUT_SIZE_LARGE) ||
+                greaterThanDpi(density, DENSITY_XHIGH, screenSize, SCREENLAYOUT_SIZE_XLARGE)) {
 
             if (supports64Bit) {
-                assertMinMemoryMb(832);
+                assertMinMemoryMb(1824);
             } else {
-                assertMinMemoryMb(512);
+                assertMinMemoryMb(1344);
             }
         } else if (greaterThanDpi(density, DENSITY_400, screenSize,
                 SCREENLAYOUT_SIZE_NORMAL, SCREENLAYOUT_SIZE_SMALL) ||
@@ -117,15 +117,15 @@
             } else {
                 assertMinMemoryMb(896);
             }
-        } else if (greaterThanDpi(density, DENSITY_560, screenSize,
+        } else if (greaterThanDpi(density, DENSITY_XHIGH, screenSize,
                 SCREENLAYOUT_SIZE_NORMAL, SCREENLAYOUT_SIZE_SMALL) ||
-                greaterThanDpi(density, DENSITY_400, screenSize, SCREENLAYOUT_SIZE_LARGE) ||
-                greaterThanDpi(density, DENSITY_XHIGH, screenSize, SCREENLAYOUT_SIZE_XLARGE)) {
+                greaterThanDpi(density, DENSITY_TV, screenSize, SCREENLAYOUT_SIZE_LARGE) ||
+                greaterThanDpi(density, DENSITY_MEDIUM, screenSize, SCREENLAYOUT_SIZE_XLARGE)) {
 
             if (supports64Bit) {
-                assertMinMemoryMb(1824);
+                assertMinMemoryMb(832);
             } else {
-                assertMinMemoryMb(1344);
+                assertMinMemoryMb(512);
             }
         }
     }
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerification.java b/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerification.java
index 9e278bc..5a176d5 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerification.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerification.java
@@ -49,10 +49,8 @@
     @SuppressWarnings("deprecation")
     public static EventOrderingVerification getDefault(TestSensorEnvironment environment) {
         int reportingMode = environment.getSensor().getReportingMode();
-        if (reportingMode != Sensor.REPORTING_MODE_CONTINUOUS
-                && reportingMode != Sensor.REPORTING_MODE_ON_CHANGE) {
+        if (reportingMode == Sensor.REPORTING_MODE_ONE_SHOT)
             return null;
-        }
         return new EventOrderingVerification();
     }
 
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
index 2320990..a999135 100644
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
@@ -657,7 +657,6 @@
             } catch (InterruptedException e) {
                 // don't care
             }
-            cleanupGl();
             mCompositionThread = null;
             mSurface = null;
             mStartCompletionSemaphore = null;
@@ -970,7 +969,6 @@
 
             public void cleanup() {
                 mNumTextureUpdated.set(0);
-                mVerticesData.clear();
                 if (mTextureId != 0) {
                     int[] textures = new int[] {
                             mTextureId
diff --git a/tests/tests/media/src/android/media/cts/EnumDevicesTest.java b/tests/tests/media/src/android/media/cts/EnumDevicesTest.java
index f513709..94af087 100644
--- a/tests/tests/media/src/android/media/cts/EnumDevicesTest.java
+++ b/tests/tests/media/src/android/media/cts/EnumDevicesTest.java
@@ -115,29 +115,31 @@
             // Sample Rates
             int[] sampleRates = deviceInfo.getSampleRates();
             assertNotNull(sampleRates);
-            // "analog" devices won't list any sample rates
+            // Note: an empty array indicates that the device supports arbitrary sample rates.
 
             // Channel Masks
             int[] channelMasks = deviceInfo.getChannelMasks();
             assertNotNull(channelMasks);
-            // "analog" devices won't list any channel masks
+            // Note: an empty array indicates that the device supports arbitrary channel masks.
 
             // Channel Index Masks
             int[] indexMasks = deviceInfo.getChannelIndexMasks();
-            assertNotNull(channelMasks);
+            assertNotNull(indexMasks);
+            // Note: an empty array indicates that the device supports arbitrary channel index
+            // masks.
 
             // Channel Counts
             int[] channelCounts = deviceInfo.getChannelCounts();
             assertNotNull(channelCounts);
-            // "analog" devices won't list any channel Counts
+            // Note: an empty array indicates that the device supports arbitrary channel counts.
 
             // Encodings
             int[] encodings = deviceInfo.getEncodings();
             assertNotNull(encodings);
-            // "analog" devices won't list any encodings
+            // Note: an empty array indicates that the device supports arbitrary encodings.
 
             int type = deviceInfo.getType();
-            assert(type > AudioDeviceInfo.TYPE_UNKNOWN);
+            assertTrue(type != AudioDeviceInfo.TYPE_UNKNOWN);
         }
     }
 
@@ -167,7 +169,7 @@
         }
         return myLooper;
     }
-    
+
     public void test_deviceCallback() {
         // null callback?
         mAudioManager.registerAudioDeviceCallback(null,null);
@@ -187,7 +189,7 @@
         mAudioManager.unregisterAudioDeviceCallback(callback);
 
         Looper myLooper = prepareIfNeededLooper();
-        
+
         mAudioManager.registerAudioDeviceCallback(callback, new Handler());
         // unregister null callback
         mAudioManager.unregisterAudioDeviceCallback(null);
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java b/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
index b3fcce1..813af0f2 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
@@ -19,6 +19,7 @@
 import android.cts.util.MediaUtils;
 import android.media.MediaCodec;
 import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.AudioCapabilities;
 import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaCodecInfo.CodecProfileLevel;
 import android.media.MediaCodecInfo.VideoCapabilities;
@@ -530,24 +531,35 @@
         }
     }
 
-    private static MediaFormat createMinFormat(String mime, VideoCapabilities vcaps, int color) {
-        int minWidth = vcaps.getSupportedWidths().getLower();
-        int minHeight = vcaps.getSupportedHeightsFor(minWidth).getLower();
-        int minBitrate = vcaps.getBitrateRange().getLower();
+    private static MediaFormat createMinFormat(String mime, CodecCapabilities caps) {
+        MediaFormat format;
+        if (caps.getVideoCapabilities() != null) {
+            VideoCapabilities vcaps = caps.getVideoCapabilities();
+            int minWidth = vcaps.getSupportedWidths().getLower();
+            int minHeight = vcaps.getSupportedHeightsFor(minWidth).getLower();
+            int minBitrate = vcaps.getBitrateRange().getLower();
+            format = MediaFormat.createVideoFormat(mime, minWidth, minHeight);
+            format.setInteger(MediaFormat.KEY_COLOR_FORMAT, caps.colorFormats[0]);
+            format.setInteger(MediaFormat.KEY_BIT_RATE, minBitrate);
+            format.setInteger(MediaFormat.KEY_FRAME_RATE, 10);
+            format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 10);
+        } else {
+            AudioCapabilities acaps = caps.getAudioCapabilities();
+            int minSampleRate = acaps.getSupportedSampleRateRanges()[0].getLower();
+            int minChannelCount = 1;
+            int minBitrate = acaps.getBitrateRange().getLower();
+            format = MediaFormat.createAudioFormat(mime, minSampleRate, minChannelCount);
+            format.setInteger(MediaFormat.KEY_BIT_RATE, minBitrate);
+        }
 
-        MediaFormat format = MediaFormat.createVideoFormat(mime, minWidth, minHeight);
-        format.setInteger(MediaFormat.KEY_COLOR_FORMAT, color);
-        format.setInteger(MediaFormat.KEY_BIT_RATE, minBitrate);
-        format.setInteger(MediaFormat.KEY_FRAME_RATE, 10);
-        format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 10);
         return format;
     }
 
     private static int getActualMax(
             boolean isEncoder, String name, String mime, CodecCapabilities caps, int max) {
         int flag = isEncoder ? MediaCodec.CONFIGURE_FLAG_ENCODE : 0;
-        MediaFormat format =
-                createMinFormat(mime, caps.getVideoCapabilities(), caps.colorFormats[0]);
+        MediaFormat format = createMinFormat(mime, caps);
+        Log.d(TAG, "Test format " + format);
         Vector<MediaCodec> codecs = new Vector<MediaCodec>();
         MediaCodec codec = null;
         for (int i = 0; i < max; ++i) {
@@ -588,14 +600,6 @@
         return actualMax;
     }
 
-    private static boolean shouldTestActual(CodecCapabilities caps) {
-        if (caps.getVideoCapabilities() == null) {
-            // TODO: test audio codecs.
-            return false;
-        }
-        return true;
-    }
-
     public void testGetMaxSupportedInstances() {
         final int MAX_INSTANCES = 32;
         StringBuilder xmlOverrides = new StringBuilder();
@@ -612,21 +616,19 @@
                 Log.d(TAG, "getMaxSupportedInstances returns " + max);
                 assertTrue(max > 0);
 
-                if (shouldTestActual(caps)) {
-                    int actualMax = getActualMax(
-                            info.isEncoder(), info.getName(), types[j], caps, MAX_INSTANCES);
-                    Log.d(TAG, "actualMax " + actualMax + " vs reported max " + max);
-                    if (actualMax < (int)(max * 0.9) || actualMax > (int) Math.ceil(max * 1.1)) {
-                        String codec = "<MediaCodec name=\"" + info.getName() +
-                                "\" type=\"" + types[j] + "\" >";
-                        String limit = "    <Limit name=\"concurrent-instances\" max=\"" +
-                                actualMax + "\" />";
-                        xmlOverrides.append(codec);
-                        xmlOverrides.append("\n");
-                        xmlOverrides.append(limit);
-                        xmlOverrides.append("\n");
-                        xmlOverrides.append("</MediaCodec>\n");
-                    }
+                int actualMax = getActualMax(
+                        info.isEncoder(), info.getName(), types[j], caps, MAX_INSTANCES);
+                Log.d(TAG, "actualMax " + actualMax + " vs reported max " + max);
+                if (actualMax < (int)(max * 0.9) || actualMax > (int) Math.ceil(max * 1.1)) {
+                    String codec = "<MediaCodec name=\"" + info.getName() +
+                            "\" type=\"" + types[j] + "\" >";
+                    String limit = "    <Limit name=\"concurrent-instances\" max=\"" +
+                            actualMax + "\" />";
+                    xmlOverrides.append(codec);
+                    xmlOverrides.append("\n");
+                    xmlOverrides.append(limit);
+                    xmlOverrides.append("\n");
+                    xmlOverrides.append("</MediaCodec>\n");
                 }
             }
         }
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
index 1895dcc..e4d77b1 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -33,6 +33,7 @@
 import android.net.wifi.WifiManager;
 import android.test.AndroidTestCase;
 import android.util.Log;
+import android.os.SystemProperties;
 
 import com.android.internal.telephony.PhoneConstants;
 
@@ -78,10 +79,14 @@
         // Get com.android.internal.R.array.networkAttributes
         int resId = getContext().getResources().getIdentifier("networkAttributes", "array", "android");
         String[] naStrings = getContext().getResources().getStringArray(resId);
-
+        //TODO: What is the "correct" way to determine if this is a wifi only device?
+        boolean wifiOnly = SystemProperties.getBoolean("ro.radio.noril", false);
         for (String naString : naStrings) {
             try {
                 NetworkConfig n = new NetworkConfig(naString);
+                if (wifiOnly && ConnectivityManager.isNetworkTypeMobile(n.type)) {
+                    continue;
+                }
                 mNetworks.put(n.type, n);
             } catch (Exception e) {}
         }
diff --git a/tests/tests/security/jni/android_security_cts_AudioPolicyBinderTest.cpp b/tests/tests/security/jni/android_security_cts_AudioPolicyBinderTest.cpp
index d9c7ce7..6807523 100644
--- a/tests/tests/security/jni/android_security_cts_AudioPolicyBinderTest.cpp
+++ b/tests/tests/security/jni/android_security_cts_AudioPolicyBinderTest.cpp
@@ -151,11 +151,12 @@
         return false;
     }
 
-    if (aps->isStreamActive((audio_stream_type_t)(AUDIO_STREAM_MIN -1), 0)) {
+    status_t status = aps->isStreamActive((audio_stream_type_t)(-1), 0);
+    if (status == NO_ERROR) {
         return false;
     }
-
-    if (aps->isStreamActive((audio_stream_type_t)AUDIO_STREAM_CNT, 0)) {
+    status = aps->isStreamActive((audio_stream_type_t)AUDIO_STREAM_CNT, 0);
+    if (status == NO_ERROR) {
         return false;
     }
     return true;
diff --git a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
index 74fc143..b56db06 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
@@ -354,7 +354,7 @@
         assertCallState(call, Call.STATE_ACTIVE);
 
         final String postDialString = "12345";
-        connection.setPostDialWait(postDialString);
+        ((Connection) connection).setPostDialWait(postDialString);
         mOnPostDialWaitCounter.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
 
         assertEquals(postDialString, mOnPostDialWaitCounter.getArgs(0)[1]);
diff --git a/tests/tests/telecom/src/android/telecom/cts/RemoteConnectionTest.java b/tests/tests/telecom/src/android/telecom/cts/RemoteConnectionTest.java
index 26cf877..b4237ab 100644
--- a/tests/tests/telecom/src/android/telecom/cts/RemoteConnectionTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/RemoteConnectionTest.java
@@ -18,6 +18,7 @@
 
 import static android.telecom.cts.TestUtils.*;
 
+import android.graphics.SurfaceTexture;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -33,6 +34,7 @@
 import android.telecom.StatusHints;
 import android.telecom.TelecomManager;
 import android.telecom.VideoProfile;
+import android.view.Surface;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -287,7 +289,7 @@
         };
         mRemoteConnectionObject.registerCallback(callback, handler);
         char postDialChar = '3';
-        mRemoteConnection.setNextPostDialChar(postDialChar);
+        ((Connection) mRemoteConnection).setNextPostDialChar(postDialChar);
         callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
         assertEquals(mRemoteConnectionObject, callbackInvoker.getArgs(0)[0]);
         assertEquals(postDialChar, callbackInvoker.getArgs(0)[1]);
@@ -772,6 +774,320 @@
         remoteVideoProvider.unregisterCallback(videoCallback);
     }
 
+    public void testRemoteConnectionVideo_RequestCallDataUsage() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final long callDataUsage = 10000;
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_RequestCallDataUsage");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onRequestConnectionDataUsage() {
+                callbackInvoker.invoke();
+                super.setCallDataUsage(callDataUsage);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+        RemoteConnection.VideoProvider.Callback videoCallback;
+
+        videoCallback = new RemoteConnection.VideoProvider.Callback() {
+            @Override
+            public void onCallDataUsageChanged(VideoProvider videoProvider, long dataUsage) {
+                super.onCallDataUsageChanged(videoProvider, dataUsage);
+                callbackInvoker.invoke(videoProvider, dataUsage);
+            }
+        };
+        remoteVideoProvider.registerCallback(videoCallback);
+        remoteVideoProvider.requestCallDataUsage();
+        callbackInvoker.waitForCount(2, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(remoteVideoProvider, callbackInvoker.getArgs(1)[0]);
+        assertEquals(callDataUsage, callbackInvoker.getArgs(1)[1]);
+        remoteVideoProvider.unregisterCallback(videoCallback);
+    }
+
+    public void testRemoteConnectionVideo_RequestCameraCapabilities() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final VideoProfile.CameraCapabilities capabilities =
+                new VideoProfile.CameraCapabilities(100, 200);
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_RequestCameraCapabilities");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onRequestCameraCapabilities() {
+                callbackInvoker.invoke();
+                super.changeCameraCapabilities(capabilities);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+        RemoteConnection.VideoProvider.Callback videoCallback;
+
+        videoCallback = new RemoteConnection.VideoProvider.Callback() {
+            @Override
+            public void onCameraCapabilitiesChanged(
+                    VideoProvider videoProvider,
+                    VideoProfile.CameraCapabilities cameraCapabilities) {
+                super.onCameraCapabilitiesChanged(videoProvider, cameraCapabilities);
+                callbackInvoker.invoke(videoProvider, cameraCapabilities);
+            }
+        };
+        remoteVideoProvider.registerCallback(videoCallback);
+        remoteVideoProvider.requestCameraCapabilities();
+        callbackInvoker.waitForCount(2, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(remoteVideoProvider, callbackInvoker.getArgs(1)[0]);
+        assertEquals(capabilities, callbackInvoker.getArgs(1)[1]);
+        remoteVideoProvider.unregisterCallback(videoCallback);
+    }
+
+    public void testRemoteConnectionVideo_SendSessionModifyRequest() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        VideoProfile fromVideoProfile = new VideoProfile(VideoProfile.STATE_AUDIO_ONLY);
+        VideoProfile toVideoProfile =  new VideoProfile(VideoProfile.STATE_BIDIRECTIONAL);
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SendSessionModifyRequest");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSendSessionModifyRequest(VideoProfile fromProfile,
+                                                   VideoProfile toProfile) {
+                callbackInvoker.invoke(fromProfile, toProfile);
+                super.receiveSessionModifyRequest(toProfile);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+        RemoteConnection.VideoProvider.Callback videoCallback;
+
+        videoCallback = new RemoteConnection.VideoProvider.Callback() {
+            @Override
+            public void onSessionModifyRequestReceived(
+                    VideoProvider videoProvider,
+                    VideoProfile videoProfile) {
+                super.onSessionModifyRequestReceived(videoProvider, videoProfile);
+                callbackInvoker.invoke(videoProvider, videoProfile);
+            }
+        };
+        remoteVideoProvider.registerCallback(videoCallback);
+        remoteVideoProvider.sendSessionModifyRequest(fromVideoProfile, toVideoProfile);
+        callbackInvoker.waitForCount(2, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(fromVideoProfile, callbackInvoker.getArgs(0)[0]);
+        assertEquals(toVideoProfile, callbackInvoker.getArgs(0)[1]);
+        assertEquals(remoteVideoProvider, callbackInvoker.getArgs(1)[0]);
+        assertEquals(toVideoProfile, callbackInvoker.getArgs(1)[1]);
+        remoteVideoProvider.unregisterCallback(videoCallback);
+    }
+
+    public void testRemoteConnectionVideo_SendSessionModifyResponse() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        VideoProfile toVideoProfile =  new VideoProfile(VideoProfile.STATE_BIDIRECTIONAL);
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SendSessionModifyResponse");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSendSessionModifyResponse(VideoProfile responseProfile) {
+                callbackInvoker.invoke(responseProfile);
+                super.receiveSessionModifyResponse(
+                        Connection.VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS,
+                        responseProfile, responseProfile);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+        RemoteConnection.VideoProvider.Callback videoCallback;
+
+        videoCallback = new RemoteConnection.VideoProvider.Callback() {
+            @Override
+            public void onSessionModifyResponseReceived(
+                    VideoProvider videoProvider,
+                    int status,
+                    VideoProfile requestedProfile,
+                    VideoProfile responseProfile) {
+                super.onSessionModifyResponseReceived(videoProvider, status, requestedProfile,
+                        responseProfile);
+                callbackInvoker.invoke(videoProvider, status, requestedProfile, responseProfile);
+            }
+        };
+        remoteVideoProvider.registerCallback(videoCallback);
+        remoteVideoProvider.sendSessionModifyResponse(toVideoProfile);
+        callbackInvoker.waitForCount(2, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(toVideoProfile, callbackInvoker.getArgs(0)[0]);
+        assertEquals(remoteVideoProvider, callbackInvoker.getArgs(1)[0]);
+        assertEquals(toVideoProfile, callbackInvoker.getArgs(1)[2]);
+        assertEquals(Connection.VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS,
+            callbackInvoker.getArgs(1)[1]);
+        assertEquals(toVideoProfile, callbackInvoker.getArgs(1)[3]);
+        remoteVideoProvider.unregisterCallback(videoCallback);
+    }
+
+    public void testRemoteConnectionVideo_SetCamera() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final String newCameraId = "5";
+        final VideoProfile.CameraCapabilities capabilities =
+            new VideoProfile.CameraCapabilities(100, 200);
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SetCamera");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSetCamera(String cameraId) {
+                callbackInvoker.invoke(cameraId);
+                super.changeCameraCapabilities(capabilities);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+        RemoteConnection.VideoProvider.Callback videoCallback;
+
+        videoCallback = new RemoteConnection.VideoProvider.Callback() {
+            @Override
+            public void onCameraCapabilitiesChanged(
+                    VideoProvider videoProvider,
+                    VideoProfile.CameraCapabilities cameraCapabilities) {
+                super.onCameraCapabilitiesChanged(videoProvider, cameraCapabilities);
+                callbackInvoker.invoke(videoProvider, cameraCapabilities);
+            }
+        };
+        remoteVideoProvider.registerCallback(videoCallback);
+        remoteVideoProvider.setCamera(newCameraId);
+        callbackInvoker.waitForCount(2, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(newCameraId, callbackInvoker.getArgs(0)[0]);
+        assertEquals(remoteVideoProvider, callbackInvoker.getArgs(1)[0]);
+        assertEquals(capabilities, callbackInvoker.getArgs(1)[1]);
+        remoteVideoProvider.unregisterCallback(videoCallback);
+    }
+
+    public void testRemoteConnectionVideo_SetDeviceOrientation() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final int newRotation = 5;
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SetDeviceOrientation");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSetDeviceOrientation(int rotation) {
+                callbackInvoker.invoke(rotation);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+
+        remoteVideoProvider.setDeviceOrientation(newRotation);
+        callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(newRotation, callbackInvoker.getArgs(0)[0]);
+    }
+
+    public void testRemoteConnectionVideo_SetDisplaySurface() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final Surface newSurface = new Surface(new SurfaceTexture(1));
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SetDisplaySurface");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSetDisplaySurface(Surface surface) {
+                callbackInvoker.invoke(surface);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+
+        remoteVideoProvider.setDisplaySurface(newSurface);
+        callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(newSurface, callbackInvoker.getArgs(0)[0]);
+    }
+
+    public void testRemoteConnectionVideo_SetPauseImage() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final Uri newUri = Uri.parse("content://");
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SetPauseImage");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSetPauseImage(Uri uri) {
+                callbackInvoker.invoke(uri);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+
+        remoteVideoProvider.setPauseImage(newUri);
+        callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(newUri, callbackInvoker.getArgs(0)[0]);
+    }
+
+    public void testRemoteConnectionVideo_SetPreviewSurface() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final Surface newSurface = new Surface(new SurfaceTexture(1));
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SetPreviewSurface");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSetPreviewSurface(Surface surface) {
+                callbackInvoker.invoke(surface);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+
+        remoteVideoProvider.setPreviewSurface(newSurface);
+        callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(newSurface, callbackInvoker.getArgs(0)[0]);
+    }
+
+    public void testRemoteConnectionVideo_SetZoom() {
+        if (!shouldTestTelecom(mContext)) {
+            return;
+        }
+
+        final float newZoom = 1.0f;
+        final InvokeCounter callbackInvoker =
+                new InvokeCounter("testRemoteConnectionVideo_SetPreviewSurface");
+        final MockVideoProvider mockVideoProvider = new MockVideoProvider(mRemoteConnection) {
+            @Override
+            public void onSetZoom(float value) {
+                callbackInvoker.invoke(value);
+            }
+        };
+        setupRemoteConnectionVideoTest(mockVideoProvider);
+
+        final VideoProvider remoteVideoProvider = mRemoteConnectionObject.getVideoProvider();
+
+        remoteVideoProvider.setZoom(newZoom);
+        callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(newZoom, callbackInvoker.getArgs(0)[0]);
+    }
 
     private void verifyRemoteConnectionObject(RemoteConnection remoteConnection,
             Connection connection) {
@@ -876,9 +1192,6 @@
         addRemoteConnectionOutgoingCall();
         final Call call = mInCallCallbacks.getService().getLastCall();
         assertCallState(call, Call.STATE_DIALING);
-        assertNotNull(mConnection);
-        assertNotNull(mRemoteConnection);
-        assertNotNull(mRemoteConnectionObject);
         verifyRemoteConnectionObject(mRemoteConnectionObject, mRemoteConnection);
 
         // Create a looper thread for the callbacks.
@@ -899,8 +1212,36 @@
         mRemoteConnection.createMockVideoProvider();
         mRemoteConnection.setVideoProvider(mRemoteConnection.getMockVideoProvider());
         callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(mRemoteConnectionObject, callbackInvoker.getArgs(0)[0]);
         mRemoteConnectionObject.unregisterCallback(callback);
         return handler;
     }
 
+    private Handler setupRemoteConnectionVideoTest(MockVideoProvider mockVideoProvider) {
+        addRemoteConnectionOutgoingCall();
+        final Call call = mInCallCallbacks.getService().getLastCall();
+        assertCallState(call, Call.STATE_DIALING);
+        verifyRemoteConnectionObject(mRemoteConnectionObject, mRemoteConnection);
+
+        // Create a looper thread for the callbacks.
+        HandlerThread workerThread = new HandlerThread("CallbackThread");
+        workerThread.start();
+        Handler handler = new Handler(workerThread.getLooper());
+
+        final InvokeCounter callbackInvoker = new InvokeCounter("RemoteConnectionCallbacks");
+
+        RemoteConnection.Callback callback = new RemoteConnection.Callback() {
+            @Override
+            public void onVideoProviderChanged(
+                    RemoteConnection connection, VideoProvider videoProvider) {
+                callbackInvoker.invoke(connection, videoProvider);
+            }
+        };
+        mRemoteConnectionObject.registerCallback(callback, handler);
+        mRemoteConnection.setVideoProvider(mockVideoProvider);
+        callbackInvoker.waitForCount(1, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+        assertEquals(mRemoteConnectionObject, callbackInvoker.getArgs(0)[0]);
+        mRemoteConnectionObject.unregisterCallback(callback);
+        return handler;
+    }
 }
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index a52eabe..e6b656f 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -95,7 +95,7 @@
      * brackets are optional):
      * <p/>
      * Mozilla/5.0 (Linux;[ U;] Android <version>;[ <language>-<country>;]
-     * [<devicemodel>;] Build/<buildID>) AppleWebKit/<major>.<minor> (KHTML, like Gecko)
+     * [<devicemodel>;] Build/<buildID>[; wv]) AppleWebKit/<major>.<minor> (KHTML, like Gecko)
      * Version/<major>.<minor> Chrome/<major>.<minor>.<branch>.<build>[ Mobile]
      * Safari/<major>.<minor>
      */
@@ -107,7 +107,7 @@
         Log.i(LOG_TAG, String.format("Checking user agent string %s", actualUserAgentString));
         final String patternString =
                 "Mozilla/5\\.0 \\(Linux;( U;)? Android ([^;]+);( (\\w+)-(\\w+);)?" +
-                "\\s?(.*)\\sBuild/(.+); wv\\) AppleWebKit/(\\d+)\\.(\\d+) " +
+                "\\s?(.*)\\sBuild/(.+?)(; wv)?\\) AppleWebKit/(\\d+)\\.(\\d+) " +
                 "\\(KHTML, like Gecko\\) " +
                 "Version/\\d+\\.\\d+ Chrome/\\d+\\.\\d+\\.\\d+\\.\\d+( Mobile)? " +
                 "Safari/(\\d+)\\.(\\d+)";
@@ -119,11 +119,12 @@
         //  5   - language
         //  6 - device model (optional)
         //  7 - build ID
-        //  8 - AppleWebKit major version number
-        //  9 - AppleWebKit minor version number
-        // 10 - " Mobile" string (optional)
-        // 11 - Safari major version number
-        // 12 - Safari minor version number
+        //  8 - WebView identifier "; wv" (optional)
+        //  9 - AppleWebKit major version number
+        // 10 - AppleWebKit minor version number
+        // 11 - " Mobile" string (optional)
+        // 12 - Safari major version number
+        // 13 - Safari minor version number
         Log.i(LOG_TAG, String.format("Trying to match pattern %s", patternString));
         final Pattern userAgentExpr = Pattern.compile(patternString);
         Matcher patternMatcher = userAgentExpr.matcher(actualUserAgentString);
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
index 12adb9f..43aaf98 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
@@ -64,7 +64,6 @@
         new BatchRunConfiguration("rgba8888d24s8", "unspecified", "window");
 
     private static final int UNRESPOSIVE_CMD_TIMEOUT_MS = 60000; // one minute
-    private static final int FILE_REMOVE_RETRY_INTERVAL = 2000; // 2 seconds
 
     private final String mPackageName;
     private final String mName;
@@ -79,7 +78,6 @@
     private Set<String> mDeviceFeatures;
     private Map<String, Boolean> mConfigQuerySupportCache = new HashMap<>();
     private IRunUtil mRunUtil = RunUtil.getDefault();
-    private ISleepProvider mSleepProvider = new SleepProvider();
 
     private IRecovery mDeviceRecovery = new Recovery();
     {
@@ -154,15 +152,6 @@
     }
 
     /**
-     * Sets the sleep provider DeqpTestRunner works on.
-     *
-     * Exposed for unit testing.
-     */
-    public void setSleepProvider(ISleepProvider sleepProvider) {
-        mSleepProvider = sleepProvider;
-    }
-
-    /**
      * Set IRunUtil.
      *
      * Exposed for unit testing.
@@ -777,12 +766,12 @@
         public void recoverConnectionRefused() throws DeviceNotAvailableException;
 
         /**
-         * Tries to recover device after abnormal termination of a command or a test run execution
-         * or link failure.
+         * Tries to recover device after abnormal execution termination or link failure.
          *
+         * @param progressedSinceLastCall true if test execution has progressed since last call
          * @throws DeviceNotAvailableException if recovery did not succeed
          */
-        public void recoverCommandNotCompleted() throws DeviceNotAvailableException;
+        public void recoverComLinkKilled() throws DeviceNotAvailableException;
     };
 
     /**
@@ -875,7 +864,7 @@
          * {@inheritDoc}
          */
         @Override
-        public void recoverCommandNotCompleted() throws DeviceNotAvailableException {
+        public void recoverComLinkKilled() throws DeviceNotAvailableException {
             switch (mState) {
                 case WAIT:
                     // First failure, just try to wait and try again
@@ -890,10 +879,10 @@
                         killDeqpProcess();
                     } catch (DeviceNotAvailableException ex) {
                         // chain forward
-                        recoverCommandNotCompleted();
+                        recoverComLinkKilled();
                     } catch (ProcessKillFailureException ex) {
                         // chain forward
-                        recoverCommandNotCompleted();
+                        recoverComLinkKilled();
                     }
                     break;
 
@@ -907,10 +896,10 @@
                         killDeqpProcess();
                     } catch (DeviceNotAvailableException ex) {
                         // chain forward
-                        recoverCommandNotCompleted();
+                        recoverComLinkKilled();
                     } catch (ProcessKillFailureException ex) {
                         // chain forward
-                        recoverCommandNotCompleted();
+                        recoverComLinkKilled();
                     }
                     break;
 
@@ -923,7 +912,7 @@
                         rebootDevice();
                     } catch (DeviceNotAvailableException ex) {
                         // chain forward
-                        recoverCommandNotCompleted();
+                        recoverComLinkKilled();
                     }
                     break;
 
@@ -1408,51 +1397,6 @@
         }
     }
 
-    private static final class FileRecreateFailedException extends Exception {
-    };
-
-    /**
-     * Creates a log file suitable for writing.
-     *
-     * Creates an empty file that is suitable for writing. If target file already exists, it will
-     * first be removed and then recreated. This delete-recreate cycle should guarantee that the
-     * target file is always writable and is not affected by file-access flags of the pre-existing
-     * file.
-     *
-     * Precreating a file in the runner makes detecting file-access issues faster and more
-     * reliable. It also avoids issues caused by sdcard FUSE spuriously preventing file creation.
-     */
-    private void precreateLogFile() throws DeviceNotAvailableException,
-            FileRecreateFailedException {
-        final int NUM_ATTEMPTS = 4;
-        int attemptNum = 0;
-        for (;;) {
-            mDevice.executeShellCommand("rm " + LOG_FILE_NAME);
-            ++attemptNum;
-
-            if (!mDevice.doesFileExist(LOG_FILE_NAME)) {
-                // yay, remove works like it should
-                break;
-            } else if (attemptNum < NUM_ATTEMPTS) {
-                // wait if we failed
-                CLog.w("Remote file removal failed, retrying...");
-                mSleepProvider.sleep(FILE_REMOVE_RETRY_INTERVAL);
-            } else {
-                // Bail
-                CLog.e("Could not delete a remote file.");
-                throw new FileRecreateFailedException();
-            }
-        }
-
-        // create & truncate and make world read-writable
-        mDevice.pushString("", LOG_FILE_NAME);
-
-        if (!mDevice.doesFileExist(LOG_FILE_NAME)) {
-            CLog.e("Could not precreate log file.");
-            throw new FileRecreateFailedException();
-        }
-    }
-
     /**
      * Runs one execution pass over the given batch.
      *
@@ -1468,8 +1412,8 @@
 
         final String testCases = generateTestCaseTrie(batch.tests);
 
-        // Caselist file cannot linger.
         mDevice.executeShellCommand("rm " + CASE_LIST_FILE_NAME);
+        mDevice.executeShellCommand("rm " + LOG_FILE_NAME);
         mDevice.pushString(testCases + "\n", CASE_LIST_FILE_NAME);
 
         final String instrumentationName =
@@ -1499,9 +1443,6 @@
         Throwable interruptingError = null;
 
         try {
-            // we might have lingering log file from a previous dirty run and it might be somehow
-            // locked (details unknown). Make sure it's writable when test is run.
-            precreateLogFile();
             executeShellCommandAndReadOutput(command, parser);
         } catch (Throwable ex) {
             interruptingError = ex;
@@ -1521,9 +1462,7 @@
             if (interruptingError instanceof AdbComLinkOpenError) {
                 mDeviceRecovery.recoverConnectionRefused();
             } else if (interruptingError instanceof AdbComLinkKilledError) {
-                mDeviceRecovery.recoverCommandNotCompleted();
-            } else if (interruptingError instanceof FileRecreateFailedException) {
-                mDeviceRecovery.recoverCommandNotCompleted();
+                mDeviceRecovery.recoverComLinkKilled();
             } else if (interruptingError instanceof RunInterruptedException) {
                 // external run interruption request. Terminate immediately.
                 throw (RunInterruptedException)interruptingError;
@@ -1534,7 +1473,7 @@
 
             // recoverXXX did not throw => recovery succeeded
         } else if (!parser.wasSuccessful()) {
-            mDeviceRecovery.recoverCommandNotCompleted();
+            mDeviceRecovery.recoverComLinkKilled();
             // recoverXXX did not throw => recovery succeeded
         }
 
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/DeqpTestRunnerTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/DeqpTestRunnerTest.java
index 4c879b4..7ec09c9 100644
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/DeqpTestRunnerTest.java
+++ b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/DeqpTestRunnerTest.java
@@ -106,7 +106,7 @@
          * {@inheritDoc}
          */
         @Override
-        public void recoverCommandNotCompleted() throws DeviceNotAvailableException {
+        public void recoverComLinkKilled() throws DeviceNotAvailableException {
         }
     };
 
@@ -1717,14 +1717,11 @@
         EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + CASE_LIST_FILE_NAME)))
                 .andReturn("").once();
 
-        EasyMock.expect(mockDevice.pushString("{dEQP-GLES3{loss{instance}}}\n", CASE_LIST_FILE_NAME))
-                .andReturn(true).once();
-
         EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + LOG_FILE_NAME)))
                 .andReturn("").once();
-        EasyMock.expect(mockDevice.doesFileExist(LOG_FILE_NAME)).andReturn(false).once();
-        EasyMock.expect(mockDevice.pushString("", LOG_FILE_NAME)).andReturn(true).once();
-        EasyMock.expect(mockDevice.doesFileExist(LOG_FILE_NAME)).andReturn(true).once();
+
+        EasyMock.expect(mockDevice.pushString("{dEQP-GLES3{loss{instance}}}\n", CASE_LIST_FILE_NAME))
+                .andReturn(true).once();
 
         String command = String.format(
                 "am instrument %s -w -e deqpLogFileName \"%s\" -e deqpCmdLine \""
@@ -1756,10 +1753,10 @@
         });
 
         if (!recoverySuccessful) {
-            mockRecovery.recoverCommandNotCompleted();
+            mockRecovery.recoverComLinkKilled();
             EasyMock.expectLastCall().andThrow(new DeviceNotAvailableException()).once();
         } else {
-            mockRecovery.recoverCommandNotCompleted();
+            mockRecovery.recoverComLinkKilled();
             EasyMock.expectLastCall().once();
 
             // retry running config B
@@ -1863,7 +1860,7 @@
                     recovery.recoverConnectionRefused();
                     break;
                 case FAIL_LINK_KILLED:
-                    recovery.recoverCommandNotCompleted();
+                    recovery.recoverComLinkKilled();
                     break;
             }
         }
@@ -2144,7 +2141,7 @@
         orderedControl.replay();
         recovery.setDevice(mockDevice);
         recovery.setSleepProvider(mockSleepProvider);
-        recovery.recoverCommandNotCompleted();
+        recovery.recoverComLinkKilled();
         orderedControl.verify();
     }
 
@@ -2315,216 +2312,16 @@
         EasyMock.verify(mockDevice, mockIDevice);
     }
 
-    /**
-     * Test log file precreate persistent failure
-     */
-    public void testPrecreate_persistentFailure() throws Exception {
-        final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.precreate", "test");
-        final String testTrie = "{dEQP-GLES3{precreate{test}}}";
-
-        Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
-        tests.add(testId);
-
-        Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
-        instance.put(testId, DEFAULT_INSTANCE_ARGS);
-
-        ITestInvocationListener mockListener
-                = EasyMock.createStrictMock(ITestInvocationListener.class);
-        ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
-        IDevice mockIDevice = EasyMock.createMock(IDevice.class);
-        DeqpTestRunner.ISleepProvider mockSleepProvider =
-                EasyMock.createMock(DeqpTestRunner.ISleepProvider.class);
-        DeqpTestRunner.IRecovery mockRecovery =
-                EasyMock.createMock(DeqpTestRunner.IRecovery.class);
-
-        DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
-        deqpTest.setAbi(UnitTests.ABI);
-        deqpTest.setDevice(mockDevice);
-        deqpTest.setBuildHelper(new StubCtsBuildHelper());
-        deqpTest.setSleepProvider(mockSleepProvider);
-        deqpTest.setRecovery(mockRecovery);
-
-        mockRecovery.setDevice(mockDevice);
-        EasyMock.expectLastCall().atLeastOnce();
-
-        int version = 3 << 16;
-        EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
-                .andReturn(Integer.toString(version)).atLeastOnce();
-
-        EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
-            andReturn("").once();
-
-        EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
-                EasyMock.eq(true),
-                EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
-                .once();
-
-        expectRenderConfigQuery(mockDevice,
-                "--deqp-gl-config-name=rgba8888d24s8 --deqp-screen-rotation=unspecified "
-                + "--deqp-surface-type=window --deqp-gl-major-version=3 "
-                + "--deqp-gl-minor-version=0");
-
-        EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + CASE_LIST_FILE_NAME)))
-                .andReturn("").once();
-
-        EasyMock.expect(mockDevice.pushString(testTrie + "\n", CASE_LIST_FILE_NAME))
-                .andReturn(true).once();
-
-        // fail persistently...
-        EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + LOG_FILE_NAME)))
-                .andReturn("").anyTimes();
-        EasyMock.expect(mockDevice.doesFileExist(LOG_FILE_NAME)).andReturn(true).anyTimes();
-        mockSleepProvider.sleep(EasyMock.gt(0));
-        EasyMock.expectLastCall().anyTimes();
-
-        // ..and when retries won't help, trigger recovery tactics
-        mockRecovery.recoverCommandNotCompleted();
-        EasyMock.expectLastCall().andThrow(new DeviceNotAvailableException()).once();
-
-        mockListener.testRunStarted(ID, 1);
-        EasyMock.expectLastCall().once();
-
-        EasyMock.replay(mockDevice, mockIDevice);
-        EasyMock.replay(mockListener);
-        EasyMock.replay(mockSleepProvider);
-        EasyMock.replay(mockRecovery);
-        try {
-            deqpTest.run(mockListener);
-            fail("expected DeviceNotAvailableException");
-        } catch (DeviceNotAvailableException ex) {
-            // expected
-        }
-        EasyMock.verify(mockRecovery);
-        EasyMock.verify(mockSleepProvider);
-        EasyMock.verify(mockListener);
-        EasyMock.verify(mockDevice, mockIDevice);
-    }
-
-    /**
-     * Test log file precreate transient failure
-     */
-    public void testPrecreate_transientFailure() throws Exception {
-        final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.precreate", "test");
-        final String testPath = "dEQP-GLES3.precreate.test";
-        final String testTrie = "{dEQP-GLES3{precreate{test}}}";
-        final String output = "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=" + testPath + "\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=DetailPass\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
-                + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
-                + "INSTRUMENTATION_CODE: 0\r\n";
-
-        Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
-        tests.add(testId);
-
-        Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
-        instance.put(testId, DEFAULT_INSTANCE_ARGS);
-
-        ITestInvocationListener mockListener
-                = EasyMock.createStrictMock(ITestInvocationListener.class);
-        ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
-        IDevice mockIDevice = EasyMock.createMock(IDevice.class);
-        DeqpTestRunner.ISleepProvider mockSleepProvider =
-                EasyMock.createMock(DeqpTestRunner.ISleepProvider.class);
-
-        DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
-        deqpTest.setAbi(UnitTests.ABI);
-        deqpTest.setDevice(mockDevice);
-        deqpTest.setBuildHelper(new StubCtsBuildHelper());
-        deqpTest.setSleepProvider(mockSleepProvider);
-
-        int version = 3 << 16;
-        EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
-                .andReturn(Integer.toString(version)).atLeastOnce();
-
-        EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
-            andReturn("").once();
-
-        EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
-                EasyMock.eq(true),
-                EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
-                .once();
-
-        expectRenderConfigQuery(mockDevice,
-                "--deqp-gl-config-name=rgba8888d24s8 --deqp-screen-rotation=unspecified "
-                + "--deqp-surface-type=window --deqp-gl-major-version=3 "
-                + "--deqp-gl-minor-version=0");
-
-        // fail once
-        EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + LOG_FILE_NAME)))
-                .andReturn("").once();
-        EasyMock.expect(mockDevice.doesFileExist(LOG_FILE_NAME)).andReturn(true).once();
-        mockSleepProvider.sleep(EasyMock.gt(0));
-        EasyMock.expectLastCall().once();
-
-        String commandLine = String.format(
-                "--deqp-caselist-file=%s --deqp-gl-config-name=rgba8888d24s8 "
-                + "--deqp-screen-rotation=unspecified "
-                + "--deqp-surface-type=window "
-                + "--deqp-log-images=disable "
-                + "--deqp-watchdog=enable",
-                CASE_LIST_FILE_NAME);
-
-        runInstrumentationLineAndAnswer(mockDevice, mockIDevice, testTrie, commandLine,
-                output);
-
-        EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
-            andReturn("").once();
-
-        mockListener.testRunStarted(ID, 1);
-        EasyMock.expectLastCall().once();
-
-        mockListener.testStarted(EasyMock.eq(testId));
-        EasyMock.expectLastCall().once();
-
-        mockListener.testEnded(EasyMock.eq(testId), EasyMock.<Map<String, String>>notNull());
-        EasyMock.expectLastCall().once();
-
-        mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
-        EasyMock.expectLastCall().once();
-
-        EasyMock.replay(mockDevice, mockIDevice);
-        EasyMock.replay(mockListener);
-        EasyMock.replay(mockSleepProvider);
-        deqpTest.run(mockListener);
-        EasyMock.verify(mockSleepProvider);
-        EasyMock.verify(mockListener);
-        EasyMock.verify(mockDevice, mockIDevice);
-    }
-
     private void runInstrumentationLineAndAnswer(ITestDevice mockDevice, IDevice mockIDevice,
             final String testTrie, final String cmd, final String output) throws Exception {
         EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + CASE_LIST_FILE_NAME)))
                 .andReturn("").once();
 
-        EasyMock.expect(mockDevice.pushString(testTrie + "\n", CASE_LIST_FILE_NAME))
-                .andReturn(true).once();
-
         EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + LOG_FILE_NAME)))
                 .andReturn("").once();
-        EasyMock.expect(mockDevice.doesFileExist(LOG_FILE_NAME)).andReturn(false).once();
-        EasyMock.expect(mockDevice.pushString("", LOG_FILE_NAME)).andReturn(true).once();
-        EasyMock.expect(mockDevice.doesFileExist(LOG_FILE_NAME)).andReturn(true).once();
+
+        EasyMock.expect(mockDevice.pushString(testTrie + "\n", CASE_LIST_FILE_NAME))
+                .andReturn(true).once();
 
         String command = String.format(
                 "am instrument %s -w -e deqpLogFileName \"%s\" -e deqpCmdLine \"%s\" "