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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user