am 6be1d210: am f0cf5f10: BufferQueue: fix a test crash

* commit '6be1d210eef392f5745d58a0033572b1af4b2f2a':
  BufferQueue: fix a test crash
This commit is contained in:
Jamie Gennis 2013-10-02 11:19:52 -07:00 committed by Android Git Automerger
commit bd381c6164
1 changed files with 9 additions and 5 deletions

View File

@ -667,11 +667,15 @@ status_t BufferQueue::connect(const sp<IBinder>& token,
mConnectedApi = api;
output->inflate(mDefaultWidth, mDefaultHeight, mTransformHint, mQueue.size());
// set-up a death notification so that we can disconnect automatically
// when/if the remote producer dies.
// This will fail with INVALID_OPERATION if the "token" is local to our process.
if (token->linkToDeath(static_cast<IBinder::DeathRecipient*>(this)) == NO_ERROR) {
mConnectedProducerToken = token;
// set-up a death notification so that we can disconnect
// automatically when/if the remote producer dies.
if (token != NULL && token->remoteBinder() != NULL) {
status_t err = token->linkToDeath(static_cast<IBinder::DeathRecipient*>(this));
if (err == NO_ERROR) {
mConnectedProducerToken = token;
} else {
ALOGE("linkToDeath failed: %s (%d)", strerror(-err), err);
}
}
}
break;