180 Commits

Author SHA1 Message Date
Greg Spencer
dee94135d4 Fix race condition in key event handling on Android (flutter/engine#22658)
This fixes a problem in Android key event handling where, because I was only using a single bool to indicate that we were re-dispatching, there was a race condition when multiple keys were pending (sent to the framework, awaiting responses).

This fixes that by switching to a mechanism that uses the event itself to tell if it was redispatched.

In doing this, I realized that because key events can come from either the dispatchEvent call, or through the InputConnectionAdaptor, I needed to handle both routes properly so that the events would all be handled, and all go through the same mechanism on the framework side.
2020-12-01 09:42:38 -08:00
xster
fd77ecc84c Let FlutterFragment not pop the whole activity by default when more fragments are in the activity (flutter/engine#22692) 2020-11-30 12:43:03 -08:00
Greg Spencer
5c883e2293 Fix double delete on backspace on Android (flutter/engine#22626) 2020-11-20 10:43:02 -08:00
Gary Qian
3676366194 Split AOT Android Embedder and shell (flutter/engine#22179) 2020-11-19 17:22:26 -08:00
Gary Qian
7a18791454 Rename padding->viewPadding to match framework naming conventions (flutter/engine#22599) 2020-11-19 09:50:51 -08:00
Hamdi Kahloun
1be95d91c7 [Android] Add systemNavigationBarDividerColor (flutter/engine#22538) 2020-11-16 10:48:02 -08:00
Hamdi Kahloun
105724c50c Revert "Update PlatformPluginTest.java & PlatformPlugin.java"
This reverts commit bca3c2e7d2e248ca4a6f764fb81d4de9516cf640.
2020-11-16 16:53:30 +01:00
Hamdi Kahloun
bca3c2e7d2 Update PlatformPluginTest.java & PlatformPlugin.java 2020-11-16 16:28:03 +01:00
Ari Weiland
435a0f38be Fix some serious lifecycle bugs with Android embedding code (flutter/engine#22203) 2020-11-13 11:58:02 -08:00
Dan Field
b388181b25 Limit heap growth on Android (flutter/engine#20473)
Limit heap growth to half of totalMem by default, with the option to set it higher or lower in the AndroidManifest
2020-11-12 14:53:54 -08:00
LongCatIsLooong
07032ba889 [Android text input] Reland #21534 (flutter/engine#22435) 2020-11-12 11:34:01 -08:00
Emmanuel Garcia
1d0a96bd3f Fix talkback in hybrid composition while using FlutterFragmentActivity (flutter/engine#22429) 2020-11-12 10:30:29 -08:00
LongCatIsLooong
fbfb27f515 Revert "[Android Text Input] Make the editing state listenable and allow batch edits (#21534)" (flutter/engine#22434) 2020-11-11 18:24:02 -08:00
chunhtai
65456583c8 reland support uri launch in android (flutter/engine#22363)
* Revert "Revert "support uri intent launcher in android (#21275)" (#22298)"

This reverts commit 9a5b6b4e910bcfac97a330a4aa2cbe2f14b57522.

* reland support uri launch for android

* refactor

* update

* fix test

* addressing comments

* addressing comments

* revert throw error
2020-11-11 14:51:04 -08:00
LongCatIsLooong
7d20e41baf [Android Text Input] Make the editing state listenable and allow batch edits (flutter/engine#21534) 2020-11-10 19:19:03 -08:00
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
Greg Spencer
440ff6e3f4 Revert "Reland: Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (#22304)" (flutter/engine#22321)
This reverts commit b289c1711fd8357fe5a6c8aa66683d0d2ca55e48 because it breaks back button functionality.
2020-11-05 09:02:25 -08:00
Greg Spencer
b289c1711f Reland: Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (flutter/engine#22304)
This re-lands #21163, which was reverted in #22004

Now that flutter/flutter#67359 has landed, this change will no longer cause spaces (and other shortcuts) to be ignored in text fields if there is no action associated with the intent, even if there is a shortcut key mapping to an intent.

It also no longer causes web test failures (as far as I can tell without submitting it: the same tests don't fail locally).

Here's the original PR description:

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.
2020-11-04 15:54:21 -08:00
chunhtai
9a5b6b4e91 Revert "support uri intent launcher in android (#21275)" (flutter/engine#22298) 2020-11-04 15:04:02 -08:00
chunhtai
272e2b2bac makes android semanticsnode to ignore hittest if it is not focusable (flutter/engine#22205) 2020-11-02 09:53:01 -08:00
Lazy Llama
176d1345a4 Fix viewInset.bottom and viewPadding.bottom… (flutter/engine#21730) 2020-10-29 17:28:01 -07:00
Jason Simmons
b76d246acb Reformat some files that were not auto-formatted (flutter/engine#21940) 2020-10-23 18:57:03 -07:00
chunhtai
f826d9992e support uri intent launcher in android (flutter/engine#21275)
* support uri intent launcher in android

* fix comment
2020-10-22 15:54:30 -07:00
Lau Ching Jun
743edee507 Support loading assets from Android dynamic feature modules (flutter/engine#21504)
Initialize the AssetManager from the application context so that assets from dynamic feature modules can be loaded.
2020-10-22 15:53:11 -07:00
chunhtai
0f2c3c9bf4 Fixes Edge trigger route change announcement (flutter/engine#21975) 2020-10-22 14:22:03 -07:00
Greg Spencer
22f99901e4 Revert "Reland: Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (#21979)" (flutter/engine#22004)
This reverts commit 410db6115268fe6d7561adf68d0fb04adf314c43 because it causes some failures in web tests.
2020-10-20 11:42:01 -07:00
Greg Spencer
410db61152 Reland: Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (flutter/engine#21979)
This re-lands #21163, which was reverted in #21513

Now that flutter/flutter#67359 has landed, this change will no longer cause spaces (and other shortcuts) to be ignored in text fields if there is no action associated with the intent, even if there is a shortcut key mapping to an intent.

Here's the original PR description:

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.
2020-10-20 10:14:31 -07:00
Mehmet Fidanboylu
681ffacfe6 Forward Error objects to uncaught exception handler if there is one. (flutter/engine#21806) 2020-10-16 08:21:04 -07:00
Jason Simmons
190b35170f Call PlatformView.dispose when removing hybrid composition platform views (flutter/engine#21790)
Also force disposal of all hybrid platform views when shutting down the
engine.

Fixes https://github.com/flutter/flutter/issues/66764
2020-10-13 18:40:55 -07:00
Emmanuel Garcia
a36600d4b0 Allow TalkBack navigation while a platform view is rendered (flutter/engine#21719) 2020-10-13 17:52:02 -07:00
Hamdi Kahloun
5ee8b7c5ef SecurityException: Permission Denial (flutter/engine#21290)
Fix `java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider`

Fixes flutter/flutter#66108

Co-authored-by: Dan Field <dfield@gmail.com>
2020-10-08 14:36:51 -07:00
Jason Simmons
b1839003b3 Extract the WindowInsetsAnimation.Callback subclass into a separate class that will be lazily loaded (flutter/engine#21548)
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
2020-10-02 11:23:42 -07:00
Ren You
f2669455f3 Revert "Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (#21163)" (flutter/engine#21513)
This reverts commit afeb9b27f0191997cc45682ab756c0be4d3e155c.
2020-09-30 09:34:05 -07:00
Greg Spencer
afeb9b27f0 Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (flutter/engine#21163)
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.
2020-09-29 12:46:29 -07:00
Emmanuel Garcia
dbca16555e Support dragging native platform views (flutter/engine#21396) 2020-09-25 17:46:34 -07:00
Gary Qian
e714ae10db Locale -> LanguageRange conversion to be more general in Android platformResolvedLocale (flutter/engine#21350) 2020-09-23 21:52:02 -07:00
Jason Simmons
32fbdb6755 Fix boolean value checks in StandardMessageCodec (flutter/engine#21270)
Fixes https://github.com/flutter/flutter/issues/65619
2020-09-23 16:31:07 -07:00
xster
aa3ac9e9aa Enforce exclusivity for activity and fragments attached to the FlutterEngine (flutter/engine#21272) 2020-09-22 10:34:52 -07:00
Jason Simmons
bc82ee9267 Disconnect the view's AndroidKeyProcessor when detaching from the engine (flutter/engine#21307) 2020-09-21 17:42:02 -07:00
Gary Qian
b2a78b0db5 Remove extraneous window inset call on IME animation (flutter/engine#21213) 2020-09-16 14:04:50 -07:00
Hamdi Kahloun
489c648b42 Fix NPE in PlatformPlugin.getClipboardData() (flutter/engine#21189) 2020-09-15 17:00:57 -07:00
Emmanuel Garcia
3a7b283bb3 Account for current open image in FlutterImageView (flutter/engine#21191) 2020-09-15 14:10:55 -07:00
Gary Qian
cd4ac5d0a3 [Android R] Sync keyboard animation with view insets vs Android 11/R/API 30 WindowInsetsAnimation (flutter/engine#20843) 2020-09-04 02:06:30 -07:00
xster
ed15a009fe Let FlutterActivity/Fragment/FragmentActivity have an app bundle path override instead of eager resolving during construction (flutter/engine#20769) 2020-09-03 17:31:30 -07:00
Gary Qian
a1755b3feb [Android R] Integrate DisplayCutouts into viewportMetrics (flutter/engine#20921) 2020-09-02 05:18:35 -07:00
Emmanuel Garcia
12b8249404 Ensure all images are closed in FlutterImageView (flutter/engine#20842) 2020-09-01 16:57:45 -07:00
Jason Simmons
4bd9085a47 Pass text input key events to the EventResponder if they do not yield characters (flutter/engine#20912)
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
2020-08-31 17:56:09 -07:00
xster
7b62a6c11a Add auto plugin registration to FlutterFragmentActivity as well (flutter/engine#20865) 2020-08-31 13:43:46 -07:00
Emmanuel Garcia
2f8279900b Reland: Enable hybrid composition by default on Android (#20722) (flutter/engine#20864)
This reverts commit bb885a23e20d79c163dc884530acaafd6c311f2a.
2020-08-31 12:17:11 -07:00
xster
c09700b409 Add a java injector for testing (flutter/engine#20789) 2020-08-29 22:29:23 -07:00