diff options
author | Chris Wren <cwren@android.com> | 2013-06-18 16:47:47 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2013-06-18 16:54:38 -0400 |
commit | 23ab8f3366a5eeecd36c5f489a47eb6b8f03bc56 (patch) | |
tree | 64c950e155e701a45a1790b30634b8266fbb1793 /src | |
parent | bbb61ff2f2268a9ce23adb92b3cc57c398b2c278 (diff) | |
download | android_packages_screensavers_PhotoTable-23ab8f3366a5eeecd36c5f489a47eb6b8f03bc56.tar.gz android_packages_screensavers_PhotoTable-23ab8f3366a5eeecd36c5f489a47eb6b8f03bc56.tar.bz2 android_packages_screensavers_PhotoTable-23ab8f3366a5eeecd36c5f489a47eb6b8f03bc56.zip |
work around a bug in BMP decoding
Bug: 8792312
Change-Id: Idd2d1988896e8947a675b1a49347cd55249e8d99
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dreams/phototable/PhotoSource.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/dreams/phototable/PhotoSource.java b/src/com/android/dreams/phototable/PhotoSource.java index fc4cf7b..b462a6f 100644 --- a/src/com/android/dreams/phototable/PhotoSource.java +++ b/src/com/android/dreams/phototable/PhotoSource.java @@ -44,7 +44,7 @@ public abstract class PhotoSource { // This should be large enough for BitmapFactory to decode the header so // that we can mark and reset the input stream to avoid duplicate network i/o - private static final int BUFFER_SIZE = 128 * 1024; + private static final int BUFFER_SIZE = 32 * 1024; public class ImageData { public String id; @@ -184,7 +184,15 @@ public abstract class PhotoSource { } log(TAG, "decoding with inSampleSize " + options.inSampleSize); - bis.reset(); + try { + bis.reset(); + } catch (IOException ioe) { + // start over, something went wrong and we read too far into the image. + bis.close(); + is = data.getStream(longSide); + bis = new BufferedInputStream(is); + log(TAG, "resetting the stream"); + } options.inJustDecodeBounds = false; image = BitmapFactory.decodeStream(bis, null, options); rawLongSide = Math.max(options.outWidth, options.outHeight); |