WindowInsetsAnimation.Callback was introduced in API level 30. This
PR moves the text input plugin's WindowInsetsAnimation.Callback subclass
into a class that will only be loaded if the embedding has checked for a
sufficient API level.
See https://github.com/flutter/flutter/issues/66908
This switches from using dispatchKeyEvent to using dispatchKeyEventPreIme so that keys can be intercepted before they reach the IME and be handled by the framework.
It also now intercepts key events sent to InputConnection.sendKeyEvent, as some IMEs do (e.g. the Hacker's Keyboard), and sends the to Flutter before sending them to the IME (which it now only does if they are not handled by the framework).
This fixes the problem where 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.
If the InputConnectionAdaptor receives a key event that does not move
the caret or produce a text character (such as the back button), then
the event should be given to the EventResponder which will forward it
to the view.
Fixes https://github.com/flutter/flutter/issues/64864
This re-lands the key event synthesis implementation for Android (Original PR: #19024, Revert PR: #19956). The only difference is sending the synthesized key events to the root view instead of the current view.
Without sending it to the root view, the system doesn't have any chance of handling keys like the back button. The event will still not be sent to the framework twice, since we turn off event propagation while re-dispatching the event.
AccessibilityBridge installs various listeners for Android events
that invoke Flutter engine APIs. These listeners are removed in
AccessibilityBridge.release. However, in some environments there may
be deferred calls to the listener that will still execute even after
the listener has been removed. This change sets a flag during release
and ignores any listener invocations that happen after the flag is set.
See https://github.com/flutter/flutter/issues/63555 and
https://github.com/flutter/engine/pull/17311
* Add native stacktrace on iOS
* Add native stacktrace on Android
* format and changing naming to errorWithCode on iOS
* reformat
* Remove stacktrace from decodeEnvelope, not needed.
* Separate encodeErrorEnvelopeWithStacktrace with original encode function
* Add unit tests
* re-format
* change comments for stacktrace
* Remove changes for iOS
Co-authored-by: Ben Li <libe@google.com>
This implements the design in flutter.dev/go/handling-synchronous-keyboard-events for Android.
I started with Android, but this will be used for all platforms as we add them.
The related framework PR is: flutter/flutter#59358 (which has already landed)