summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceComposerClient.cpp
diff options
context:
space:
mode:
author Patrick Williams <pdwilliams@google.com> 2023-07-26 13:43:08 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-07-26 13:43:08 +0000
commit33fe363b4abe8e5b11ffb9195323aad56107a4b1 (patch)
treee915e3d4f02ab91f9a07b7130728351f1ae09290 /libs/gui/SurfaceComposerClient.cpp
parent164e9a9233fdaccd9e9ad86b0f00257c32e5d0c9 (diff)
parent30da367c6c0781d9783459567ec57d9d10c77c92 (diff)
Merge "Ensure transaction commit callbacks are called at most once." into main
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 5bc05ef0d8..db99726739 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -377,7 +377,6 @@ void TransactionCompletedListener::onTransactionCompleted(ListenerStats listener
}
auto& [callbackFunction, callbackSurfaceControls] = callbacksMap[callbackId];
if (!callbackFunction) {
- ALOGE("cannot call null callback function, skipping");
continue;
}
std::vector<SurfaceControlStats> surfaceControlStats;
@@ -394,6 +393,11 @@ void TransactionCompletedListener::onTransactionCompleted(ListenerStats listener
callbackFunction(transactionStats.latchTime, transactionStats.presentFence,
surfaceControlStats);
+
+ // More than one transaction may contain the same callback id. Erase the callback from
+ // the map to ensure that it is only called once. This can happen if transactions are
+ // parcelled out of process and applied in both processes.
+ callbacksMap.erase(callbackId);
}
// handle on complete callbacks