From 2d112c5f625d09bb703b8909289d11f02ee44398 Mon Sep 17 00:00:00 2001 From: Arthur Hung Date: Mon, 2 Mar 2020 17:46:00 +0800 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: I38f53d83738c4fbf570ea3b99e46341a5f9a4c0f --- 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 c7c61cf1ef..f2a0014da4 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