Define out the hwbinder death notifier code for libgui

This code is only needed for the NO_BINDER version of
libgui (libgui_bufferqueue_static). For libgui, the notifier
is linked inside the connect/disconnect call of BufferQueue
itself.

bug: 149345887
test: Android Auto team helped test it on Auto devices to fix the bug.
Change-Id: I29ab83b9119729e3b878ace439086e87d9c585f6
This commit is contained in:
Chong Zhang 2020-02-11 17:27:38 -08:00
parent 3847d8b581
commit 3248ea00de

View file

@ -288,10 +288,12 @@ Return<void> B2HGraphicBufferProducer::connect(
&bOutput),
&hStatus) &&
b2h(bOutput, &hOutput);
if (converted) {
#ifdef NO_BINDER
if (converted && hListener != nullptr) {
mObituary = new Obituary(this, hListener, hConnectionType);
hListener->linkToDeath(mObituary, 0);
}
#endif // NO_BINDER
_hidl_cb(converted ? hStatus : HStatus::UNKNOWN_ERROR, hOutput);
return {};
}
@ -304,10 +306,12 @@ Return<HStatus> B2HGraphicBufferProducer::disconnect(
}
HStatus hStatus{};
bool converted = b2h(mBase->disconnect(bConnectionType), &hStatus);
#ifdef NO_BINDER
if (mObituary != nullptr) {
mObituary->listener->unlinkToDeath(mObituary);
mObituary.clear();
}
#endif // NO_BINDER
return {converted ? hStatus : HStatus::UNKNOWN_ERROR};
}