summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceComposerClient.cpp
diff options
context:
space:
mode:
author Pablo Gamito <pablogamito@google.com> 2021-11-22 22:16:45 +0100
committer Pablo Gamito <pablogamito@google.com> 2021-11-22 22:17:31 +0100
commit100264730172c6c4319c1d745cea53850afac5b8 (patch)
tree0dc6433255ecf0aaf95fa41773942344957d332d /libs/gui/SurfaceComposerClient.cpp
parent20ca662583aec7a67562b5589e5114fdebf6ca95 (diff)
Only run surface stats callbacks on transaction complete
Test: atest CtsWindowManagerDeviceTestCases:FrameMetricsTests Bug: 206956036 Change-Id: If31c4a6e2f391d8fd8e47a01d94653db584a5430
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r--libs/gui/SurfaceComposerClient.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index b139cf126c..04fd8a28f5 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -352,6 +352,10 @@ void TransactionCompletedListener::onTransactionCompleted(ListenerStats listener
// through all until the SC is found.
int32_t layerId = -1;
for (auto callbackId : transactionStats.callbackIds) {
+ if (callbackId.type != CallbackId::Type::ON_COMPLETE) {
+ // We only want to run the stats callback for ON_COMPLETE
+ continue;
+ }
sp<SurfaceControl> sc =
callbacksMap[callbackId].surfaceControls[surfaceStats.surfaceControl];
if (sc != nullptr) {
@@ -360,7 +364,7 @@ void TransactionCompletedListener::onTransactionCompleted(ListenerStats listener
}
}
- {
+ if (layerId != -1) {
// Acquire surface stats listener lock such that we guarantee that after calling
// unregister, there won't be any further callback.
std::scoped_lock<std::recursive_mutex> lock(mSurfaceStatsListenerMutex);