From 236eba34ccbc3bdbe381f34148d2b283feb90b29 Mon Sep 17 00:00:00 2001 From: Valerie Hau Date: Fri, 3 Jan 2020 16:53:39 -0800 Subject: Fix callback registration during merging in same-process Bug: 147109531 Test: build, boot, libsurfaceflinger_unittest, SurfaceFlinger_test Change-Id: I17d9ba98ba85d45b3325588e94e978747786488c --- libs/gui/SurfaceComposerClient.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 1d887ea931..f378fc5ef6 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -484,14 +484,22 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr mListenerCallbacks[listener].callbackIds.insert(std::make_move_iterator( callbackIds.begin()), std::make_move_iterator(callbackIds.end())); - // register surface controls for this listener that is merging - for (const auto& surfaceControl : surfaceControls) { - registerSurfaceControlForCallback(surfaceControl); - } - mListenerCallbacks[listener] - .surfaceControls.insert(std::make_move_iterator(surfaceControls.begin()), - std::make_move_iterator(surfaceControls.end())); + mListenerCallbacks[listener].surfaceControls.insert(surfaceControls.begin(), + surfaceControls.end()); + + auto& currentProcessCallbackInfo = + mListenerCallbacks[TransactionCompletedListener::getIInstance()]; + currentProcessCallbackInfo.surfaceControls + .insert(std::make_move_iterator(surfaceControls.begin()), + std::make_move_iterator(surfaceControls.end())); + + // register all surface controls for all callbackIds for this listener that is merging + for (const auto& surfaceControl : currentProcessCallbackInfo.surfaceControls) { + TransactionCompletedListener::getInstance() + ->addSurfaceControlToCallbacks(surfaceControl, + currentProcessCallbackInfo.callbackIds); + } } mInputWindowCommands.merge(other.mInputWindowCommands); -- cgit v1.2.3-59-g8ed1b