diff options
author | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-10-08 23:05:49 +0900 |
---|---|---|
committer | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-11-02 08:06:06 +0900 |
commit | c7b3ccc564448cb4b918728421f9402bc18278c5 (patch) | |
tree | 7d97c647cef5ae086048f62636bad3343f193459 /drm/jni | |
parent | 5b4d0e84d314bd58efb9dcf4e7f23f0d0e3fc630 (diff) | |
download | frameworks_base-c7b3ccc564448cb4b918728421f9402bc18278c5.zip frameworks_base-c7b3ccc564448cb4b918728421f9402bc18278c5.tar.gz frameworks_base-c7b3ccc564448cb4b918728421f9402bc18278c5.tar.bz2 |
Update of DRM framework
- Overload openDecryptSession() with uri parameter
in order to accept URI of DRM content,
Following API is added,
DecryptHandle*openDecryptSession(const char* uri);.
- Unify texisting three event types of processDrmInfo()
so that caller of DRM framework does not have to handle many event types.
- Let DrmManagerService call load/unload plugins API so that
client of DRM framework does not have to manage plug-in load/unload.
- Trivial fix in DrmManagerClient.java is also incorporated.
Changes are made by Sony Corporation.
Change-Id: If62b47fa0360718fdc943e6e6143671d7db26adc
Diffstat (limited to 'drm/jni')
-rw-r--r-- | drm/jni/android_drm_DrmManagerClient.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/drm/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp index 6158b66..e5e4547 100644 --- a/drm/jni/android_drm_DrmManagerClient.cpp +++ b/drm/jni/android_drm_DrmManagerClient.cpp @@ -15,7 +15,7 @@ */ //#define LOG_NDEBUG 0 -#define LOG_TAG "DrmManager-JNI" +#define LOG_TAG "android_drm_DrmManagerClient" #include <utils/Log.h> #include <jni.h> @@ -223,38 +223,32 @@ static sp<DrmManagerClientImpl> getDrmManagerClientImpl(JNIEnv* env, jobject thi return sp<DrmManagerClientImpl>(client); } -static jint android_drm_DrmManagerClient_loadPlugIns( +static void android_drm_DrmManagerClient_initialize( JNIEnv* env, jobject thiz, jint uniqueId, jobject weak_thiz) { - LOGV("load plugins - Enter"); + LOGV("initialize - Enter"); sp<DrmManagerClientImpl> drmManager = DrmManagerClientImpl::create(&uniqueId); + drmManager->addClient(uniqueId); // Set the listener to DrmManager sp<DrmManagerClient::OnInfoListener> listener = new JNIOnInfoListener(env, thiz, weak_thiz); drmManager->setOnInfoListener(uniqueId, listener); setDrmManagerClientImpl(env, thiz, drmManager); - - LOGV("load plugins - Exit"); - return getDrmManagerClientImpl(env, thiz)->loadPlugIns(uniqueId); + LOGV("initialize - Exit"); } -static jint android_drm_DrmManagerClient_unloadPlugIns(JNIEnv* env, jobject thiz, jint uniqueId) { - LOGV("unload plugins - Enter"); - sp<DrmManagerClientImpl> client = getDrmManagerClientImpl(env, thiz); - +static void android_drm_DrmManagerClient_finalize(JNIEnv* env, jobject thiz, jint uniqueId) { + LOGV("finalize - Enter"); DrmManagerClientImpl::remove(uniqueId); - int result = client->unloadPlugIns(uniqueId); - if (DRM_NO_ERROR == result) { - client->setOnInfoListener(uniqueId, NULL); + getDrmManagerClientImpl(env, thiz)->setOnInfoListener(uniqueId, NULL); - sp<DrmManagerClientImpl> oldClient = setDrmManagerClientImpl(env, thiz, NULL); - if (oldClient != NULL) { - oldClient->setOnInfoListener(uniqueId, NULL); - } + sp<DrmManagerClientImpl> oldClient = setDrmManagerClientImpl(env, thiz, NULL); + if (oldClient != NULL) { + oldClient->setOnInfoListener(uniqueId, NULL); + oldClient->removeClient(uniqueId); } - LOGV("unload plugins - Exit"); - return result; + LOGV("finalize - Exit"); } static jobject android_drm_DrmManagerClient_getConstraintsFromContent( @@ -441,6 +435,7 @@ static jobject android_drm_DrmManagerClient_processDrmInfo( if (NULL != localRef && NULL != pDrmInfoStatus) { int statusCode = pDrmInfoStatus->statusCode; + int infoType = pDrmInfoStatus->infoType; jbyteArray dataArray = NULL; if (NULL != pDrmInfoStatus->drmBuffer) { @@ -461,10 +456,10 @@ static jobject android_drm_DrmManagerClient_processDrmInfo( constructorId = env->GetMethodID(localRef, - "<init>", "(ILandroid/drm/ProcessedData;Ljava/lang/String;)V"); + "<init>", "(IILandroid/drm/ProcessedData;Ljava/lang/String;)V"); - drmInfoStatus = env->NewObject(localRef, constructorId, statusCode, processedData, - env->NewStringUTF(pDrmInfoStatus->mimeType.string())); + drmInfoStatus = env->NewObject(localRef, constructorId, statusCode, infoType, + processedData, env->NewStringUTF(pDrmInfoStatus->mimeType.string())); } delete mData; mData = NULL; @@ -678,11 +673,11 @@ static jobject android_drm_DrmManagerClient_closeConvertSession( static JNINativeMethod nativeMethods[] = { - {"_loadPlugIns", "(ILjava/lang/Object;)I", - (void*)android_drm_DrmManagerClient_loadPlugIns}, + {"_initialize", "(ILjava/lang/Object;)V", + (void*)android_drm_DrmManagerClient_initialize}, - {"_unloadPlugIns", "(I)I", - (void*)android_drm_DrmManagerClient_unloadPlugIns}, + {"_finalize", "(I)V", + (void*)android_drm_DrmManagerClient_finalize}, {"_getConstraints", "(ILjava/lang/String;I)Landroid/content/ContentValues;", (void*)android_drm_DrmManagerClient_getConstraintsFromContent}, |