summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2013-08-22 23:08:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-22 23:08:07 +0000
commit76cf8fe75e7c1abce9383fb915842f62228a1d91 (patch)
tree4de940fe8c1f72c6a20e2d90fca7e094e27e8641
parentf293627fc2858d8a569b28e8da80047848c961dc (diff)
parent7cda491321b9bd2e8faf956824312ea6a30e6457 (diff)
downloadframeworks_base-76cf8fe75e7c1abce9383fb915842f62228a1d91.zip
frameworks_base-76cf8fe75e7c1abce9383fb915842f62228a1d91.tar.gz
frameworks_base-76cf8fe75e7c1abce9383fb915842f62228a1d91.tar.bz2
Merge "Add ability to test supported content types to MediaDrm" into klp-dev
-rw-r--r--api/current.txt1
-rw-r--r--media/java/android/media/MediaDrm.java17
-rw-r--r--media/jni/android_media_MediaDrm.cpp15
-rw-r--r--media/jni/android_media_MediaDrm.h2
4 files changed, 27 insertions, 8 deletions
diff --git a/api/current.txt b/api/current.txt
index ed3a2e5..dc081ac 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12524,6 +12524,7 @@ package android.media {
method public android.media.MediaDrm.ProvisionRequest getProvisionRequest();
method public java.util.List<byte[]> getSecureStops();
method public static final boolean isCryptoSchemeSupported(java.util.UUID);
+ method public static final boolean isCryptoSchemeSupported(java.util.UUID, java.lang.String);
method public byte[] openSession() throws android.media.NotProvisionedException;
method public byte[] provideKeyResponse(byte[], byte[]) throws android.media.DeniedByServerException, android.media.NotProvisionedException;
method public void provideProvisionResponse(byte[]) throws android.media.DeniedByServerException;
diff --git a/media/java/android/media/MediaDrm.java b/media/java/android/media/MediaDrm.java
index cd97ad9..6b278d4 100644
--- a/media/java/android/media/MediaDrm.java
+++ b/media/java/android/media/MediaDrm.java
@@ -108,7 +108,19 @@ public final class MediaDrm {
* @param uuid The UUID of the crypto scheme.
*/
public static final boolean isCryptoSchemeSupported(UUID uuid) {
- return isCryptoSchemeSupportedNative(getByteArrayFromUUID(uuid));
+ return isCryptoSchemeSupportedNative(getByteArrayFromUUID(uuid), null);
+ }
+
+ /**
+ * Query if the given scheme identified by its UUID is supported on
+ * this device, and whether the drm plugin is able to handle the
+ * media container format specified by mimeType.
+ * @param uuid The UUID of the crypto scheme.
+ * @param mimeType The MIME type of the media container, e.g. "video/mp4"
+ * or "video/webm"
+ */
+ public static final boolean isCryptoSchemeSupported(UUID uuid, String mimeType) {
+ return isCryptoSchemeSupportedNative(getByteArrayFromUUID(uuid), mimeType);
}
private static final byte[] getByteArrayFromUUID(UUID uuid) {
@@ -124,7 +136,8 @@ public final class MediaDrm {
return uuidBytes;
}
- private static final native boolean isCryptoSchemeSupportedNative(byte[] uuid);
+ private static final native boolean isCryptoSchemeSupportedNative(byte[] uuid,
+ String mimeType);
/**
* Instantiate a MediaDrm object
diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp
index 60142cd..666d111 100644
--- a/media/jni/android_media_MediaDrm.cpp
+++ b/media/jni/android_media_MediaDrm.cpp
@@ -348,14 +348,14 @@ void JDrm::notify(DrmPlugin::EventType eventType, int extra, const Parcel *obj)
// static
-bool JDrm::IsCryptoSchemeSupported(const uint8_t uuid[16]) {
+bool JDrm::IsCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType) {
sp<IDrm> drm = MakeDrm();
if (drm == NULL) {
return false;
}
- return drm->isCryptoSchemeSupported(uuid);
+ return drm->isCryptoSchemeSupported(uuid, mimeType);
}
status_t JDrm::initCheck() const {
@@ -611,7 +611,7 @@ static void android_media_MediaDrm_native_finalize(
}
static jboolean android_media_MediaDrm_isCryptoSchemeSupportedNative(
- JNIEnv *env, jobject thiz, jbyteArray uuidObj) {
+ JNIEnv *env, jobject thiz, jbyteArray uuidObj, jstring jmimeType) {
if (uuidObj == NULL) {
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
@@ -628,7 +628,12 @@ static jboolean android_media_MediaDrm_isCryptoSchemeSupportedNative(
return false;
}
- return JDrm::IsCryptoSchemeSupported(uuid.array());
+ String8 mimeType;
+ if (jmimeType != NULL) {
+ mimeType = JStringToString8(env, jmimeType);
+ }
+
+ return JDrm::IsCryptoSchemeSupported(uuid.array(), mimeType);
}
static jbyteArray android_media_MediaDrm_openSession(
@@ -1212,7 +1217,7 @@ static JNINativeMethod gMethods[] = {
{ "native_finalize", "()V",
(void *)android_media_MediaDrm_native_finalize },
- { "isCryptoSchemeSupportedNative", "([B)Z",
+ { "isCryptoSchemeSupportedNative", "([BLjava/lang/String;)Z",
(void *)android_media_MediaDrm_isCryptoSchemeSupportedNative },
{ "openSession", "()[B",
diff --git a/media/jni/android_media_MediaDrm.h b/media/jni/android_media_MediaDrm.h
index 9b3917f..620ad28 100644
--- a/media/jni/android_media_MediaDrm.h
+++ b/media/jni/android_media_MediaDrm.h
@@ -37,7 +37,7 @@ public:
};
struct JDrm : public BnDrmClient {
- static bool IsCryptoSchemeSupported(const uint8_t uuid[16]);
+ static bool IsCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType);
JDrm(JNIEnv *env, jobject thiz, const uint8_t uuid[16]);