Adding applyToken for any setTransactionState call
Prior impl sent nullptr for applyToken in doUncacheBufferTransaction and
doDropReferenceTransaction. This led to transactions being applied out
of order if prior transactions were on the pending queue. Add
applyToken so that SF will properly see if that process has pending
transactions.
Bug: 130564665
Test: build, boot, SurfaceFlinger_test, libsurfaceflinger_unittest
Change-Id: I35344163bd06262dbc21a440716cf46504b504ea
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 611da89..50a539f 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -381,7 +381,8 @@
s.state.parentHandleForChild = nullptr;
composerStates.add(s);
- sf->setTransactionState(composerStates, displayStates, 0, nullptr, {}, -1, {}, {});
+ sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
+ sf->setTransactionState(composerStates, displayStates, 0, applyToken, {}, -1, {}, {});
}
void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) {
@@ -391,7 +392,8 @@
uncacheBuffer.token = BufferCache::getInstance().getToken();
uncacheBuffer.cacheId = cacheId;
- sf->setTransactionState({}, {}, 0, nullptr, {}, -1, uncacheBuffer, {});
+ sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
+ sf->setTransactionState({}, {}, 0, applyToken, {}, -1, uncacheBuffer, {});
}
void SurfaceComposerClient::Transaction::cacheBuffers() {