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/benchmarks/InputDispatcher_benchmarks.cpp b/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
index 3b18813..7c5c9c5 100644
--- a/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
+++ b/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
@@ -252,7 +252,7 @@
sp<FakeApplicationHandle> application = new FakeApplicationHandle();
sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window");
- dispatcher->setInputWindows({window}, ADISPLAY_ID_DEFAULT);
+ dispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
NotifyMotionArgs motionArgs = generateMotionArgs();
@@ -288,7 +288,7 @@
sp<FakeApplicationHandle> application = new FakeApplicationHandle();
sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window");
- dispatcher->setInputWindows({window}, ADISPLAY_ID_DEFAULT);
+ dispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
for (auto _ : state) {
MotionEvent event = generateMotionEvent();