summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParamananda <parama@codeaurora.org>2015-03-24 12:32:37 (GMT)
committerRicardo Cerqueira <ricardo@cyngn.com>2015-09-15 20:31:49 (GMT)
commitf5b491b181839286f58d640ae690f1860ef19e8c (patch)
tree61e9e1b188c7b3ff578552cb17c69a2150cf6229
parent01f5f347cf33813b51bd0865dc620d001c8d8735 (diff)
downloadandroid_packages_apps_Gallery2-f5b491b181839286f58d640ae690f1860ef19e8c.zip
android_packages_apps_Gallery2-f5b491b181839286f58d640ae690f1860ef19e8c.tar.gz
android_packages_apps_Gallery2-f5b491b181839286f58d640ae690f1860ef19e8c.tar.bz2
Gallery2 : GIF animated drm file can be visible in Gallery app
CRs-fixed : 804192 Change-Id: I0d62ebc31b54d5369e9530089e7c47088fc8d92f
-rwxr-xr-xsrc/com/android/gallery3d/util/GIFView.java20
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 86003fb..c80625b 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) {