summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data/LocalVideo.java
diff options
context:
space:
mode:
authorParamananda Pradhan <parama@codeaurora.org>2014-12-14 17:27:31 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2015-01-20 01:46:27 -0800
commit9382a979292e52de5c60a39ba24688362dce8bc1 (patch)
treea8ae53cf5d5d1b2703b782e09cc0c22c7102a374 /src/com/android/gallery3d/data/LocalVideo.java
parent5c273aab9d380d588d867122fb729cccffef86c2 (diff)
downloadandroid_packages_apps_Gallery2-9382a979292e52de5c60a39ba24688362dce8bc1.tar.gz
android_packages_apps_Gallery2-9382a979292e52de5c60a39ba24688362dce8bc1.tar.bz2
android_packages_apps_Gallery2-9382a979292e52de5c60a39ba24688362dce8bc1.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/LocalVideo.java')
-rw-r--r--src/com/android/gallery3d/data/LocalVideo.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/data/LocalVideo.java b/src/com/android/gallery3d/data/LocalVideo.java
index 4b8774ca4..d5e21e983 100644
--- a/src/com/android/gallery3d/data/LocalVideo.java
+++ b/src/com/android/gallery3d/data/LocalVideo.java
@@ -17,7 +17,10 @@
package com.android.gallery3d.data;
import android.content.ContentResolver;
+import android.content.ContentValues;
import android.database.Cursor;
+import android.drm.DrmManagerClient;
+import android.drm.DrmStore.DrmDeliveryType;
import android.graphics.Bitmap;
import android.graphics.BitmapRegionDecoder;
import android.net.Uri;
@@ -152,17 +155,18 @@ public class LocalVideo extends LocalMediaItem {
@Override
public Job<Bitmap> requestImage(int type) {
- return new LocalVideoRequest(mApplication, getPath(), dateModifiedInSec,
- type, filePath);
+ // Drm start
+ return new LocalVideoRequest(mApplication, getPath(), dateModifiedInSec,type, filePath, mimeType);
+ // Drm end
}
public static class LocalVideoRequest extends ImageCacheRequest {
private String mLocalFilePath;
LocalVideoRequest(GalleryApp application, Path path, long timeModified,
- int type, String localFilePath) {
+ int type, String localFilePath, String mimetype) {
super(application, path, timeModified, type,
- MediaItem.getTargetSize(type));
+ MediaItem.getTargetSize(type),localFilePath, mimetype);
mLocalFilePath = localFilePath;
}
@@ -182,7 +186,24 @@ public class LocalVideo extends LocalMediaItem {
@Override
public int getSupportedOperations() {
- return SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_PLAY | SUPPORT_INFO | SUPPORT_TRIM | SUPPORT_MUTE;
+ int supported = SUPPORT_DELETE | SUPPORT_PLAY | SUPPORT_INFO;
+ if (filePath != null && (filePath.endsWith(".dcf") || filePath.endsWith(".dm"))) {
+ supported |= SUPPORT_DRM_INFO;
+ DrmManagerClient drmClient = new DrmManagerClient(mApplication.getAndroidContext());
+ ContentValues values = drmClient.getMetadata(filePath);
+ int drmType = values.getAsInteger("DRM-TYPE");
+ Log.d("LocalVideo", "getSupportedOperations:drmType returned= "
+ + Integer.toString(drmType) + " for path= " + filePath);
+ if (drmType == DrmDeliveryType.SEPARATE_DELIVERY) {
+ supported |= SUPPORT_SHARE;
+ }
+ if (drmClient != null) drmClient.release();
+ } else {
+ Log.e("LocalVideo", "yy:share added for path= " + filePath);
+ supported |= SUPPORT_SHARE;
+ }
+
+ return supported;
}
@Override