summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2013-05-22 12:16:00 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-22 12:16:00 -0700
commit63c7f94c48450283b6041f23b7a9d99214aa8eab (patch)
tree8823951203753281d86a518ac15108b62b50a5e4 /media
parenta66c2f10d5f4d553ba45876d013d8637320f3192 (diff)
parent09d6ad37f790f1e135c4dbe71109b33ae29a94cc (diff)
downloadframeworks_base-63c7f94c48450283b6041f23b7a9d99214aa8eab.zip
frameworks_base-63c7f94c48450283b6041f23b7a9d99214aa8eab.tar.gz
frameworks_base-63c7f94c48450283b6041f23b7a9d99214aa8eab.tar.bz2
am 09d6ad37: am 2161b7cb: Merge "Fix invalid keyType translation in MediaDrm.getKeyRequest" into jb-mr2-dev
* commit '09d6ad37f790f1e135c4dbe71109b33ae29a94cc': Fix invalid keyType translation in MediaDrm.getKeyRequest
Diffstat (limited to 'media')
-rw-r--r--media/jni/android_media_MediaDrm.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp
index ec88949..4dcafc7 100644
--- a/media/jni/android_media_MediaDrm.cpp
+++ b/media/jni/android_media_MediaDrm.cpp
@@ -87,12 +87,18 @@ struct EntryFields {
};
struct EventTypes {
- int kEventProvisionRequired;
- int kEventKeyRequired;
- int kEventKeyExpired;
- int kEventVendorDefined;
+ jint kEventProvisionRequired;
+ jint kEventKeyRequired;
+ jint kEventKeyExpired;
+ jint kEventVendorDefined;
} gEventTypes;
+struct KeyTypes {
+ jint kKeyTypeStreaming;
+ jint kKeyTypeOffline;
+ jint kKeyTypeRelease;
+} gKeyTypes;
+
struct fields_t {
jfieldID context;
jmethodID post_event;
@@ -521,6 +527,13 @@ static void android_media_MediaDrm_native_init(JNIEnv *env) {
GET_STATIC_FIELD_ID(field, clazz, "EVENT_VENDOR_DEFINED", "I");
gEventTypes.kEventVendorDefined = env->GetStaticIntField(clazz, field);
+ GET_STATIC_FIELD_ID(field, clazz, "KEY_TYPE_STREAMING", "I");
+ gKeyTypes.kKeyTypeStreaming = env->GetStaticIntField(clazz, field);
+ GET_STATIC_FIELD_ID(field, clazz, "KEY_TYPE_OFFLINE", "I");
+ gKeyTypes.kKeyTypeOffline = env->GetStaticIntField(clazz, field);
+ GET_STATIC_FIELD_ID(field, clazz, "KEY_TYPE_RELEASE", "I");
+ gKeyTypes.kKeyTypeRelease = env->GetStaticIntField(clazz, field);
+
FIND_CLASS(clazz, "android/media/MediaDrm$KeyRequest");
GET_FIELD_ID(gFields.keyRequest.data, clazz, "mData", "[B");
GET_FIELD_ID(gFields.keyRequest.defaultUrl, clazz, "mDefaultUrl", "Ljava/lang/String;");
@@ -666,7 +679,18 @@ static jobject android_media_MediaDrm_getKeyRequest(
mimeType = JStringToString8(env, jmimeType);
}
- DrmPlugin::KeyType keyType = (DrmPlugin::KeyType)jkeyType;
+ DrmPlugin::KeyType keyType;
+ if (jkeyType == gKeyTypes.kKeyTypeStreaming) {
+ keyType = DrmPlugin::kKeyType_Streaming;
+ } else if (jkeyType == gKeyTypes.kKeyTypeOffline) {
+ keyType = DrmPlugin::kKeyType_Offline;
+ } else if (jkeyType == gKeyTypes.kKeyTypeRelease) {
+ keyType = DrmPlugin::kKeyType_Release;
+ } else {
+ jniThrowException(env, "java/lang/IllegalArgumentException",
+ "invalid keyType");
+ return NULL;
+ }
KeyedVector<String8, String8> optParams;
if (joptParams != NULL) {