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
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
index 6e98676..09dc92c 100644
--- a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
+++ b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
@@ -19,6 +19,7 @@
#include <InputListener.h>
#include <input/ISetInputWindowsListener.h>
+#include <unordered_map>
namespace android {
@@ -99,13 +100,13 @@
*/
virtual std::unique_ptr<VerifiedInputEvent> verifyInputEvent(const InputEvent& event) = 0;
- /* Sets the list of input windows.
+ /* Sets the list of input windows per display.
*
* This method may be called on any thread (usually by the input manager).
*/
virtual void setInputWindows(
- const std::vector<sp<InputWindowHandle> >& inputWindowHandles, int32_t displayId,
- const sp<ISetInputWindowsListener>& setInputWindowsListener = nullptr) = 0;
+ const std::unordered_map<int32_t, std::vector<sp<InputWindowHandle>>>&
+ handlesPerDisplay) = 0;
/* Sets the focused application on the given display.
*