summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorParamananda <parama@codeaurora.org>2015-03-24 18:04:23 +0530
committerRicardo Cerqueira <ricardo@cyngn.com>2015-09-15 21:31:49 +0100
commit4f3e49619d3954056f899660cc764f3773d92141 (patch)
tree402b271e793996d4ca002b3512e57512b8fb0c85 /src
parentf5b491b181839286f58d640ae690f1860ef19e8c (diff)
downloadandroid_packages_apps_Gallery2-4f3e49619d3954056f899660cc764f3773d92141.zip
android_packages_apps_Gallery2-4f3e49619d3954056f899660cc764f3773d92141.tar.gz
android_packages_apps_Gallery2-4f3e49619d3954056f899660cc764f3773d92141.tar.bz2
Gallery2 : Drm lock icon added on Photo widget for drm content
CRs-fixed : 804180 Change-Id: I11c969f0156dba6db75c924a568eaa0733395208
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/gadget/PhotoAppWidgetProvider.java2
-rw-r--r--src/com/android/gallery3d/gadget/WidgetClickHandler.java2
-rw-r--r--src/com/android/gallery3d/gadget/WidgetService.java35
3 files changed, 35 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/gadget/PhotoAppWidgetProvider.java b/src/com/android/gallery3d/gadget/PhotoAppWidgetProvider.java
index 1dfbe3f..58466bf 100644
--- a/src/com/android/gallery3d/gadget/PhotoAppWidgetProvider.java
+++ b/src/com/android/gallery3d/gadget/PhotoAppWidgetProvider.java
@@ -106,7 +106,7 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider {
context.getPackageName(), R.layout.photo_frame);
try {
byte[] data = entry.imageData;
- Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, false);
+ Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
views.setImageViewBitmap(R.id.photo, bitmap);
} catch (Throwable t) {
Log.w(TAG, "cannot load widget image: " + appWidgetId, t);
diff --git a/src/com/android/gallery3d/gadget/WidgetClickHandler.java b/src/com/android/gallery3d/gadget/WidgetClickHandler.java
index 642f3d6..e5b0a37 100644
--- a/src/com/android/gallery3d/gadget/WidgetClickHandler.java
+++ b/src/com/android/gallery3d/gadget/WidgetClickHandler.java
@@ -57,8 +57,6 @@ public class WidgetClickHandler extends Activity {
Intent intent;
if (isValidDataUri(uri)) {
intent = new Intent(Intent.ACTION_VIEW, uri);
- intent.putExtra("WidgetClick", true);
-
// Used for checking whether it is from widget
intent.putExtra(PhotoPage.KEY_IS_FROM_WIDGET, true);
if (tediousBack) {
diff --git a/src/com/android/gallery3d/gadget/WidgetService.java b/src/com/android/gallery3d/gadget/WidgetService.java
index 8544337..7b16f8b 100644
--- a/src/com/android/gallery3d/gadget/WidgetService.java
+++ b/src/com/android/gallery3d/gadget/WidgetService.java
@@ -19,8 +19,10 @@ package com.android.gallery3d.gadget;
import android.annotation.TargetApi;
import android.appwidget.AppWidgetManager;
import android.content.Intent;
+import android.drm.DrmHelper;
import android.graphics.Bitmap;
import android.net.Uri;
+import android.view.View;
import android.widget.RemoteViews;
import android.widget.RemoteViewsService;
@@ -121,7 +123,31 @@ public class WidgetService extends RemoteViewsService {
return null;
}
Bitmap bitmap = mSource.getImage(position);
- if (bitmap == null) return getLoadingView();
+
+ boolean isDrm = false;
+ if (DrmHelper.isDrmFile(DrmHelper.getFilePath(
+ mApp.getAndroidContext(), mSource.getContentUri(position)))) {
+ isDrm = true;
+ }
+
+ if (isDrm) {
+ if (bitmap == null) {
+ RemoteViews rv = new RemoteViews(mApp.getAndroidContext()
+ .getPackageName(),
+ R.layout.appwidget_drm_empty_item);
+ rv.setOnClickFillInIntent(
+ R.id.appwidget_photo_item,
+ new Intent().setFlags(
+ Intent.FLAG_ACTIVITY_CLEAR_TOP).setData(
+ mSource.getContentUri(position)));
+ return rv;
+ }
+ } else {
+ if (bitmap == null) {
+ return getLoadingView();
+ }
+ }
+
RemoteViews views = new RemoteViews(
mApp.getAndroidContext().getPackageName(),
R.layout.appwidget_photo_item);
@@ -129,6 +155,13 @@ public class WidgetService extends RemoteViewsService {
views.setOnClickFillInIntent(R.id.appwidget_photo_item, new Intent()
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
.setData(mSource.getContentUri(position)));
+
+ if (isDrm) {
+ views.setViewVisibility(R.id.drm_icon, View.VISIBLE);
+ } else {
+ views.setViewVisibility(R.id.drm_icon, View.GONE);
+ }
+
return views;
}