diff options
author | Paramananda <parama@codeaurora.org> | 2015-03-24 18:02:37 +0530 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-09-15 21:31:49 +0100 |
commit | f5b491b181839286f58d640ae690f1860ef19e8c (patch) | |
tree | 61e9e1b188c7b3ff578552cb17c69a2150cf6229 | |
parent | 01f5f347cf33813b51bd0865dc620d001c8d8735 (diff) | |
download | android_packages_apps_Gallery2-f5b491b181839286f58d640ae690f1860ef19e8c.tar.gz android_packages_apps_Gallery2-f5b491b181839286f58d640ae690f1860ef19e8c.tar.bz2 android_packages_apps_Gallery2-f5b491b181839286f58d640ae690f1860ef19e8c.zip |
Gallery2 : GIF animated drm file can be visible in Gallery app
CRs-fixed : 804192
Change-Id: I0d62ebc31b54d5369e9530089e7c47088fc8d92f
-rwxr-xr-x | src/com/android/gallery3d/util/GIFView.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/util/GIFView.java b/src/com/android/gallery3d/util/GIFView.java index 86003fb31..c80625b41 100755 --- a/src/com/android/gallery3d/util/GIFView.java +++ b/src/com/android/gallery3d/util/GIFView.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.ContentResolver; import android.content.res.AssetManager; import android.database.Cursor; +import android.drm.DrmHelper; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; @@ -45,6 +46,19 @@ public class GIFView extends ImageView implements GifAction { } mUri = uri; + // Let decode the GIF image from byte stream instead of file stream + String filepath = DrmHelper.getFilePath(mContext, mUri); + if (DrmHelper.isDrmFile(filepath)) { + byte[] bytes = DrmHelper.getDrmImageBytes(filepath); + DrmHelper.manageDrmLicense(mContext, this.getHandler(), filepath, + "image/gif"); + if (bytes == null) { + return false; + } + startDecode(bytes); + return true; + } + InputStream is = getInputStream(uri); if (is == null || (getFileSize (is) == 0)) { return false; @@ -92,6 +106,12 @@ public class GIFView extends ImageView implements GifAction { mGifDecoder.start(); } + private void startDecode(byte[] bytes) { + freeGifDecoder(); + mGifDecoder = new GifDecoder(bytes, this); + mGifDecoder.start(); + } + protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mGifDecoder == null) { |