Merge "Remove Test Annotation Related Tools" into gingerbread
diff --git a/tests/expectations/knownfailures.txt b/tests/expectations/knownfailures.txt
index c7b25b2..6292d7a 100644
--- a/tests/expectations/knownfailures.txt
+++ b/tests/expectations/knownfailures.txt
@@ -2,24 +2,15 @@
 /* These tests consistently fail on GRH78. */
 { name: "android.location.cts.GeocoderTest#testGetFromLocation" },
 { name: "android.location.cts.GeocoderTest#testGetFromLocationName" },
-{ name: "android.net.cts.ListeningPortsTest#testNoListeningUdp6Ports" },
 { name: "android.webkit.cts.WebSettingsTest#testSetAppCacheEnabled" },
 { name: "android.net.cts.SSLCertificateSocketFactoryTest" },
 
 {
-  description: "testGetDuration causes testOnKeyDown to fail for some reason",
-  name: "android.widget.cts.VideoViewTest#testOnKeyDown"
-},
-
-{
   description: "Flaky tests that need to be rewritten or deleted.",
   names: [
     "android.media.cts.MediaRecorderTest#testSetCamera",
     "android.webkit.cts.CacheManagerTest#testCacheFile",
-    "android.widget.cts.AutoCompleteTextViewTest#testOnFilterComplete",
-    "android.util.cts.EventLogTest#testReadEvents",
-    "android.util.cts.EventLogTest#testWriteEvent",
-    "android.util.cts.EventLogTest#testWriteEventWithOversizeValue"
+    "android.widget.cts.AutoCompleteTextViewTest#testOnFilterComplete"
   ]
 },
 
@@ -28,29 +19,17 @@
   name: "android.provider.cts.MediaStore_Audio_Playlists_MembersTest"
 },
 
-/* These tests pass when executed individually but fail when running CTS as a whole on GRH78. */
 {
-  name: "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyConnection",
-  bug: 3184701
-},
-{
-  name: "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyAuthConnection",
-  bug: 3184701
-},
-{
-  name: "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testConsequentProxyConnection",
-  bug: 3184701
-},
-{
-  name: "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyAuthConnection_doOutput",
-  bug: 3184701
-},
-{
-  name: "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyAuthConnectionFailed",
-  bug: 3184701
-},
-{
-  name: "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyConnection_Not_Found_Response",
-  bug: 3184701
+  description: "These tests pass when executed individually but fail when running CTS as a whole on GRH78.",
+  bug: 3184701,
+  names: [
+    "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyConnection",
+    "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyAuthConnection",
+    "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testConsequentProxyConnection",
+    "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyAuthConnection_doOutput",
+    "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyAuthConnectionFailed",
+    "org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest#testProxyConnection_Not_Found_Response"
+  ]
 }
+
 ]
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 9ed0d93..2dd09b6 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -331,9 +331,11 @@
         assertTrue(mShutterCallbackResult);
         assertTrue(mJpegPictureCallbackResult);
         assertNotNull(mJpegData);
-        Bitmap b = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length);
-        assertEquals(pictureSize.width, b.getWidth());
-        assertEquals(pictureSize.height, b.getHeight());
+        BitmapFactory.Options bmpOptions = new BitmapFactory.Options();
+        bmpOptions.inJustDecodeBounds = true;
+        BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length, bmpOptions);
+        assertEquals(pictureSize.width, bmpOptions.outWidth);
+        assertEquals(pictureSize.height, bmpOptions.outHeight);
     }
 
     @TestTargets({
@@ -761,9 +763,11 @@
         ExifInterface exif = new ExifInterface(JPEG_PATH);
         assertTrue(exif.hasThumbnail());
         byte[] thumb = exif.getThumbnail();
-        Bitmap b = BitmapFactory.decodeByteArray(thumb, 0, thumb.length);
-        assertEquals(size.width, b.getWidth());
-        assertEquals(size.height, b.getHeight());
+        BitmapFactory.Options bmpOptions = new BitmapFactory.Options();
+        bmpOptions.inJustDecodeBounds = true;
+        BitmapFactory.decodeByteArray(thumb, 0, thumb.length, bmpOptions);
+        assertEquals(size.width, bmpOptions.outWidth);
+        assertEquals(size.height, bmpOptions.outHeight);
 
         // Test no thumbnail case.
         p.setJpegThumbnailSize(0, 0);
@@ -1451,11 +1455,11 @@
                 waitForSnapshotDone();
                 assertTrue(mJpegPictureCallbackResult);
                 assertNotNull(mJpegData);
-                Bitmap b = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length);
-                assertEquals(pictureSize.width, b.getWidth());
-                assertEquals(pictureSize.height, b.getHeight());
-                b.recycle();
-                b = null;
+                BitmapFactory.Options bmpOptions = new BitmapFactory.Options();
+                bmpOptions.inJustDecodeBounds = true;
+                BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length, bmpOptions);
+                assertEquals(pictureSize.width, bmpOptions.outWidth);
+                assertEquals(pictureSize.height, bmpOptions.outHeight);
             }
         }
         terminateMessageLooper();
