summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2014-04-21 21:02:28 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-04-21 21:02:28 +0000
commite618f184733e745df4cf86019d23e085559e0f2c (patch)
treec4b385d5ee3514d5e6bdbf80504018d08ce725aa /media/jni
parenta281be67030a834d455a84ce62c173140564211a (diff)
parent72eec7f6c9509fb86f46fbdb619523efacb8d02e (diff)
downloadframeworks_base-e618f184733e745df4cf86019d23e085559e0f2c.zip
frameworks_base-e618f184733e745df4cf86019d23e085559e0f2c.tar.gz
frameworks_base-e618f184733e745df4cf86019d23e085559e0f2c.tar.bz2
am 72eec7f6: Merge "Allow DRM plugins to be destroyed when released" into klp-modular-dev
* commit '72eec7f6c9509fb86f46fbdb619523efacb8d02e': Allow DRM plugins to be destroyed when released
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();