Only prune non-pointer events
The "pruning input queue" functionality is present in order to prevent the dispatcher from being blocked. However, only focus-dispatched events (like keys and joystick events) can block the dispatcher, because they require a focused window. Pointer events, like touches, go to the touched window, and are not blocked. Furthermore, dropping pointer events is not a good idea, because it can cause inconsistent input streams to be processed inside the dispatcher. In this CL, we prevent pointer events from being dropped. This resolves a crash in InputDispatcher, because an inconsistent input stream would lead to unexpected behaviour later on in the pipeline. To reproduce the original crash: 1) Set device to 3-button navigation mode 2) Launch an app, then quickly press the back button 3) Then, quickly touch the app again The WM would not yet send the "setFocusedApplication" call to match the newly launched app (maybe it's slow, or it's just a bug). The dispatcher would be waiting for a focused window, and the touch into the newly launched app would cause the dispatcher to drop events because "the user is interacting with a different app than the one that's currently focused". And finally, since the navigation bar listens for outside touches, the dispatcher would try to send an ACTION_OUTSIDE event to the navigation bar, and this would conflict with the current dispatcher state because there's already a pointer inside navigation bar (and the dispatcher dropped the ACTION_UP event instead of processing it). Bug: 308531018 Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:99e407b0e7e748cbb82bdaa2e21c740c308d60b3) Merged-In: I7ac5f7bd607c7411e3917977888d1cfeaf96615c Change-Id: I7ac5f7bd607c7411e3917977888d1cfeaf96615c
Loading
Please register or sign in to comment