am 76cf8fe7: Merge "Add ability to test supported content types to MediaDrm" into klp-dev
* commit '76cf8fe75e7c1abce9383fb915842f62228a1d91': Add ability to test supported content types to MediaDrm
This commit is contained in:
@@ -12524,6 +12524,7 @@ package android.media {
|
|||||||
method public android.media.MediaDrm.ProvisionRequest getProvisionRequest();
|
method public android.media.MediaDrm.ProvisionRequest getProvisionRequest();
|
||||||
method public java.util.List<byte[]> getSecureStops();
|
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);
|
||||||
|
method public static final boolean isCryptoSchemeSupported(java.util.UUID, java.lang.String);
|
||||||
method public byte[] openSession() throws android.media.NotProvisionedException;
|
method public byte[] openSession() throws android.media.NotProvisionedException;
|
||||||
method public byte[] provideKeyResponse(byte[], byte[]) throws android.media.DeniedByServerException, 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;
|
method public void provideProvisionResponse(byte[]) throws android.media.DeniedByServerException;
|
||||||
|
|||||||
@@ -108,7 +108,19 @@ public final class MediaDrm {
|
|||||||
* @param uuid The UUID of the crypto scheme.
|
* @param uuid The UUID of the crypto scheme.
|
||||||
*/
|
*/
|
||||||
public static final boolean isCryptoSchemeSupported(UUID uuid) {
|
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) {
|
private static final byte[] getByteArrayFromUUID(UUID uuid) {
|
||||||
@@ -124,7 +136,8 @@ public final class MediaDrm {
|
|||||||
return uuidBytes;
|
return uuidBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final native boolean isCryptoSchemeSupportedNative(byte[] uuid);
|
private static final native boolean isCryptoSchemeSupportedNative(byte[] uuid,
|
||||||
|
String mimeType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a MediaDrm object
|
* Instantiate a MediaDrm object
|
||||||
|
|||||||
@@ -348,14 +348,14 @@ void JDrm::notify(DrmPlugin::EventType eventType, int extra, const Parcel *obj)
|
|||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool JDrm::IsCryptoSchemeSupported(const uint8_t uuid[16]) {
|
bool JDrm::IsCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType) {
|
||||||
sp<IDrm> drm = MakeDrm();
|
sp<IDrm> drm = MakeDrm();
|
||||||
|
|
||||||
if (drm == NULL) {
|
if (drm == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return drm->isCryptoSchemeSupported(uuid);
|
return drm->isCryptoSchemeSupported(uuid, mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t JDrm::initCheck() const {
|
status_t JDrm::initCheck() const {
|
||||||
@@ -611,7 +611,7 @@ static void android_media_MediaDrm_native_finalize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jboolean android_media_MediaDrm_isCryptoSchemeSupportedNative(
|
static jboolean android_media_MediaDrm_isCryptoSchemeSupportedNative(
|
||||||
JNIEnv *env, jobject thiz, jbyteArray uuidObj) {
|
JNIEnv *env, jobject thiz, jbyteArray uuidObj, jstring jmimeType) {
|
||||||
|
|
||||||
if (uuidObj == NULL) {
|
if (uuidObj == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
@@ -628,7 +628,12 @@ static jboolean android_media_MediaDrm_isCryptoSchemeSupportedNative(
|
|||||||
return false;
|
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(
|
static jbyteArray android_media_MediaDrm_openSession(
|
||||||
@@ -1212,7 +1217,7 @@ static JNINativeMethod gMethods[] = {
|
|||||||
{ "native_finalize", "()V",
|
{ "native_finalize", "()V",
|
||||||
(void *)android_media_MediaDrm_native_finalize },
|
(void *)android_media_MediaDrm_native_finalize },
|
||||||
|
|
||||||
{ "isCryptoSchemeSupportedNative", "([B)Z",
|
{ "isCryptoSchemeSupportedNative", "([BLjava/lang/String;)Z",
|
||||||
(void *)android_media_MediaDrm_isCryptoSchemeSupportedNative },
|
(void *)android_media_MediaDrm_isCryptoSchemeSupportedNative },
|
||||||
|
|
||||||
{ "openSession", "()[B",
|
{ "openSession", "()[B",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct JDrm : public BnDrmClient {
|
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]);
|
JDrm(JNIEnv *env, jobject thiz, const uint8_t uuid[16]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user