summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2014-04-21 20:58:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-21 20:58:49 +0000
commit72eec7f6c9509fb86f46fbdb619523efacb8d02e (patch)
treec622adbb9758a9726f1483c4d859d64bcaacf531 /media/jni
parent370cda7074a02139fa5374bbdd94c37be376ca7a (diff)
parent600071ca78bb3fa52b4b3e04112ed6664ffe0e30 (diff)
downloadframeworks_base-72eec7f6c9509fb86f46fbdb619523efacb8d02e.zip
frameworks_base-72eec7f6c9509fb86f46fbdb619523efacb8d02e.tar.gz
frameworks_base-72eec7f6c9509fb86f46fbdb619523efacb8d02e.tar.bz2
Merge "Allow DRM plugins to be destroyed when released" into klp-modular-dev
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_MediaDrm.cpp10
-rw-r--r--media/jni/android_media_MediaDrm.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp
index 7c45682..4fbd2a4 100644
--- a/media/jni/android_media_MediaDrm.cpp
+++ b/media/jni/android_media_MediaDrm.cpp
@@ -297,8 +297,6 @@ JDrm::JDrm(
}
JDrm::~JDrm() {
- mDrm.clear();
-
JNIEnv *env = AndroidRuntime::getJNIEnv();
env->DeleteWeakGlobalRef(mObject);
@@ -363,6 +361,13 @@ void JDrm::notify(DrmPlugin::EventType eventType, int extra, const Parcel *obj)
}
}
+void JDrm::disconnect() {
+ if (mDrm != NULL) {
+ mDrm->destroyPlugin();
+ mDrm.clear();
+ }
+}
+
// static
bool JDrm::IsCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType) {
@@ -527,6 +532,7 @@ static void android_media_MediaDrm_release(JNIEnv *env, jobject thiz) {
sp<JDrm> drm = setDrm(env, thiz, NULL);
if (drm != NULL) {
drm->setListener(NULL);
+ drm->disconnect();
}
}
diff --git a/media/jni/android_media_MediaDrm.h b/media/jni/android_media_MediaDrm.h
index 620ad28..b7b8e5d 100644
--- a/media/jni/android_media_MediaDrm.h
+++ b/media/jni/android_media_MediaDrm.h
@@ -47,6 +47,8 @@ struct JDrm : public BnDrmClient {
void notify(DrmPlugin::EventType, int extra, const Parcel *obj);
status_t setListener(const sp<DrmListener>& listener);
+ void disconnect();
+
protected:
virtual ~JDrm();