summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Muramatsu <btmura@android.com>2011-04-20 14:40:20 -0700
committerandroid-merger <android-build@android.com>2011-04-22 13:35:02 -0700
commit81b010fe20906fd51a23e766001b29a7b50c2cb4 (patch)
treef035422dc44be93b08cd9122ce1377c8f6f50617
parent27e1c69a94903178081662caa6251a71d594ccb7 (diff)
downloadplatform_cts-81b010fe20906fd51a23e766001b29a7b50c2cb4.tar.gz
platform_cts-81b010fe20906fd51a23e766001b29a7b50c2cb4.tar.bz2
platform_cts-81b010fe20906fd51a23e766001b29a7b50c2cb4.zip
Revert "CTS: Fixes a possible "out of memory" exception"android-2.3.4_r1
This reverts commit 7eade134e4c8fdaee5b7dfb0446dc90085b0408a. This causes the test to fail on Nexus S, so I'm reverting the change for Gingerbread. However, it will be included in a future CTS release. Additional info from Wu-cheng: "The change made the test faster. If apps call setParameters right after jpeg callback is received, it will fail. This is not a regression and I believe it does not impact users." Change-Id: I14ce1235581dac5543983f60ed047ae9331a754a
-rw-r--r--tests/tests/hardware/src/android/hardware/cts/CameraTest.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 2dd09b6a96b..9ed0d93e538 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -331,11 +331,9 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraStubActiv
assertTrue(mShutterCallbackResult);
assertTrue(mJpegPictureCallbackResult);
assertNotNull(mJpegData);
- 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);
+ Bitmap b = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length);
+ assertEquals(pictureSize.width, b.getWidth());
+ assertEquals(pictureSize.height, b.getHeight());
}
@TestTargets({
@@ -763,11 +761,9 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraStubActiv
ExifInterface exif = new ExifInterface(JPEG_PATH);
assertTrue(exif.hasThumbnail());
byte[] thumb = exif.getThumbnail();
- 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);
+ Bitmap b = BitmapFactory.decodeByteArray(thumb, 0, thumb.length);
+ assertEquals(size.width, b.getWidth());
+ assertEquals(size.height, b.getHeight());
// Test no thumbnail case.
p.setJpegThumbnailSize(0, 0);
@@ -1455,11 +1451,11 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraStubActiv
waitForSnapshotDone();
assertTrue(mJpegPictureCallbackResult);
assertNotNull(mJpegData);
- 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);
+ Bitmap b = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length);
+ assertEquals(pictureSize.width, b.getWidth());
+ assertEquals(pictureSize.height, b.getHeight());
+ b.recycle();
+ b = null;
}
}
terminateMessageLooper();