diff options
author | Paramananda Pradhan <parama@codeaurora.org> | 2014-12-14 17:27:31 +0530 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-09-15 21:31:49 +0100 |
commit | 829f9ad8c06070038cdef24e5fac76a8a16f841b (patch) | |
tree | 80fb1a7700307bb833226e04e5547f91f86f374a /src/com/android/gallery3d/data/DecodeUtils.java | |
parent | a5aa75d6ac958822e145b61e7c475bd1dc1b5260 (diff) | |
download | android_packages_apps_Gallery2-829f9ad8c06070038cdef24e5fac76a8a16f841b.tar.gz android_packages_apps_Gallery2-829f9ad8c06070038cdef24e5fac76a8a16f841b.tar.bz2 android_packages_apps_Gallery2-829f9ad8c06070038cdef24e5fac76a8a16f841b.zip |
Gallery2: Make Gallery2 support OMADRM feature
- Make Gallery2 can recognize and consume DRM images and videos.
Change-Id: I1655d295bcec31b5760c2c86c06f815cf6ed57ee
Diffstat (limited to 'src/com/android/gallery3d/data/DecodeUtils.java')
-rw-r--r-- | src/com/android/gallery3d/data/DecodeUtils.java | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/data/DecodeUtils.java b/src/com/android/gallery3d/data/DecodeUtils.java index 825c4bbea..12405184c 100644 --- a/src/com/android/gallery3d/data/DecodeUtils.java +++ b/src/com/android/gallery3d/data/DecodeUtils.java @@ -87,7 +87,7 @@ public class DecodeUtils { jc.setCancelListener(new DecodeCanceller(options)); setOptionsMutable(options); return ensureGLCompatibleBitmap( - BitmapFactory.decodeByteArray(bytes, offset, length, options)); + BitmapFactory.decodeByteArray(bytes, offset, length, options, false)); } public static void decodeBounds(JobContext jc, byte[] bytes, int offset, @@ -95,7 +95,7 @@ public class DecodeUtils { Utils.assertTrue(options != null); options.inJustDecodeBounds = true; jc.setCancelListener(new DecodeCanceller(options)); - BitmapFactory.decodeByteArray(bytes, offset, length, options); + BitmapFactory.decodeByteArray(bytes, offset, length, options, false); options.inJustDecodeBounds = false; } @@ -120,7 +120,7 @@ public class DecodeUtils { jc.setCancelListener(new DecodeCanceller(options)); options.inJustDecodeBounds = true; - BitmapFactory.decodeFileDescriptor(fd, null, options); + BitmapFactory.decodeFileDescriptor(fd, null, options, false); if (jc.isCancelled()) return null; int w = options.outWidth; @@ -148,7 +148,7 @@ public class DecodeUtils { options.inJustDecodeBounds = false; setOptionsMutable(options); - Bitmap result = BitmapFactory.decodeFileDescriptor(fd, null, options); + Bitmap result = BitmapFactory.decodeFileDescriptor(fd, null, options, false); if (result == null) return null; // We need to resize down if the decoder does not support inSampleSize @@ -174,7 +174,7 @@ public class DecodeUtils { jc.setCancelListener(new DecodeCanceller(options)); options.inJustDecodeBounds = true; - BitmapFactory.decodeByteArray(data, 0, data.length, options); + BitmapFactory.decodeByteArray(data, 0, data.length, options, false); if (jc.isCancelled()) return null; if (options.outWidth < targetSize || options.outHeight < targetSize) { return null; @@ -184,8 +184,16 @@ public class DecodeUtils { options.inJustDecodeBounds = false; setOptionsMutable(options); - return ensureGLCompatibleBitmap( - BitmapFactory.decodeByteArray(data, 0, data.length, options)); + Bitmap bitmap = null; + + try { + bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options, false); + + } catch (OutOfMemoryError ex) { + bitmap = null; + Log.e(TAG, "OutOfMemoryError : image is too large"); + } + return ensureGLCompatibleBitmap(bitmap); } // TODO: This function should not be called directly from |