summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2019-12-06 14:44:18 -0700
committerJeff Sharkey <jsharkey@android.com>2019-12-06 14:44:21 -0700
commit530deca4be5a7ca0ca911cb8da0b653e25e99910 (patch)
tree4001fd341bfbc76db711be0dd9066fe0a9ea6f63
parent1403ee3ad54833761da7ea5f72ffef70fa340c88 (diff)
More robust DRM support, including tests.
Based on guidance from the DRM team, we should pass DRM files directly to MediaMetadataRetriever, which can be used to obtain both the underlying MIME type and the typical metadata to be indexed. To help ensure this works correctly and doesn't regress, borrow strategy from CTS which creates new Forward Locked media items for testing, and verify that we scan them correctly. Allow MediaMetadataRetriever to override the MIME type obtained from a file extension, but only when the primary type agrees with the extension. This is the same policy we apply to XMP metadata. Bug: 141146658 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I494a539a81ed39411a3b59c4433b6520967962c2
-rw-r--r--api/current.txt1
-rw-r--r--drm/java/android/drm/DrmManagerClient.java14
2 files changed, 15 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 884bc5aa73a8..80e0edd04d90 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -13439,6 +13439,7 @@ package android.drm {
method public android.drm.DrmConvertedStatus closeConvertSession(int);
method public android.drm.DrmConvertedStatus convertData(int, byte[]);
method public String[] getAvailableDrmEngines();
+ method @NonNull public java.util.Collection<android.drm.DrmSupportInfo> getAvailableDrmSupportInfo();
method public android.content.ContentValues getConstraints(String, int);
method public android.content.ContentValues getConstraints(android.net.Uri, int);
method public int getDrmObjectType(String, String);
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index fcebad339f2b..041300c4b1b0 100644
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -16,6 +16,7 @@
package android.drm;
+import android.annotation.NonNull;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -37,6 +38,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -370,6 +373,17 @@ public class DrmManagerClient implements AutoCloseable {
}
/**
+ * Retrieves information about all the DRM plug-ins (agents) that are
+ * registered with the DRM framework.
+ *
+ * @return List of all the DRM plug-ins (agents) that are registered with
+ * the DRM framework.
+ */
+ public @NonNull Collection<DrmSupportInfo> getAvailableDrmSupportInfo() {
+ return Arrays.asList(_getAllSupportInfo(mUniqueId));
+ }
+
+ /**
* Retrieves constraint information for rights-protected content.
*
* @param path Path to the content from which you are retrieving DRM constraints.