diff options
Diffstat (limited to 'drm/jni')
-rw-r--r-- | drm/jni/android_drm_DrmManagerClient.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drm/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp index dfc7fb2..cf58177 100644 --- a/drm/jni/android_drm_DrmManagerClient.cpp +++ b/drm/jni/android_drm_DrmManagerClient.cpp @@ -225,25 +225,32 @@ static sp<DrmManagerClientImpl> getDrmManagerClientImpl(JNIEnv* env, jobject thi } static jint android_drm_DrmManagerClient_initialize( - JNIEnv* env, jobject thiz, jobject weak_thiz) { + JNIEnv* env, jobject thiz) { ALOGV("initialize - Enter"); int uniqueId = 0; sp<DrmManagerClientImpl> drmManager = DrmManagerClientImpl::create(&uniqueId, false); 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); ALOGV("initialize - Exit"); - return uniqueId; } -static void android_drm_DrmManagerClient_finalize(JNIEnv* env, jobject thiz, jint uniqueId) { - ALOGV("finalize - Enter"); +static void android_drm_DrmManagerClient_setListeners( + JNIEnv* env, jobject thiz, jint uniqueId, jobject weak_thiz) { + ALOGV("setListeners - Enter"); + + // Set the listener to DrmManager + sp<DrmManagerClient::OnInfoListener> listener = new JNIOnInfoListener(env, thiz, weak_thiz); + getDrmManagerClientImpl(env, thiz)->setOnInfoListener(uniqueId, listener); + + ALOGV("setListeners - Exit"); +} + +static void android_drm_DrmManagerClient_release( + JNIEnv* env, jobject thiz, jint uniqueId) { + ALOGV("release - Enter"); DrmManagerClientImpl::remove(uniqueId); getDrmManagerClientImpl(env, thiz)->setOnInfoListener(uniqueId, NULL); @@ -252,7 +259,7 @@ static void android_drm_DrmManagerClient_finalize(JNIEnv* env, jobject thiz, jin oldClient->setOnInfoListener(uniqueId, NULL); oldClient->removeClient(uniqueId); } - ALOGV("finalize - Exit"); + ALOGV("release - Exit"); } static jobject android_drm_DrmManagerClient_getConstraintsFromContent( @@ -714,11 +721,14 @@ static jobject android_drm_DrmManagerClient_closeConvertSession( static JNINativeMethod nativeMethods[] = { - {"_initialize", "(Ljava/lang/Object;)I", + {"_initialize", "()I", (void*)android_drm_DrmManagerClient_initialize}, - {"_finalize", "(I)V", - (void*)android_drm_DrmManagerClient_finalize}, + {"_setListeners", "(ILjava/lang/Object;)V", + (void*)android_drm_DrmManagerClient_setListeners}, + + {"_release", "(I)V", + (void*)android_drm_DrmManagerClient_release}, {"_getConstraints", "(ILjava/lang/String;I)Landroid/content/ContentValues;", (void*)android_drm_DrmManagerClient_getConstraintsFromContent}, |