diff options
Diffstat (limited to 'src/com/android/gallery3d/ui/MenuExecutor.java')
-rw-r--r-- | src/com/android/gallery3d/ui/MenuExecutor.java | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/com/android/gallery3d/ui/MenuExecutor.java b/src/com/android/gallery3d/ui/MenuExecutor.java index 00a1459b0..9b2c3259c 100644 --- a/src/com/android/gallery3d/ui/MenuExecutor.java +++ b/src/com/android/gallery3d/ui/MenuExecutor.java @@ -24,11 +24,10 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; -import android.database.Cursor; +import android.drm.DrmHelper; import android.net.Uri; import android.os.Handler; import android.os.Message; -import android.provider.MediaStore.Video.VideoColumns; import android.support.v4.print.PrintHelper; import android.view.Menu; import android.view.MenuItem; @@ -258,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))); @@ -279,30 +286,14 @@ public class MenuExecutor { DataManager manager = mActivity.getDataManager(); Path path = getSingleSelectedPath(); Uri uri = manager.getContentUri(path); - Log.d(TAG, "onMenuClicked:" + uri); String filepath = null; String scheme = uri.getScheme(); if ("file".equals(scheme)) { filepath = uri.getPath(); } else { - Cursor cursor = null; - try { - cursor = mActivity.getAndroidContext().getContentResolver().query(uri, - new String[] {VideoColumns.DATA}, null, null, null); - if (cursor != null && cursor.moveToNext()) { - filepath = cursor.getString(0); - } - } catch (Throwable t) { - Log.w(TAG, "cannot get path from: " + uri); - } finally { - if (cursor != null) cursor.close(); - } + filepath = DrmHelper.getFilePath(mActivity, uri); } - Intent drmintent = new Intent("android.drmservice.intent.action.SHOW_PROPERTIES"); - filepath = filepath.replace("/storage/emulated/0", "/storage/emulated/legacy"); - drmintent.putExtra("DRM_FILE_PATH", filepath); - drmintent.putExtra("DRM_TYPE", "OMAV1"); - mActivity.getAndroidContext().sendBroadcast(drmintent); + DrmHelper.showDrmInfo(mActivity, filepath); title = R.string.drm_license_info; break; default: |