what |= layer_state_t::eReleaseBufferListenerChanged; s->releaseBufferListener = TransactionCompletedListener::getIInstance(); s->releaseCallbackId = id; auto listener = TransactionCompletedListener::getInstance(); listener->setReleaseBufferCallback(id, callback); }"> what |= layer_state_t::eReleaseBufferListenerChanged; s->releaseBufferListener = TransactionCompletedListener::getIInstance(); s->releaseCallbackId = id; auto listener = TransactionCompletedListener::getInstance(); listener->setReleaseBufferCallback(id, callback); }"> what |= layer_state_t::eReleaseBufferListenerChanged; s->releaseBufferListener = TransactionCompletedListener::getIInstance(); s->releaseCallbackId = id; auto listener = TransactionCompletedListener::getInstance(); listener->setReleaseBufferCallback(id, callback); }">
void SurfaceComposerClient::Transaction::setReleaseBufferCallback(layer_state_t* s,
const ReleaseCallbackId& id,
ReleaseBufferCallback callback) {
if (!callback) {
return;
}
if (!s->buffer) {
ALOGW("Transaction::setReleaseBufferCallback"
"ignored trying to set a callback on a null buffer.");
return;
}
s->what |= layer_state_t::eReleaseBufferListenerChanged;
s->releaseBufferListener = TransactionCompletedListener::getIInstance();
s->releaseCallbackId = id;
auto listener = TransactionCompletedListener::getInstance();
listener->setReleaseBufferCallback(id, callback);
}
layer_state_t
设置 eReleaseBufferListenerChanged
、releaseBufferListener
和 releaseCallbackId
。callback
保存到 mReleaseBufferCallbacks
。