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
......@@ -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
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment