From 72d8dc39f1a58491c9fb4495079baec6d5c4b41e Mon Sep 17 00:00:00 2001 From: Arthur Hung Date: Sat, 28 Mar 2020 00:48:39 +0000 Subject: Fix input infos are inconsistent between WMS and InputFlinger (2/2) In single focus system, the top focused display may change to the new one when receive a key event. And we would expect the focus could be changed before the event enqueued into inbound queue. This patch refactor 'setInputWindows' to prevent early callback and wakeup in first display, and make sure 'syncInputWindow' could wait until all input windows from all displays updated. Bug: 150250453 Test: atest libinput_tests inputflinger_tests Test: atest --rerun-until-failure 100 WindowFocusTests#testMovingDisplayToTopByKeyEvent Change-Id: I60295975a833df330005943469233c158dd2b07b --- services/inputflinger/InputManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'services/inputflinger/InputManager.cpp') diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index fc771a2c58..e68946d734 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -111,8 +111,10 @@ void InputManager::setInputWindows(const std::vector& infos, handlesPerDisplay.emplace(info.displayId, std::vector>()); handlesPerDisplay[info.displayId].push_back(new BinderWindowHandle(info)); } - for (auto const& i : handlesPerDisplay) { - mDispatcher->setInputWindows(i.second, i.first, setInputWindowsListener); + mDispatcher->setInputWindows(handlesPerDisplay); + + if (setInputWindowsListener) { + setInputWindowsListener->onSetInputWindowsFinished(); } } -- cgit v1.2.3-59-g8ed1b