diff options
author | Matt Garnes <matt@cyngn.com> | 2015-04-30 11:01:17 -0700 |
---|---|---|
committer | Matt Garnes <matt@cyngn.com> | 2015-05-05 10:43:36 -0700 |
commit | fbab7f32d2014c2bdae4eccf99d31ca76d0bf8f6 (patch) | |
tree | 4b71b113c9c910bd4cb95efe81e84517634b3aa9 /src/com/android/gallery3d/util | |
parent | 3fcec525d3dc64e34539734bbcaf3471f40ec2db (diff) | |
parent | 725da2fbd78bf38ff71bdbe9e1f27667dbf0fa73 (diff) | |
download | android_packages_apps_Gallery2-caf/cm-12.1.tar.gz android_packages_apps_Gallery2-caf/cm-12.1.tar.bz2 android_packages_apps_Gallery2-caf/cm-12.1.zip |
Merge remote-tracking branch 'caf/LA.BR.1.2.3' into caf/cm-12.1caf/cm-12.1
Conflicts:
res/layout/action_mode.xml
Change-Id: Id4005a098134f089e904ed090acec7ca6f786ad1
Diffstat (limited to 'src/com/android/gallery3d/util')
-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) { |