summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app/MovieActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/app/MovieActivity.java')
-rw-r--r--src/com/android/gallery3d/app/MovieActivity.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/app/MovieActivity.java b/src/com/android/gallery3d/app/MovieActivity.java
index 275b04ab3..c316a7846 100644
--- a/src/com/android/gallery3d/app/MovieActivity.java
+++ b/src/com/android/gallery3d/app/MovieActivity.java
@@ -27,6 +27,9 @@ import android.bluetooth.BluetoothDevice;
import android.content.AsyncQueryHandler;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.DialogInterface;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -35,6 +38,8 @@ import android.content.res.Configuration;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.database.Cursor;
+import android.drm.DrmManagerClient;
+import android.drm.DrmStore.DrmDeliveryType;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.media.AudioManager;
@@ -48,6 +53,7 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
+import android.provider.MediaStore.Video.VideoColumns;
import android.provider.OpenableColumns;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -306,6 +312,36 @@ public class MovieActivity extends Activity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
+ String path = null;
+ String scheme = mUri.getScheme();
+ if ("file".equals(scheme)) {
+ path = mUri.getPath();
+ } else {
+ Cursor cursor = null;
+ try {
+ cursor = getContentResolver().query(mUri,
+ new String[] {VideoColumns.DATA}, null, null, null);
+ if (cursor != null && cursor.moveToNext()) {
+ path = cursor.getString(0);
+ }
+ } catch (Throwable t) {
+ Log.d(TAG, "cannot get path from: " + mUri);
+ } finally {
+ if (cursor != null) cursor.close();
+ }
+ }
+ Log.d(TAG, "onCreateOptionsMenu= " + path);
+ if ((path != null) && ((path.endsWith(".dcf") || path.endsWith(".dm")))) {
+ DrmManagerClient drmClient = new DrmManagerClient(this);
+ ContentValues values = drmClient.getMetadata(path);
+ int drmType = values.getAsInteger("DRM-TYPE");
+ Log.d(TAG, "onCreateOptionsMenu:DRM-TYPE = " + Integer.toString(drmType));
+ if (drmType != DrmDeliveryType.SEPARATE_DELIVERY) {
+ return true;
+ }
+ if (drmClient != null) drmClient.release();
+ }
+
getMenuInflater().inflate(R.menu.movie, menu);
MenuItem shareMenu = menu.findItem(R.id.action_share);
ShareActionProvider provider = (ShareActionProvider) shareMenu.getActionProvider();