InputDispatcher: Ensure synthesized events are associated with windows
For tracing purposes, we want as much information as possible about where input events are dispatched. Ideally, we will trace the windowId that is the target of each dispatched event. That way, we can easily look up properties of the window that received the event. The difficulty with this is that there is a many-to-one mappings between windows and input channels, where more than one window can receive input through the same channel. A channel might also receive input when there no windows associated with it - such as if a window has been removed and we want to generate cancelation events for it, or such as for global monitors that don't have windows at all. We make the best effort to associate each event dispatch with a windowId. Then in the tests, we consume events from the window that we expect to be associated with the event. For cloned windows that are both touched at the same time, the entire gesture is usually associated with the window that was first touched, because the pointers from both windows will be merged into the same event. For focus events, we track focus by token and not by the window, so when there is more than one window for a focused token, we arbitrarily pick the top-most window to associate events with for tracing. Bug: 210460522 Test: atest inputflinger_tests Change-Id: I47744cbd677cc74e26a102c50a2c11c68bc8aa89
Loading
Please register or sign in to comment