diff options
author | George Mount <mount@google.com> | 2013-05-28 23:50:24 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-05-28 23:50:24 +0000 |
commit | f91b03fd66f37fcabe3581011a58b37977ff2922 (patch) | |
tree | 3ffa307c510425865c4f59297e43cf0435673e9c /src/com/android/photos | |
parent | 260b999e473f5a4ef616ed0da5edf332a2fce2dd (diff) | |
parent | 98df4dc894b8d8b8a6cac932ce193fddb7858e99 (diff) | |
download | android_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.java | 9 |
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; |