Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 600071ca authored by Jeff Tinker's avatar Jeff Tinker
Browse files

Allow DRM plugins to be destroyed when released

bug: 13411994
Change-Id: I5b4ac137ebfbaa61bc37f8344ab6ff3a7f6c0099
parent 2e8a2d20
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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();
    }
}

+2 −0
Original line number Diff line number Diff line
@@ -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();