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

Commit eced745a authored by Jeff Tinker's avatar Jeff Tinker Committed by Android (Google) Code Review
Browse files

Merge "Part of fix for TEE resource leaks when app crashes" into jb-mr2-dev

parents f59a4b39 3d3f67f3
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -71,6 +71,12 @@ status_t Drm::initCheck() const {
status_t Drm::setListener(const sp<IDrmClient>& listener)
{
    Mutex::Autolock lock(mEventLock);
    if (mListener != NULL){
        mListener->asBinder()->unlinkToDeath(this);
    }
    if (listener != NULL) {
        listener->asBinder()->linkToDeath(this);
    }
    mListener = listener;
    return NO_ERROR;
}
@@ -576,4 +582,12 @@ status_t Drm::verify(Vector<uint8_t> const &sessionId,
    return mPlugin->verify(sessionId, keyId, message, signature, match);
}

void Drm::binderDied(const wp<IBinder> &the_late_who)
{
    delete mPlugin;
    mPlugin = NULL;
    closeFactory();
    mListener.clear();
}

}  // namespace android
+5 −1
Original line number Diff line number Diff line
@@ -29,7 +29,9 @@ namespace android {
struct DrmFactory;
struct DrmPlugin;

struct Drm : public BnDrm, public DrmPluginListener {
struct Drm : public BnDrm,
             public IBinder::DeathRecipient,
             public DrmPluginListener {
    Drm();
    virtual ~Drm();

@@ -115,6 +117,8 @@ struct Drm : public BnDrm, public DrmPluginListener {
                           Vector<uint8_t> const *sessionId,
                           Vector<uint8_t> const *data);

    virtual void binderDied(const wp<IBinder> &the_late_who);

private:
    mutable Mutex mLock;