summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/MenuExecutor.java
diff options
context:
space:
mode:
authorParamananda <parama@codeaurora.org>2015-03-24 17:51:29 +0530
committerRicardo Cerqueira <ricardo@cyngn.com>2015-09-15 21:31:49 +0100
commit01f5f347cf33813b51bd0865dc620d001c8d8735 (patch)
treef4176c8179058a09fe95700f03273c676e593103 /src/com/android/gallery3d/ui/MenuExecutor.java
parent43044da1965c1b687695f3f4e1d44d3636496978 (diff)
downloadandroid_packages_apps_Gallery2-01f5f347cf33813b51bd0865dc620d001c8d8735.tar.gz
android_packages_apps_Gallery2-01f5f347cf33813b51bd0865dc620d001c8d8735.tar.bz2
android_packages_apps_Gallery2-01f5f347cf33813b51bd0865dc620d001c8d8735.zip
Gallery2 : Uses internal Drm image decoder api in Gallery app
- Remove all previous drm implementation which is basically uses base bitmap decode apis to decode drm image files. - Introduced new hidden apis on BitmapFactory and BitmapRegionDecoder specific to DRM content which is more practical to DRM framework. - Uses DrmHelper a utility drm api library to code reusability. - This approch will fix the issue on sharing images from Third party application. CRs-fixed : 804191 Change-Id: I2e9489800c57df4fdeeb21f1548fbccc6dfbd3f9
Diffstat (limited to 'src/com/android/gallery3d/ui/MenuExecutor.java')
-rw-r--r--src/com/android/gallery3d/ui/MenuExecutor.java31
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: