Only send events to windows with pointers
Due to the recent refactor, some of the windows with only hovering pointers are getting persisted inside TouchState. This is the case for the hovering pointers from mouse, for example. Mouse usually never leaves the screen, so it's always inside some window. However, we are still currently iterating over TouchedWindows inside the TouchState in order to determine which targets should receive the current entry. That means that the windows that are hovered over will always be there, which is not something that we want. It would cause the events to go to windows that are not directly getting touched. To avoid this, make sure that the pointers are indeed supposed to be going to the current window. In a future refactor, we will store the pointers per-device, as well. The added test reproduces a condition where we crash due to mismatching downtimes. There are few issues that it exposes. 1) We currently use hover events for setting the downtime of a window, which we shouldn't do. 2) If a window is not receiving the events from the current device, it shouldn't be in the dispatching list. So we should not be sending the events there to begin with. Bug: 266455987 Test: m inputflinger_tests && $ANDROID_HOST_OUT/nativetest64/inputflinger_tests/inputflinger_tests --gtest_filter="*HoverFromLeftToRightAndTap*" Change-Id: Ic0d2a1ed6d053e18077bc7216b1ce02e88017b4a
Loading
Please register or sign in to comment