summaryrefslogtreecommitdiffstats
path: root/src/com/android/photos
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2013-05-28 23:50:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-05-28 23:50:24 +0000
commitf91b03fd66f37fcabe3581011a58b37977ff2922 (patch)
tree3ffa307c510425865c4f59297e43cf0435673e9c /src/com/android/photos
parent260b999e473f5a4ef616ed0da5edf332a2fce2dd (diff)
parent98df4dc894b8d8b8a6cac932ce193fddb7858e99 (diff)
downloadandroid_packages_apps_Snap-f91b03fd66f37fcabe3581011a58b37977ff2922.tar.gz
android_packages_apps_Snap-f91b03fd66f37fcabe3581011a58b37977ff2922.tar.bz2
android_packages_apps_Snap-f91b03fd66f37fcabe3581011a58b37977ff2922.zip
Merge "Recover from bitmap decode failure." into gb-ub-photos-carlsbad
Diffstat (limited to 'src/com/android/photos')
-rw-r--r--src/com/android/photos/data/BitmapDecoder.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/photos/data/BitmapDecoder.java b/src/com/android/photos/data/BitmapDecoder.java
index 3e5a0f778..c5101cdfb 100644
--- a/src/com/android/photos/data/BitmapDecoder.java
+++ b/src/com/android/photos/data/BitmapDecoder.java
@@ -97,13 +97,13 @@ public class BitmapDecoder {
private static <T> Bitmap delegateDecode(Decoder<T> decoder, T input) {
BitmapFactory.Options options = getOptions();
+ GalleryBitmapPool pool = GalleryBitmapPool.getInstance();
try {
options.inJustDecodeBounds = true;
if (!decoder.decodeBounds(input, options)) {
return null;
}
options.inJustDecodeBounds = false;
- GalleryBitmapPool pool = GalleryBitmapPool.getInstance();
Bitmap reuseBitmap = pool.get(options.outWidth, options.outHeight);
options.inBitmap = reuseBitmap;
Bitmap decodedBitmap = decoder.decode(input, options);
@@ -111,6 +111,13 @@ public class BitmapDecoder {
pool.put(reuseBitmap);
}
return decodedBitmap;
+ } catch (IllegalArgumentException e) {
+ if (options.inBitmap == null) {
+ throw e;
+ }
+ pool.put(options.inBitmap);
+ options.inBitmap = null;
+ return decoder.decode(input, options);
} finally {
options.inBitmap = null;
options.inJustDecodeBounds = false;