summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/util/GIFView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/util/GIFView.java')
-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 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) {