summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/MenuExecutor.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/ui/MenuExecutor.java')
-rw-r--r--src/com/android/gallery3d/ui/MenuExecutor.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/ui/MenuExecutor.java b/src/com/android/gallery3d/ui/MenuExecutor.java
index 1ace71829..9b2c3259c 100644
--- a/src/com/android/gallery3d/ui/MenuExecutor.java
+++ b/src/com/android/gallery3d/ui/MenuExecutor.java
@@ -24,6 +24,8 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
+import android.drm.DrmHelper;
+import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.support.v4.print.PrintHelper;
@@ -179,7 +181,7 @@ public class MenuExecutor {
boolean supportInfo = (supported & MediaObject.SUPPORT_INFO) != 0;
boolean supportPrint = (supported & MediaObject.SUPPORT_PRINT) != 0;
supportPrint &= PrintHelper.systemSupportsPrint();
-
+ boolean supportDrmInfo = (supported & MediaObject.SUPPORT_DRM_INFO) != 0;
setMenuItemVisible(menu, R.id.action_delete, supportDelete);
setMenuItemVisible(menu, R.id.action_rotate_ccw, supportRotate);
setMenuItemVisible(menu, R.id.action_rotate_cw, supportRotate);
@@ -195,6 +197,7 @@ public class MenuExecutor {
// setMenuItemVisible(menu, R.id.action_simple_edit, supportEdit);
setMenuItemVisible(menu, R.id.action_details, supportInfo);
setMenuItemVisible(menu, R.id.print, supportPrint);
+ setMenuItemVisible(menu, R.id.action_drm_info, supportDrmInfo);
}
public static void updateMenuForPanorama(Menu menu, boolean shareAsPanorama360,
@@ -254,6 +257,14 @@ public class MenuExecutor {
Intent intent = getIntentBySingleSelectedPath(Intent.ACTION_ATTACH_DATA)
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra("mimeType", intent.getType());
+
+ // DRM files can be set as wallpaper only. Don't show other options
+ // to set as.
+ Uri uri = intent.getData();
+ if (DrmHelper.isDrmFile(DrmHelper.getFilePath(mActivity, uri))) {
+ intent.setPackage("com.android.gallery3d");
+ }
+
Activity activity = mActivity;
activity.startActivity(Intent.createChooser(
intent, activity.getString(R.string.set_as)));
@@ -271,6 +282,20 @@ public class MenuExecutor {
case R.id.action_show_on_map:
title = R.string.show_on_map;
break;
+ case R.id.action_drm_info:
+ DataManager manager = mActivity.getDataManager();
+ Path path = getSingleSelectedPath();
+ Uri uri = manager.getContentUri(path);
+ String filepath = null;
+ String scheme = uri.getScheme();
+ if ("file".equals(scheme)) {
+ filepath = uri.getPath();
+ } else {
+ filepath = DrmHelper.getFilePath(mActivity, uri);
+ }
+ DrmHelper.showDrmInfo(mActivity, filepath);
+ title = R.string.drm_license_info;
+ break;
default:
return;
}