From c7ad691a967e860a93d76bedb7c5d207dd083591 Mon Sep 17 00:00:00 2001 From: Mark Wei Date: Wed, 11 Dec 2013 15:08:12 -0800 Subject: We expect the BitmapRegionDecoder to fail on a GIF. We need to reset the InputStream so the BitmapFactory decoder doesn't choke on a consumed InputStream. Bug: 12099499 Change-Id: Ie066e04f369cc51b783e2ce95ca4be5e5f8e8871 --- src/com/android/bitmap/DecodeTask.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/com') diff --git a/src/com/android/bitmap/DecodeTask.java b/src/com/android/bitmap/DecodeTask.java index 0d814c4..03b8445 100644 --- a/src/com/android/bitmap/DecodeTask.java +++ b/src/com/android/bitmap/DecodeTask.java @@ -348,6 +348,16 @@ public class DecodeTask extends AsyncTask { decodeResult = bitmap; } catch (IOException e) { // fall through to below and try again with the non-cropping decoder + if (fd == null) { + in = reset(in); + if (in == null) { + return null; + } + if (isCancelled()) { + return null; + } + } + e.printStackTrace(); } finally { Trace.endSection(); -- cgit v1.2.3