summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/bitmap/DecodeTask.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/com/android/bitmap/DecodeTask.java b/src/com/android/bitmap/DecodeTask.java
index e227446..ac08c0b 100644
--- a/src/com/android/bitmap/DecodeTask.java
+++ b/src/com/android/bitmap/DecodeTask.java
@@ -120,20 +120,8 @@ public class DecodeTask extends AsyncTask<Void, Void, ReusableBitmap> {
ReusableBitmap result = null;
ParcelFileDescriptor fd = null;
InputStream in = null;
- try {
- final boolean isJellyBeanOrAbove = android.os.Build.VERSION.SDK_INT
- >= android.os.Build.VERSION_CODES.JELLY_BEAN;
- // This blocks during fling when the pool is empty. We block early to avoid jank.
- if (isJellyBeanOrAbove) {
- Trace.beginSection("poll for reusable bitmap");
- mInBitmap = mCache.poll();
- Trace.endSection();
-
- if (isCancelled()) {
- return null;
- }
- }
+ try {
if (mFactory != null) {
Trace.beginSection("create fd");
fd = mFactory.createFileDescriptor();
@@ -143,6 +131,18 @@ public class DecodeTask extends AsyncTask<Void, Void, ReusableBitmap> {
if (in == null) {
return null;
}
+ if (isCancelled()) {
+ return null;
+ }
+ }
+
+ final boolean isJellyBeanOrAbove = android.os.Build.VERSION.SDK_INT
+ >= android.os.Build.VERSION_CODES.JELLY_BEAN;
+ // This blocks during fling when the pool is empty. We block early to avoid jank.
+ if (isJellyBeanOrAbove) {
+ Trace.beginSection("poll for reusable bitmap");
+ mInBitmap = mCache.poll();
+ Trace.endSection();
}
if (isCancelled()) {