From 0455309dcd9af6dfdef5c72b6939ecceef935fe9 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Sat, 17 Oct 2015 23:43:31 -0700 Subject: Gallery2: Revert DRM feature * Missing framework support in M, revisit later. Revert "Gallery2 : Drm file can be set as wallpaper" This reverts commit b00985f4de70444fa5ece9e8a78a79e73f4475b1. Revert "Gallery2 : Drm lock icon added on Photo widget for drm content" This reverts commit 4f3e49619d3954056f899660cc764f3773d92141. Revert "Gallery2 : GIF animated drm file can be visible in Gallery app" This reverts commit f5b491b181839286f58d640ae690f1860ef19e8c. Revert "Gallery2 : Delete and Details options are not visible on Camera preview" This reverts commit 704bff736bda2bc5f6c5aa2956879f55101191f5. Revert "Gallery2 : Video share option is not working" This reverts commit ea87a93df185b9f8c1e477188b55a2fe97dc983e. Revert "Gallery2 : Uses internal Drm image decoder api in Gallery app" This reverts commit 01f5f347cf33813b51bd0865dc620d001c8d8735. Revert "Gallery2 : Added support for Oma drm (CD and SD)" This reverts commit 43044da1965c1b687695f3f4e1d44d3636496978. Revert "Gallery2: Make Gallery2 support OMADRM feature" This reverts commit 829f9ad8c06070038cdef24e5fac76a8a16f841b. Change-Id: I4300285fd8539eb2e3134a0e472a087b83a0228f --- AndroidManifest.xml | 1 - res/drawable-hdpi/drm_image.png | Bin 4378 -> 0 bytes res/drawable-mdpi/drm_image.png | Bin 3982 -> 0 bytes res/drawable-xhdpi/drm_image.png | Bin 5014 -> 0 bytes res/layout/appwidget_drm_empty_item.xml | 48 ------------------ res/layout/appwidget_photo_item.xml | 8 --- res/menu/operation.xml | 5 -- res/menu/photo.xml | 5 -- src/com/android/gallery3d/app/AlbumPage.java | 7 --- src/com/android/gallery3d/app/MovieActivity.java | 11 ----- .../android/gallery3d/app/PhotoDataAdapter.java | 6 +-- src/com/android/gallery3d/app/PhotoPage.java | 50 ++----------------- src/com/android/gallery3d/app/SlideshowPage.java | 16 ++---- src/com/android/gallery3d/data/FilterTypeSet.java | 3 +- .../android/gallery3d/data/ImageCacheRequest.java | 21 -------- src/com/android/gallery3d/data/LocalImage.java | 55 ++++----------------- src/com/android/gallery3d/data/LocalVideo.java | 26 +--------- src/com/android/gallery3d/data/MediaObject.java | 3 -- src/com/android/gallery3d/data/UriImage.java | 40 ++------------- src/com/android/gallery3d/data/UriSource.java | 15 ------ .../android/gallery3d/gadget/WidgetService.java | 35 +------------ .../android/gallery3d/ui/AbstractSlotRenderer.java | 16 ------ .../android/gallery3d/ui/AlbumSetSlotRenderer.java | 1 + .../android/gallery3d/ui/AlbumSlotRenderer.java | 3 -- src/com/android/gallery3d/ui/MenuExecutor.java | 27 +--------- src/com/android/gallery3d/ui/PhotoView.java | 28 ----------- src/com/android/gallery3d/util/GIFView.java | 20 -------- .../codeaurora/gallery3d/ext/MovieListLoader.java | 11 ++--- 28 files changed, 33 insertions(+), 428 deletions(-) delete mode 100644 res/drawable-hdpi/drm_image.png delete mode 100644 res/drawable-mdpi/drm_image.png delete mode 100644 res/drawable-xhdpi/drm_image.png delete mode 100644 res/layout/appwidget_drm_empty_item.xml diff --git a/AndroidManifest.xml b/AndroidManifest.xml index be35585e2..937a46199 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -178,7 +178,6 @@ - diff --git a/res/drawable-hdpi/drm_image.png b/res/drawable-hdpi/drm_image.png deleted file mode 100644 index f51d615ee..000000000 Binary files a/res/drawable-hdpi/drm_image.png and /dev/null differ diff --git a/res/drawable-mdpi/drm_image.png b/res/drawable-mdpi/drm_image.png deleted file mode 100644 index dbbd7d8f0..000000000 Binary files a/res/drawable-mdpi/drm_image.png and /dev/null differ diff --git a/res/drawable-xhdpi/drm_image.png b/res/drawable-xhdpi/drm_image.png deleted file mode 100644 index ff2877691..000000000 Binary files a/res/drawable-xhdpi/drm_image.png and /dev/null differ diff --git a/res/layout/appwidget_drm_empty_item.xml b/res/layout/appwidget_drm_empty_item.xml deleted file mode 100644 index 8261dbe77..000000000 --- a/res/layout/appwidget_drm_empty_item.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - -s - \ No newline at end of file diff --git a/res/layout/appwidget_photo_item.xml b/res/layout/appwidget_photo_item.xml index 25e88f5fb..a56a6d7a5 100644 --- a/res/layout/appwidget_photo_item.xml +++ b/res/layout/appwidget_photo_item.xml @@ -24,12 +24,4 @@ android:layout_width="wrap_content" android:scaleType="fitCenter" android:adjustViewBounds="true" /> - - - diff --git a/res/menu/operation.xml b/res/menu/operation.xml index d6f954459..b915f39c5 100644 --- a/res/menu/operation.xml +++ b/res/menu/operation.xml @@ -70,9 +70,4 @@ android:title="@string/show_on_map" android:showAsAction="never" android:visible="false" /> - diff --git a/res/menu/photo.xml b/res/menu/photo.xml index 9cc375601..91bf0441f 100644 --- a/res/menu/photo.xml +++ b/res/menu/photo.xml @@ -78,9 +78,4 @@ - diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 629e88210..7e2f5f9e4 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -19,7 +19,6 @@ package com.android.gallery3d.app; import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.drm.DrmHelper; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; @@ -311,12 +310,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster if (isLayoutRtl && item == null) { return; // Item not ready yet, ignore the click } - if (DrmHelper.isDrmFile(DrmHelper.getFilePath( - mActivity.getAndroidContext(), item.getContentUri()))) { - Toast.makeText(mActivity, R.string.no_permission_for_drm, - Toast.LENGTH_SHORT).show(); - return; - } onGetContent(item); } else if (mLaunchedFromPhotoPage) { if (isLayoutRtl && item == null) { diff --git a/src/com/android/gallery3d/app/MovieActivity.java b/src/com/android/gallery3d/app/MovieActivity.java index f6fcaf87c..275b04ab3 100644 --- a/src/com/android/gallery3d/app/MovieActivity.java +++ b/src/com/android/gallery3d/app/MovieActivity.java @@ -35,7 +35,6 @@ import android.content.res.Configuration; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.database.Cursor; -import android.drm.DrmHelper; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.media.AudioManager; @@ -240,16 +239,6 @@ public class MovieActivity extends Activity { initEffects(mp.getAudioSessionId()); } }); - - // DRM validation - Uri original = intent.getData(); - String mimeType = intent.getType(); - String filepath = DrmHelper.getFilePath(this, original); - if (DrmHelper.isDrmFile(filepath)) { - if (!DrmHelper.validateLicense(this, filepath, mimeType)) { - finish(); - } - } } private void setActionBarLogoFromIntent(Intent intent) { diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java index 5812bf82d..4322d9b7a 100755 --- a/src/com/android/gallery3d/app/PhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java @@ -522,9 +522,9 @@ public class PhotoDataAdapter implements PhotoPage.Model { @Override public boolean isVideo(int offset) { MediaItem item = getItem(mCurrentIndex + offset); - return (item == null) ? false - : item.getMediaType() == MediaItem.MEDIA_TYPE_VIDEO - || item.getMediaType() == MediaItem.MEDIA_TYPE_DRM_VIDEO; + return (item == null) + ? false + : item.getMediaType() == MediaItem.MEDIA_TYPE_VIDEO; } @Override diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 65c26278a..dd27f2689 100755 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; -import android.drm.DrmHelper; import android.graphics.Rect; import android.media.MediaFile; import android.net.Uri; @@ -378,9 +377,8 @@ public abstract class PhotoPage extends ActivityState implements panoramaIntent = createSharePanoramaIntent(contentUri); } Intent shareIntent = createShareIntent(mCurrentPhoto); - if (shareIntent != null) { - mActionBar.setShareIntents(panoramaIntent, shareIntent, PhotoPage.this); - } + + mActionBar.setShareIntents(panoramaIntent, shareIntent, PhotoPage.this); setNfcBeamPushUri(contentUri); } break; @@ -685,7 +683,7 @@ public abstract class PhotoPage extends ActivityState implements mNfcPushUris[0] = uri; } - private Intent createShareIntent(MediaObject mediaObject) { + private static Intent createShareIntent(MediaObject mediaObject) { int type = mediaObject.getMediaType(); return new Intent(Intent.ACTION_SEND) .setType(MenuExecutor.getMimeType(type)) @@ -804,20 +802,6 @@ public abstract class PhotoPage extends ActivityState implements requestDeferredUpdate(); } else { updateUIForCurrentPhoto(); - - // Manage DRM rights while image selection changed. this - // flow will comes for both image and video, but here - // we will consume rights for image files only. - // Do not consume rights of a GIF image and video here. - // ViewGifImage will take care of GIF rights consumption stub. - // MediaPlayer will handle the video rights consumption stub. - String mime = mCurrentPhoto.getMimeType(); - if (!TextUtils.isEmpty(mime) && !mime.equals("image/gif") - && !mime.startsWith("video/")) { - DrmHelper.manageDrmLicense(mActivity.getAndroidContext(), - mHandler, mCurrentPhoto.getFilePath(), - mCurrentPhoto.getMimeType()); - } } } @@ -1173,12 +1157,6 @@ public abstract class PhotoPage extends ActivityState implements mSelectionManager.toggle(path); mMenuExecutor.onMenuClicked(item, confirmMsg, mConfirmDialogListener); return true; - case R.id.action_drm_info: - String filepath = current.getFilePath(); - if (DrmHelper.isDrmFile(filepath)) { - DrmHelper.showDrmInfo(mActivity.getAndroidContext(), filepath); - } - return true; default : return false; } @@ -1445,23 +1423,6 @@ public abstract class PhotoPage extends ActivityState implements UsageStatistics.onContentViewChanged( UsageStatistics.COMPONENT_CAMERA, "Unknown"); // TODO } - - // Manage DRM rights while image selection changed. this - // flow will comes for both image and video, but here - // we will consume rights for image files only. - // Do not consume rights of a GIF image and video here. - // ViewGifImage will take care of GIF rights consumption stub. - // MediaPlayer will handle the video rights consumption stub. - if ((mMediaSet != null && mMediaSet.getMediaItemCount() > 1) - || !(this instanceof SinglePhotoPage)) { - String mime = mCurrentPhoto.getMimeType(); - if (!TextUtils.isEmpty(mime) && !mime.equals("image/gif") - && !mime.startsWith("video/")) { - DrmHelper.manageDrmLicense(mActivity.getAndroidContext(), - mHandler, mCurrentPhoto.getFilePath(), - mCurrentPhoto.getMimeType()); - } - } } } @@ -1656,9 +1617,6 @@ public abstract class PhotoPage extends ActivityState implements private static void viewAnimateGif(Activity activity, Uri uri) { Intent intent = new Intent(ViewGifImage.VIEW_GIF_ACTION, uri); - if (DrmHelper.isDrmFile(uri.toString())) { - intent.setDataAndType(uri, "image/gif"); - } activity.startActivity(intent); } } diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java index 2b15ab96e..174058dc8 100644 --- a/src/com/android/gallery3d/app/SlideshowPage.java +++ b/src/com/android/gallery3d/app/SlideshowPage.java @@ -16,12 +16,8 @@ package com.android.gallery3d.app; -import java.util.ArrayList; -import java.util.Random; - import android.app.Activity; import android.content.Intent; -import android.drm.DrmHelper; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; @@ -42,6 +38,9 @@ import com.android.gallery3d.ui.SynchronizedHandler; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.FutureListener; +import java.util.ArrayList; +import java.util.Random; + public class SlideshowPage extends ActivityState { private static final String TAG = "SlideshowPage"; @@ -339,15 +338,6 @@ public class SlideshowPage extends ActivityState { mData = mMediaSet.getMediaItem(index, DATA_SIZE); mDataStart = index; dataEnd = index + mData.size(); - - // Consume license once in each element of the slide-show - // This is a non-blocking loop operation - for (int i = 0; i < mData.size(); i++) { - String path = mData.get(i).getFilePath(); - if (DrmHelper.isDrmFile(path)) { - DrmHelper.consumeDrmRights(path, "image/*"); - } - } } return (index < mDataStart || index >= dataEnd) ? null : mData.get(index - mDataStart); diff --git a/src/com/android/gallery3d/data/FilterTypeSet.java b/src/com/android/gallery3d/data/FilterTypeSet.java index e778ceb12..477ef73ad 100644 --- a/src/com/android/gallery3d/data/FilterTypeSet.java +++ b/src/com/android/gallery3d/data/FilterTypeSet.java @@ -102,8 +102,7 @@ public class FilterTypeSet extends MediaSet implements ContentListener { mBaseSet.enumerateMediaItems(new MediaSet.ItemConsumer() { @Override public void consume(int index, MediaItem item) { - if (item.getMediaType() == mMediaType - || item.getMediaType() == MediaObject.MEDIA_TYPE_DRM_IMAGE) { + if (item.getMediaType() == mMediaType) { if (index < 0 || index >= total) return; Path path = item.getPath(); buf[index] = path; diff --git a/src/com/android/gallery3d/data/ImageCacheRequest.java b/src/com/android/gallery3d/data/ImageCacheRequest.java index faca5d7d8..6cbc5c5ea 100644 --- a/src/com/android/gallery3d/data/ImageCacheRequest.java +++ b/src/com/android/gallery3d/data/ImageCacheRequest.java @@ -16,10 +16,8 @@ package com.android.gallery3d.data; -import android.drm.DrmHelper; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.text.TextUtils; import com.android.gallery3d.app.GalleryApp; import com.android.gallery3d.common.BitmapUtils; @@ -34,8 +32,6 @@ abstract class ImageCacheRequest implements Job { private Path mPath; private int mType; private int mTargetSize; - private String mFilePath; - private String mMimeType; private long mTimeModified; public ImageCacheRequest(GalleryApp application, @@ -47,14 +43,6 @@ abstract class ImageCacheRequest implements Job { mTimeModified = timeModified; } - public ImageCacheRequest(GalleryApp application, - Path path, long timeModified, int type, int targetSize, String filepath, String mimeType) { - this(application, path, timeModified, type, - targetSize); - mFilePath = filepath; - mMimeType = mimeType; - } - private String debugTag() { return mPath + "," + mTimeModified + "," + ((mType == MediaItem.TYPE_THUMBNAIL) ? "THUMB" : @@ -63,14 +51,6 @@ abstract class ImageCacheRequest implements Job { @Override public Bitmap run(JobContext jc) { - if (!TextUtils.isEmpty(mFilePath) && !TextUtils.isEmpty(mMimeType) - && !mMimeType.startsWith("video/")) { - if (DrmHelper.isDrmFile(mFilePath) - && mType != MediaItem.TYPE_MICROTHUMBNAIL) { - return onDecodeOriginal(jc, mType); - } - } - ImageCacheService cacheService = mApplication.getImageCacheService(); BytesBuffer buffer = MediaItem.getBytesBufferPool().get(); @@ -96,7 +76,6 @@ abstract class ImageCacheRequest implements Job { } finally { MediaItem.getBytesBufferPool().recycle(buffer); } - Bitmap bitmap = onDecodeOriginal(jc, mType); if (jc.isCancelled()) return null; diff --git a/src/com/android/gallery3d/data/LocalImage.java b/src/com/android/gallery3d/data/LocalImage.java index 1b0384548..2b01c1e22 100644 --- a/src/com/android/gallery3d/data/LocalImage.java +++ b/src/com/android/gallery3d/data/LocalImage.java @@ -20,7 +20,6 @@ import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.ContentValues; import android.database.Cursor; -import android.drm.DrmHelper; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.BitmapRegionDecoder; @@ -174,7 +173,7 @@ public class LocalImage extends LocalMediaItem { @Override public Job requestImage(int type) { return new LocalImageRequest(mApplication, mPath, dateModifiedInSec, - type, filePath, mimeType); + type, filePath); } public static class LocalImageRequest extends ImageCacheRequest { @@ -187,23 +186,10 @@ public class LocalImage extends LocalMediaItem { mLocalFilePath = localFilePath; } - LocalImageRequest(GalleryApp application, Path path, long timeModified, - int type, String localFilePath, String mimeType) { - super(application, path, timeModified, type, - MediaItem.getTargetSize(type),localFilePath, mimeType); - mLocalFilePath = localFilePath; - } - @Override public Bitmap onDecodeOriginal(JobContext jc, final int type) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; - - if (DrmHelper.isDrmFile(mLocalFilePath)) { - return DecodeUtils.ensureGLCompatibleBitmap(DrmHelper - .getBitmap(mLocalFilePath, options)); - } - int targetSize = MediaItem.getTargetSize(type); // try to decode from JPEG EXIF @@ -244,41 +230,24 @@ public class LocalImage extends LocalMediaItem { @Override public BitmapRegionDecoder run(JobContext jc) { - if (DrmHelper.isDrmFile(mLocalFilePath)) { - return DrmHelper.createBitmapRegionDecoder(mLocalFilePath, - false); - } - return DecodeUtils.createBitmapRegionDecoder(jc, mLocalFilePath, false); } } @Override public int getSupportedOperations() { - int operation = SUPPORT_DELETE | SUPPORT_INFO; - if (DrmHelper.isDrmFile(getFilePath())) { - if (DrmHelper.isDrmFLBlocking(mApplication.getAndroidContext(), - getFilePath())) { - operation |= SUPPORT_SETAS; - } - operation |= SUPPORT_DRM_INFO | SUPPORT_FULL_IMAGE; - if (DrmHelper.isShareableDrmFile(getFilePath())) { - operation |= SUPPORT_SHARE; - } - } else { - operation = SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_CROP + int operation = SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_CROP | SUPPORT_SETAS | SUPPORT_PRINT | SUPPORT_INFO; - if (BitmapUtils.isSupportedByRegionDecoder(mimeType)) { - operation |= SUPPORT_FULL_IMAGE | SUPPORT_EDIT; - } + if (BitmapUtils.isSupportedByRegionDecoder(mimeType)) { + operation |= SUPPORT_FULL_IMAGE | SUPPORT_EDIT; + } - if (BitmapUtils.isRotationSupported(mimeType)) { - operation |= SUPPORT_ROTATE; - } + if (BitmapUtils.isRotationSupported(mimeType)) { + operation |= SUPPORT_ROTATE; + } - if (GalleryUtils.isValidLocation(latitude, longitude)) { - operation |= SUPPORT_SHOW_ON_MAP; - } + if (GalleryUtils.isValidLocation(latitude, longitude)) { + operation |= SUPPORT_SHOW_ON_MAP; } return operation; } @@ -344,10 +313,6 @@ public class LocalImage extends LocalMediaItem { @Override public int getMediaType() { - if (DrmHelper.isDrmFile(getFilePath())) { - return MEDIA_TYPE_DRM_IMAGE; - } - return MEDIA_TYPE_IMAGE; } diff --git a/src/com/android/gallery3d/data/LocalVideo.java b/src/com/android/gallery3d/data/LocalVideo.java index 7fafe97ae..4b8774ca4 100644 --- a/src/com/android/gallery3d/data/LocalVideo.java +++ b/src/com/android/gallery3d/data/LocalVideo.java @@ -18,7 +18,6 @@ package com.android.gallery3d.data; import android.content.ContentResolver; import android.database.Cursor; -import android.drm.DrmHelper; import android.graphics.Bitmap; import android.graphics.BitmapRegionDecoder; import android.net.Uri; @@ -154,7 +153,7 @@ public class LocalVideo extends LocalMediaItem { @Override public Job requestImage(int type) { return new LocalVideoRequest(mApplication, getPath(), dateModifiedInSec, - type, filePath, mimeType); + type, filePath); } public static class LocalVideoRequest extends ImageCacheRequest { @@ -167,13 +166,6 @@ public class LocalVideo extends LocalMediaItem { mLocalFilePath = localFilePath; } - LocalVideoRequest(GalleryApp application, Path path, long timeModified, - int type, String localFilePath, String mimeType) { - super(application, path, timeModified, type, - MediaItem.getTargetSize(type), localFilePath, mimeType); - mLocalFilePath = localFilePath; - } - @Override public Bitmap onDecodeOriginal(JobContext jc, int type) { Bitmap bitmap = BitmapUtils.createVideoThumbnail(mLocalFilePath); @@ -190,17 +182,7 @@ public class LocalVideo extends LocalMediaItem { @Override public int getSupportedOperations() { - if (DrmHelper.isDrmFile(getFilePath())) { - int operation = SUPPORT_DELETE | SUPPORT_PLAY | SUPPORT_INFO - | SUPPORT_DRM_INFO; - if (DrmHelper.isShareableDrmFile(getFilePath())) { - operation |= SUPPORT_SHARE; - } - return operation; - } - - return SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_PLAY | SUPPORT_INFO - | SUPPORT_TRIM | SUPPORT_MUTE; + return SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_PLAY | SUPPORT_INFO | SUPPORT_TRIM | SUPPORT_MUTE; } @Override @@ -229,10 +211,6 @@ public class LocalVideo extends LocalMediaItem { @Override public int getMediaType() { - if (DrmHelper.isDrmFile(getFilePath())) { - return MEDIA_TYPE_DRM_VIDEO; - } - return MEDIA_TYPE_VIDEO; } diff --git a/src/com/android/gallery3d/data/MediaObject.java b/src/com/android/gallery3d/data/MediaObject.java index 6e3867647..530ee306e 100644 --- a/src/com/android/gallery3d/data/MediaObject.java +++ b/src/com/android/gallery3d/data/MediaObject.java @@ -42,15 +42,12 @@ public abstract class MediaObject { public static final int SUPPORT_CAMERA_SHORTCUT = 1 << 15; public static final int SUPPORT_MUTE = 1 << 16; public static final int SUPPORT_PRINT = 1 << 17; - public static final int SUPPORT_DRM_INFO = 1 << 18; public static final int SUPPORT_ALL = 0xffffffff; // These are the bits returned from getMediaType(): public static final int MEDIA_TYPE_UNKNOWN = 1; public static final int MEDIA_TYPE_IMAGE = 2; public static final int MEDIA_TYPE_VIDEO = 4; - public static final int MEDIA_TYPE_DRM_VIDEO = 5; - public static final int MEDIA_TYPE_DRM_IMAGE = 6; public static final int MEDIA_TYPE_ALL = MEDIA_TYPE_IMAGE | MEDIA_TYPE_VIDEO; public static final String MEDIA_TYPE_IMAGE_STRING = "image"; diff --git a/src/com/android/gallery3d/data/UriImage.java b/src/com/android/gallery3d/data/UriImage.java index 13176e4aa..b3fe1de03 100644 --- a/src/com/android/gallery3d/data/UriImage.java +++ b/src/com/android/gallery3d/data/UriImage.java @@ -17,7 +17,6 @@ package com.android.gallery3d.data; import android.content.ContentResolver; -import android.drm.DrmHelper; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory.Options; @@ -59,14 +58,12 @@ public class UriImage extends MediaItem { private PanoramaMetadataSupport mPanoramaMetadata = new PanoramaMetadataSupport(this); private GalleryApp mApplication; - private String mFilePath; public UriImage(GalleryApp application, Path path, Uri uri, String contentType) { super(path, nextVersionNumber()); mUri = uri; mApplication = Utils.checkNotNull(application); mContentType = contentType; - mFilePath = DrmHelper.getFilePath(mApplication.getAndroidContext(), uri); } @Override @@ -174,14 +171,6 @@ public class UriImage extends MediaItem { private class RegionDecoderJob implements Job { @Override public BitmapRegionDecoder run(JobContext jc) { - if (DrmHelper.isDrmFile(getFilePath())) { - BitmapRegionDecoder decoder = DrmHelper - .createBitmapRegionDecoder(getFilePath(), false); - mWidth = decoder.getWidth(); - mHeight = decoder.getHeight(); - return decoder; - } - if (!prepareInputFile(jc)) return null; BitmapRegionDecoder decoder = DecodeUtils.createBitmapRegionDecoder( jc, mFileDescriptor.getFileDescriptor(), false); @@ -200,10 +189,6 @@ public class UriImage extends MediaItem { @Override public Bitmap run(JobContext jc) { - if (DrmHelper.isDrmFile(getFilePath())) { - return DecodeUtils.ensureGLCompatibleBitmap(DrmHelper.getBitmap(getFilePath())); - } - if (!prepareInputFile(jc)) return null; int targetSize = MediaItem.getTargetSize(mType); Options options = new Options(); @@ -226,18 +211,10 @@ public class UriImage extends MediaItem { @Override public int getSupportedOperations() { - int supported = 0; - if (DrmHelper.isDrmFile(getFilePath())) { - supported |= SUPPORT_DRM_INFO | SUPPORT_FULL_IMAGE; - if (DrmHelper.isShareableDrmFile(getFilePath())) { - supported |= SUPPORT_SHARE; - } - } else { - supported = SUPPORT_PRINT | SUPPORT_SETAS; - if (isSharable()) supported |= SUPPORT_SHARE; - if (BitmapUtils.isSupportedByRegionDecoder(mContentType)) { - supported |= SUPPORT_EDIT | SUPPORT_FULL_IMAGE; - } + int supported = SUPPORT_PRINT | SUPPORT_SETAS; + if (isSharable()) supported |= SUPPORT_SHARE; + if (BitmapUtils.isSupportedByRegionDecoder(mContentType)) { + supported |= SUPPORT_EDIT | SUPPORT_FULL_IMAGE; } return supported; } @@ -262,10 +239,6 @@ public class UriImage extends MediaItem { @Override public int getMediaType() { - if (DrmHelper.isDrmFile(getFilePath())) { - return MEDIA_TYPE_DRM_IMAGE; - } - return MEDIA_TYPE_IMAGE; } @@ -322,9 +295,4 @@ public class UriImage extends MediaItem { public int getRotation() { return mRotation; } - - @Override - public String getFilePath() { - return mFilePath; - } } diff --git a/src/com/android/gallery3d/data/UriSource.java b/src/com/android/gallery3d/data/UriSource.java index b4bb16072..f66bacd7b 100644 --- a/src/com/android/gallery3d/data/UriSource.java +++ b/src/com/android/gallery3d/data/UriSource.java @@ -17,9 +17,7 @@ package com.android.gallery3d.data; import android.content.ContentResolver; -import android.drm.DrmHelper; import android.net.Uri; -import android.text.TextUtils; import android.webkit.MimeTypeMap; import com.android.gallery3d.app.GalleryApp; @@ -75,19 +73,6 @@ class UriSource extends MediaSource { @Override public Path findPathByUri(Uri uri, String type) { String mimeType = getMimeType(uri); - if (DrmHelper.isDrmMimeType(mimeType)) { - String path = DrmHelper.getFilePath( - mApplication.getAndroidContext(), uri); - if (!TextUtils.isEmpty(path)) { - try { - return Path.fromString("/uri/" - + URLEncoder.encode(path, CHARSET_UTF_8) + "/" - + URLEncoder.encode(type, CHARSET_UTF_8)); - } catch (UnsupportedEncodingException e) { - throw new AssertionError(e); - } - } - } // Try to find a most specific type but it has to be started with "image/" if ((type == null) || (IMAGE_TYPE_ANY.equals(type) diff --git a/src/com/android/gallery3d/gadget/WidgetService.java b/src/com/android/gallery3d/gadget/WidgetService.java index 7b16f8b7c..854433776 100644 --- a/src/com/android/gallery3d/gadget/WidgetService.java +++ b/src/com/android/gallery3d/gadget/WidgetService.java @@ -19,10 +19,8 @@ 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; @@ -123,31 +121,7 @@ public class WidgetService extends RemoteViewsService { return null; } Bitmap bitmap = mSource.getImage(position); - - 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(); - } - } - + if (bitmap == null) return getLoadingView(); RemoteViews views = new RemoteViews( mApp.getAndroidContext().getPackageName(), R.layout.appwidget_photo_item); @@ -155,13 +129,6 @@ 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; } diff --git a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java index 63bcbea5d..729439dc3 100644 --- a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java @@ -20,7 +20,6 @@ import android.content.Context; import android.graphics.Rect; import com.android.gallery3d.R; -import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.glrenderer.FadeOutTexture; import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.glrenderer.NinePatchTexture; @@ -34,7 +33,6 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer { private final ResourceTexture mPanoramaIcon; private final NinePatchTexture mFramePressed; private final NinePatchTexture mFrameSelected; - private final ResourceTexture mDrmIcon; private FadeOutTexture mFramePressedUp; protected AbstractSlotRenderer(Context context) { @@ -43,7 +41,6 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer { mPanoramaIcon = new ResourceTexture(context, R.drawable.ic_360pano_holo_light); mFramePressed = new NinePatchTexture(context, R.drawable.grid_pressed); mFrameSelected = new NinePatchTexture(context, R.drawable.grid_selected); - mDrmIcon = new ResourceTexture(context, R.drawable.drm_image); } protected void drawContent(GLCanvas canvas, @@ -82,19 +79,6 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer { mVideoPlayIcon.draw(canvas, (width - s) / 2, (height - s) / 2, s, s); } - protected void drawDrmOverlay(GLCanvas canvas, int width, int height, int Drm_mediaType) { - // Scale the video overlay to the height of the thumbnail and put it on the left side. - if (Drm_mediaType == MediaObject.MEDIA_TYPE_DRM_VIDEO) { - ResourceTexture v = mVideoOverlay; - float scale = (float) height / v.getHeight(); - int w = Math.round(scale * v.getWidth()); - int h = Math.round(scale * v.getHeight()); - v.draw(canvas, 0, 0, w, h); - } - int side = Math.min(width, height) / 6; - mDrmIcon.draw(canvas, (width - side) / 2, (height - side) / 2, side, side); - } - protected void drawPanoramaIcon(GLCanvas canvas, int width, int height) { int iconSize = Math.min(width, height) / 6; mPanoramaIcon.draw(canvas, (width - iconSize) / 2, (height - iconSize) / 2, diff --git a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java index 46daf1451..5332ef89a 100644 --- a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java @@ -183,6 +183,7 @@ public class AlbumSetSlotRenderer extends AbstractSlotRenderer { ((FadeInTexture) content).isAnimating()) { renderRequestFlags |= SlotView.RENDER_MORE_FRAME; } + return renderRequestFlags; } diff --git a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java index 7f97693e3..dc6c89b0e 100644 --- a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java @@ -125,9 +125,6 @@ public class AlbumSlotRenderer extends AbstractSlotRenderer { if (entry.mediaType == MediaObject.MEDIA_TYPE_VIDEO) { drawVideoOverlay(canvas, width, height); - } else if ((entry.mediaType == MediaObject.MEDIA_TYPE_DRM_VIDEO) - || (entry.mediaType == MediaObject.MEDIA_TYPE_DRM_IMAGE)) { - drawDrmOverlay(canvas, width, height, entry.mediaType); } if (entry.isPanorama) { diff --git a/src/com/android/gallery3d/ui/MenuExecutor.java b/src/com/android/gallery3d/ui/MenuExecutor.java index 9b2c3259c..1ace71829 100644 --- a/src/com/android/gallery3d/ui/MenuExecutor.java +++ b/src/com/android/gallery3d/ui/MenuExecutor.java @@ -24,8 +24,6 @@ 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; @@ -181,7 +179,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); @@ -197,7 +195,6 @@ 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, @@ -257,14 +254,6 @@ 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))); @@ -282,20 +271,6 @@ 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; } diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index 265a53fc7..347d4b3af 100755 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -18,7 +18,6 @@ package com.android.gallery3d.ui; import android.content.Context; import android.content.res.Configuration; -import android.drm.DrmHelper; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Rect; @@ -204,7 +203,6 @@ public class PhotoView extends GLView { private EdgeView mEdgeView; private UndoBarView mUndoBar; private Texture mVideoPlayIcon; - private Texture mDrmIcon; private SynchronizedHandler mHandler; @@ -308,7 +306,6 @@ public class PhotoView extends GLView { } }); mVideoPlayIcon = new ResourceTexture(mContext, R.drawable.ic_control_play); - mDrmIcon = new ResourceTexture(mContext, R.drawable.drm_image); for (int i = -SCREEN_NAIL_MAX; i <= SCREEN_NAIL_MAX; i++) { if (i == 0) { mPictures.put(i, new FullPicture()); @@ -743,15 +740,6 @@ public class PhotoView extends GLView { drawLoadingFailMessage(canvas); } - if (getFilmMode()) { - MediaItem item = mModel.getMediaItem(0); - if (item != null) { - if (DrmHelper.isDrmFile(item.getFilePath())) { - drawDrmIcon(canvas, s); - } - } - } - // Draw a debug indicator showing which picture has focus (index == // 0). //canvas.fillRect(-10, -10, 20, 20, 0x80FF00FF); @@ -869,18 +857,9 @@ public class PhotoView extends GLView { if (mModel.isVideo(mIndex) || mModel.isGif(mIndex)) { drawVideoPlayIcon(canvas, s); } - if (mLoadingState == Model.LOADING_FAIL ) { drawLoadingFailMessage(canvas); } - - MediaItem item = mModel.getMediaItem(mIndex); - if (item != null) { - if (DrmHelper.isDrmFile(item.getFilePath())) { - drawDrmIcon(canvas, s); - } - } - canvas.restore(); } @@ -947,13 +926,6 @@ public class PhotoView extends GLView { mVideoPlayIcon.draw(canvas, -s / 2, -s / 2, s, s); } - // Draw the Drm lock icon (in the place where the spinner was) - private void drawDrmIcon(GLCanvas canvas, int side) { - int s = side / ICON_RATIO; - // Draw the Drm lock icon at the center - mDrmIcon.draw(canvas, -s / 2, -s / 2, s, s); - } - // Draw the "no thumbnail" message private void drawLoadingFailMessage(GLCanvas canvas) { StringTexture m = mNoThumbnailText; diff --git a/src/com/android/gallery3d/util/GIFView.java b/src/com/android/gallery3d/util/GIFView.java index c80625b41..86003fb31 100755 --- a/src/com/android/gallery3d/util/GIFView.java +++ b/src/com/android/gallery3d/util/GIFView.java @@ -6,7 +6,6 @@ import android.content.Context; import android.content.ContentResolver; import android.content.res.AssetManager; import android.database.Cursor; -import android.drm.DrmHelper; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; @@ -46,19 +45,6 @@ public class GIFView extends ImageView implements GifAction { } mUri = uri; - // Let decode the GIF image from byte stream instead of file stream - String filepath = DrmHelper.getFilePath(mContext, mUri); - if (DrmHelper.isDrmFile(filepath)) { - byte[] bytes = DrmHelper.getDrmImageBytes(filepath); - DrmHelper.manageDrmLicense(mContext, this.getHandler(), filepath, - "image/gif"); - if (bytes == null) { - return false; - } - startDecode(bytes); - return true; - } - InputStream is = getInputStream(uri); if (is == null || (getFileSize (is) == 0)) { return false; @@ -106,12 +92,6 @@ public class GIFView extends ImageView implements GifAction { mGifDecoder.start(); } - private void startDecode(byte[] bytes) { - freeGifDecoder(); - mGifDecoder = new GifDecoder(bytes, this); - mGifDecoder.start(); - } - protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mGifDecoder == null) { diff --git a/src/org/codeaurora/gallery3d/ext/MovieListLoader.java b/src/org/codeaurora/gallery3d/ext/MovieListLoader.java index 237d7e138..60f0392de 100644 --- a/src/org/codeaurora/gallery3d/ext/MovieListLoader.java +++ b/src/org/codeaurora/gallery3d/ext/MovieListLoader.java @@ -172,14 +172,9 @@ public class MovieListLoader implements IMovieListLoader { } cursor.close(); } - try { - long curId = Long.parseLong(uri.getPathSegments().get(3)); - movieList = fillUriList(MediaStore.Video.Media.BUCKET_ID + "=? ", - new String[]{String.valueOf(bucketId)}, curId, params[0]); - } catch (Exception e) { - Log.e(TAG, "Exception while creating movie list. " + e); - return null; - } + long curId = Long.parseLong(uri.getPathSegments().get(3)); + movieList = fillUriList(MediaStore.Video.Media.BUCKET_ID + "=? ", + new String[]{String.valueOf(bucketId)}, curId, params[0]); } else if (uristr.toLowerCase().startsWith("file://")) { String data = Uri.decode(uri.toString()); data = data.replaceAll("'", "''"); -- cgit v1.2.3