Greg Spencer b25769b79b Use dispatchKeyEvent, and handle keys sent to InputConnection.sendKeyEvent on Android (flutter/engine#22340)
This (mostly) re-lands #21163, which was reverted in #22321

This switches from using onKeyDown to using dispatchKeyEvent on Android so that keys can be intercepted handled by the framework and not continue to be dispatched to other controls.

It also now intercepts key events sent to InputConnection.sendKeyEvent, as some IMEs do (e.g. the Hacker's Keyboard), and sends them to Flutter.

This fixes the problem where (for example) pressing TAB on a hardware keyboard sends the tab to both the text field and to the focus traversal system.

Note that we still can't intercept all keystrokes given to a soft keyboard, only those which the soft keyboard decides to send to InputConnection.sendKeyEvent, and system keys (like the back button) are only received if the IME doesn't eat them.
2020-11-06 12:45:47 -08:00
..