am 2efb6cb7: am 76cf8fe7: Merge "Add ability to test supported content types to MediaDrm" into klp-dev

* commit '2efb6cb7397b6a2ac634d091f20b3466411f103c':
  Add ability to test supported content types to MediaDrm
This commit is contained in:
Jeff Tinker
2013-08-22 16:17:16 -07:00
committed by Android Git Automerger
4 changed files with 27 additions and 8 deletions

View File

@@ -12535,6 +12535,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;

View File

@@ -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

View File

@@ -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",

View File

@@ -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]);