merge AOSP changes: media and graphics

Change-Id: I0feb091a199a34f8b5a10d8118b0f2b334c0ce6e
diff --git a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
index 932a5d5..c84919a 100644
--- a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
+++ b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
@@ -17,6 +17,7 @@
 package android.graphics2.cts;
 
 import android.graphics2.cts.TextureViewCameraActivity;
+import android.hardware.Camera;
 import android.test.ActivityInstrumentationTestCase2;
 
 
@@ -30,10 +31,16 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        if (Camera.getNumberOfCameras() < 1) {
+            return;
+        }
         mActivity = getActivity();
     }
 
     public void testTextureViewActivity() throws InterruptedException {
+        if (Camera.getNumberOfCameras() < 1) {
+            return;
+        }
         assertTrue(mActivity.waitForCompletion(WAIT_TIMEOUT_IN_SECS));
     }
 
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index 02b18de..3274d13 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -314,7 +314,7 @@
      * from the time setDisplay() was called
      */
     public void testVideoSurfaceResetting() throws Exception {
-        final int tolerance = 66 * 3 / 2; /* Test video is 15fps... 66 ms per frame */
+        final int tolerance = 150;
         final int audioLatencyTolerance = 1000;  /* covers audio path latency variability */
         final int seekPos = 5000;