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

Commit 9a25c012 authored by Jeff Tinker's avatar Jeff Tinker Committed by Android Git Automerger
Browse files

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

* commit 'eced745a':
  Part of fix for TEE resource leaks when app crashes
parents ace2378c eced745a
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;