diff options
| -rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 1 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 12 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 4 |
3 files changed, 14 insertions, 3 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 46b9128a49..bf2a03d980 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -383,6 +383,7 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr other.mListenerCallbacks.clear(); mInputWindowCommands.merge(other.mInputWindowCommands); + other.mInputWindowCommands.clear(); return *this; } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index c98220ddcb..dc3409b10b 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3098,6 +3098,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) }); } + commitInputWindowCommands(); commitTransaction(); } @@ -3128,6 +3129,11 @@ void SurfaceFlinger::updateInputWindowInfo() { mInputFlinger->setInputWindows(inputHandles); } +void SurfaceFlinger::commitInputWindowCommands() { + mInputWindowCommands.merge(mPendingInputWindowCommands); + mPendingInputWindowCommands.clear(); +} + void SurfaceFlinger::executeInputWindowCommands() { for (const auto& transferTouchFocusCommand : mInputWindowCommands.transferTouchFocusCommands) { if (transferTouchFocusCommand.fromToken != nullptr && @@ -3706,7 +3712,7 @@ bool SurfaceFlinger::flushTransactionQueues() { if (!transactionIsReadyToBeApplied(desiredPresentTime, states)) { break; } - applyTransactionState(states, displays, flags, mInputWindowCommands); + applyTransactionState(states, displays, flags, mPendingInputWindowCommands); transactionQueue.pop(); } @@ -4174,7 +4180,7 @@ uint32_t SurfaceFlinger::addInputWindowCommands(const InputWindowCommands& input flags |= eTraversalNeeded; } - mInputWindowCommands.merge(inputWindowCommands); + mPendingInputWindowCommands.merge(inputWindowCommands); return flags; } @@ -4390,7 +4396,7 @@ void SurfaceFlinger::onInitializeDisplays() { d.width = 0; d.height = 0; displays.add(d); - setTransactionState(state, displays, 0, nullptr, mInputWindowCommands, -1); + setTransactionState(state, displays, 0, nullptr, mPendingInputWindowCommands, -1); setPowerModeInternal(display, HWC_POWER_MODE_NORMAL); diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index a0f83a2c15..ea7a32d461 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -538,6 +538,7 @@ private: void updateInputFlinger(); void updateInputWindowInfo(); + void commitInputWindowCommands(); void executeInputWindowCommands(); void updateCursorAsync(); @@ -1144,6 +1145,9 @@ private: /* ------------------------------------------------------------------------ */ sp<IInputFlinger> mInputFlinger; + // Access must be protected by mStateLock. + InputWindowCommands mPendingInputWindowCommands; + // Should only be accessed by the drawing thread. InputWindowCommands mInputWindowCommands; ui::DisplayPrimaries mInternalDisplayPrimaries; |