diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-04-24 14:16:43 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-04-24 14:20:38 +0800 |
commit | fa021af9397011cf180003139e80a88902c4b70a (patch) | |
tree | 6d6172d5a1c850ece36817224a7e1710335a30af /src/com/android/camera | |
parent | 819fa006a0094f1bd926bbe5a7d4995f15d87ec3 (diff) | |
download | LegacyCamera-fa021af9397011cf180003139e80a88902c4b70a.zip LegacyCamera-fa021af9397011cf180003139e80a88902c4b70a.tar.gz LegacyCamera-fa021af9397011cf180003139e80a88902c4b70a.tar.bz2 |
Fix bitmap decoding in CropImage.
Call allow decoding function so it can decode bitmaps.
Add log in BitmapManager so we can fix callers which forget to call it.
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/BitmapManager.java | 14 | ||||
-rw-r--r-- | src/com/android/camera/CropImage.java | 5 | ||||
-rwxr-xr-x | src/com/android/camera/ImageManager.java | 15 | ||||
-rw-r--r-- | src/com/android/camera/Util.java | 5 |
4 files changed, 21 insertions, 18 deletions
diff --git a/src/com/android/camera/BitmapManager.java b/src/com/android/camera/BitmapManager.java index 4d17ec3..22d5bb3 100644 --- a/src/com/android/camera/BitmapManager.java +++ b/src/com/android/camera/BitmapManager.java @@ -229,15 +229,23 @@ public class BitmapManager { */ public Bitmap decodeFileDescriptor(FileDescriptor fd, BitmapFactory.Options options) { + if (options.mCancel) { + return null; + } + // Does the global switch turn on? - if (!canDecode() || options.mCancel) { - return null; + if (!canDecode()) { + // This is a bug, and we should fix the caller. + Util.debugWhere(TAG, "canDecode() == false"); + return null; } // Can current thread decode? Thread thread = Thread.currentThread(); if (!canThreadDecoding(thread)) { - return null; + // This is a bug, and we should fix the caller. + Util.debugWhere(TAG, "canThreadDecoding() == false"); + return null; } setDecodingOptions(thread, options); diff --git a/src/com/android/camera/CropImage.java b/src/com/android/camera/CropImage.java index fc3e360..616a851 100644 --- a/src/com/android/camera/CropImage.java +++ b/src/com/android/camera/CropImage.java @@ -102,6 +102,11 @@ public class CropImage extends Activity { MenuHelper.showStorageToast(this); + BitmapManager bitmapManager = BitmapManager.instance(); + bitmapManager.setCheckResourceLock(false); + bitmapManager.allowAllDecoding(); + bitmapManager.allowThreadDecoding(Thread.currentThread()); + try { Intent intent = getIntent(); Bundle extras = intent.getExtras(); diff --git a/src/com/android/camera/ImageManager.java b/src/com/android/camera/ImageManager.java index 05b197e..8a4b055 100755 --- a/src/com/android/camera/ImageManager.java +++ b/src/com/android/camera/ImageManager.java @@ -111,21 +111,6 @@ public class ImageManager { } } - public static void debugWhere(String tag, String msg) { - Exception ex = new Exception(); - if (msg != null) { - Log.v(tag, msg); - } - boolean first = true; - for (StackTraceElement s : ex.getStackTrace()) { - if (first) { - first = false; - } else { - Log.v(tag, s.toString()); - } - } - } - public static DataLocation getDefaultDataLocation() { return DataLocation.EXTERNAL; } diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 5f5c624..2b7e756 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -355,4 +355,9 @@ public class Util { return null; } } + + public static void debugWhere(String tag, String msg) { + Exception ex = new Exception(); + Log.d(tag, msg, ex); + } } |