diff --git a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
index 6b9aa84..44d48a5 100644
--- a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
@@ -31,7 +31,6 @@
 import android.media.MediaPlayer.OnErrorListener;
 import android.media.MediaPlayer.OnPreparedListener;
 import android.test.ActivityInstrumentationTestCase2;
-import android.view.KeyEvent;
 import android.view.View.MeasureSpec;
 import android.view.animation.cts.DelayedCheck;
 import android.widget.MediaController;
@@ -310,89 +309,6 @@
     }
 
     @TestTargetNew(
-        level = TestLevel.NOT_NECESSARY,
-        method = "onTouchEvent",
-        args = {android.view.MotionEvent.class}
-    )
-    public void testOnTouchEvent() {
-        // onTouchEvent() is implementation details, do NOT test
-    }
-
-    @TestTargetNew(
-        level = TestLevel.SUFFICIENT,
-        method = "onKeyDown",
-        args = {int.class, android.view.KeyEvent.class}
-    )
-    public void testOnKeyDown() throws Throwable {
-        runTestOnUiThread(new Runnable() {
-            public void run() {
-                mVideoView.setVideoPath(mVideoPath);
-                mVideoView.requestFocus();
-            }
-        });
-        mInstrumentation.waitForIdleSync();
-
-        assertFalse(mVideoView.isPlaying());
-        sendKeys(KeyEvent.KEYCODE_HEADSETHOOK);
-        // video should be played.
-        new DelayedCheck(TIME_OUT) {
-            @Override
-            protected boolean check() {
-                return mVideoView.isPlaying();
-            }
-        }.run();
-        assertFalse(mMediaController.isShowing());
-
-        sendKeys(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
-        new DelayedCheck(TIME_OUT) {
-            @Override
-            protected boolean check() {
-                return !mVideoView.isPlaying();
-            }
-        }.run();
-        // MediaController should show
-        assertTrue(mMediaController.isShowing());
-
-        runTestOnUiThread(new Runnable() {
-            public void run() {
-                mVideoView.start();
-            }
-        });
-        new DelayedCheck(TIME_OUT) {
-            @Override
-            protected boolean check() {
-                return mVideoView.isPlaying();
-            }
-        }.run();
-
-        sendKeys(KeyEvent.KEYCODE_MEDIA_STOP);
-        new DelayedCheck(TIME_OUT) {
-            @Override
-            protected boolean check() {
-                return !mVideoView.isPlaying();
-            }
-        }.run();
-    }
-
-    @TestTargetNew(
-        level = TestLevel.NOT_NECESSARY,
-        method = "onMeasure",
-        args = {int.class, int.class}
-    )
-    public void testOnMeasure() {
-        // Do not test onMeasure(), implementation details
-    }
-
-    @TestTargetNew(
-        level = TestLevel.NOT_NECESSARY,
-        method = "onTrackballEvent",
-        args = {android.view.MotionEvent.class}
-    )
-    public void testOnTrackballEvent() {
-        // Do not test onTrackballEvent(), implementation details
-    }
-
-    @TestTargetNew(
         level = TestLevel.COMPLETE,
         method = "getDuration",
         args = {}