194 Commits

Author SHA1 Message Date
Emmanuel Garcia
025e2d82dd
Migrate embedding to AndroidX (#17075) 2020-03-13 21:19:24 -07:00
xster
1ff81bc117
Make a pass through all the embedding javadocs (#17109) 2020-03-13 16:34:34 -07:00
Edman P. Anjos
9beac71a2e
Add support for software text editing controls (#15560)
* Add support for software text editing controls

Includes selection, copy, cut, paste, as well as partial support for up
and down movement.

Text editing controls can be accessed in GBoard by:
  top-left arrow > three dots menu > text editing

Partial fix for flutter/flutter#9419 and flutter/flutter#37371.

* Introduce InputConnectionAdaptor tests

Run with:
  testing/run_tests.py --type=java --java-filter=io.flutter.plugin.editing.InputConnectionAdaptorTest

* Fix BUILD.gn comment on run_tests.py --java-filter flag
2020-02-28 20:18:04 +01:00
Justin McCandless
02aa865da3
Fix the newline on some keyboards (#16560) 2020-02-20 10:36:03 -08:00
Gary Qian
c4c6ef6719
Samsung keyboard duplication workaround: updateSelection (#16547) 2020-02-12 19:51:40 -05:00
Michael Klimushyn
077918dcfd
Apply Google Java format (#16501)
This shouldn't result in any logical changes. I've done a quick smoke
test by building a local Android engine and running Flutter gallery, no
compile errors or other obvious issues.

Applied by running `/ci/format.sh | patch -p0` with the altered script
added in flutter/engine#16500. I did locally modify the script slightly
further so it would run against all Java files in the repo instead of
just modified ones.
2020-02-07 16:10:46 -08:00
Matt Carroll
95468839a0
Added API guards to flags in PlatformPlugin that were introduced after Flutter's min SDK version. (#13965) 2020-02-03 16:25:27 -08:00
Gary Qian
5734eceddf
Samsung fix duplication on punctuation: Update keyboard on finish compose. (#15701) 2020-01-16 18:04:58 -08:00
Greg Spencer
73cdd0ef70
Fix hardware keyboard enter so it triggers an action. (#15568)
This changes the InputConnectionAdaptor so that it will execute an IME action when ENTER is pressed. Prior to this, pressing ENTER on a hardware keyboard did nothing.
2020-01-15 11:13:39 -08:00
Gary Qian
2c0eee4392
Always set mEditable values when different in TextPlugin (#13951) 2019-11-27 07:51:04 +09:00
Matt Carroll
55c64a92d8
Point old plugin registry accessors to new embedding plugin accessors. (#44225) (#13739) 2019-11-09 01:55:59 +00:00
Dan Field
ced6c63d1e
Request a reattach when creating the text input plugin on Android (#13474) 2019-11-01 15:29:33 -07:00
Justin McCandless
7071dc7061
NO_SUGGESTIONS keyboard flag in Android (#13099)
Add the enableSuggestions parameter to control Android's keyboard suggestions
2019-10-23 10:47:19 -07:00
Jason Simmons
72420a3ba5
Remove redundant call to updateEditingState in sendKeyEvent (#13175)
See https://github.com/flutter/flutter/issues/41005
2019-10-16 15:53:12 -07:00
Gary Qian
ecf4f464c7
Restart all modern Samsung keyboard IMM (#12780) 2019-10-04 15:14:38 -04:00
gaaclarke
e9c2102373
Expanded channel buffer resize to method channels. (#12725)
* Expanded channel buffer resize to method channels.
2019-10-02 17:59:59 -07:00
gaaclarke
f407e06970
Resize channel buffers (#12402)
Made it so you can resize channel buffers by sending messages to them.
2019-10-01 10:31:25 -07:00
Jason Simmons
5c428d9247 Check for a null input method subtype (#12706)
Fixes https://github.com/flutter/flutter/issues/41557
2019-10-01 09:03:47 -07:00
Matt Carroll
5b952f286f
Forwards Flutter View to platform views and detaches when needed. (#12359) 2019-09-26 15:34:01 -07:00
Michael Klimushyn
efb7bf434f
Work around Samsung keyboard issue (#12432)
Samsung's Korean keyboard has a bug where it always attempts to combine
characters based on its internal state, ignoring if and when the cursor
is moved programmatically. EG typing "ㄴㅇ" and then moving the cursor
back to the front of the text and typing "ㄴ" again would result in
"ㄴㅇㄴ", not "ㄴㄴㅇ".

Fully restarting the IMM works around this because it flushes the
keyboard's internal state and stops it from trying to incorrectly
combine characters. However this also has some negative performance
implications, so we only apply the workaround on Samsung devices set
to use Korean input.

This also effectively disables the feature on Samsung keyboards that
allowed users to re-open a composing region for previously typed
characters. See https://github.com/flutter/flutter/issues/29341#issuecomment-531283508.

Fixes flutter/flutter#29341.
2019-09-25 11:16:32 -07:00
Jonas Uekötter
d2c1514084 Write MINIMAL_SDK to exception message (#11345)
This changes writes the required and current Android SDK level to the exception message. This enables Crash Reporting tools to capture more information about this crash.
2019-09-23 17:20:26 -07:00
Dan Field
7fb14000fd
java lints (#12354) 2019-09-18 21:20:04 -07:00
Jason Simmons
783deab110
Fix the declaration of setSystemGestureExclusionRects to match the PlatformMessageHandler interface (#12306) 2019-09-16 16:26:39 -07:00
rafern
63873d9f42 Fix objects equal to null not being detected as null (#11283) 2019-09-16 12:16:38 -07:00
Michael Klimushyn
dfa9498360
Enable platform view keyboard input on Android Q (#12085)
Naively embedded platform views on Android were never able to receive
keyboard input, because they were never focusable. So far we've worked
around the limiation by hooking into InputMethodManager and proxying the
InputConnection from a focused window over to the embeded view.

Android Q changed InputMethodManager to be instanced per display instead
of a singleton. Because of this our proxy hook was never being called,
since it was being set up on a different instance of IMM than was being
used in the virtual display.

Update `SingleViewPresentation` to store the IMM from the focused window
and return it whenever there are any calls to `INPUT_METHOD_SERVICE`.
This hooks our proxy back into place for the embedded view in the
virtual display. This restores the functionality of our workaround from
previous versions.

Unfortunately there's still a lot of noisy error logs from IMM here. It
can tell that the IMM has a different displayId than what it's expecting
from the window.

This also updates the unit tests to support SDK=27. SDK 16 doesn't have
DisplayManager, so there were NPEs attempting to instantiate the class
under test.
2019-09-12 09:50:54 -07:00
Emmanuel Garcia
edee1fea58
Add @Keep annotation (#11893) 2019-09-05 13:23:04 -07:00
Shi-Hao Hong
898480fe05
Android 10+ View.getSystemGestureExclusionRects (#11451)
* SystemGesture.getSystemGestureExclusionRects

* Add getSystemExclusionRects unit tests
2019-09-04 15:13:02 -07:00
Matt Carroll
dce8a34048
Revert "Notify framework to clear input connection when app is backgrounded (#35054) (#9498)" (#11720)
This reverts commit 4003fbc3ed48865cf6993d01be60749c3cabeff5.
2019-08-29 15:42:11 -07:00
Shi-Hao Hong
7024722e38
Android 10+ View.setSystemGestureExclusionRects (#11441)
* Implement SystemGesture.setSystemGestureExclusionRects platform channel

* Add PlatformChannelTest.java

* Fix typo in android/test/README.md
2019-08-29 17:00:42 -04:00
Matt Carroll
4003fbc3ed
Notify framework to clear input connection when app is backgrounded (#35054) (#9498) 2019-08-19 14:12:45 -07:00
Jason Simmons
8569edc551
Disable a deprecation warning for use of a TaskDescription constructor for older platforms (#11029) 2019-08-15 15:22:37 -07:00
inthroxify
2e8e6932a6 Fix flutter/flutter #34791 (#9977)
This is a fix for [flutter/flutter issue #34791](https://github.com/flutter/flutter/issues/34791).

PR #8048 in flutter/engine produced a bug/regression (flutter/flutter #34791) in flutter for Android that doesn't permit the Recents app bar color to be changed. This restores the original arguments to the function found in the previous version (2f4a38dbd3/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java) of PlatformPlugin.java while preserving the enhancements for the linter.

I've compiled and tested this fix locally. The bar changes color again.
2019-08-15 09:20:30 -07:00
Matt Carroll
f336e05a69
Android Embedding PR37: Separated FlutterActivity and FlutterFragment via FlutterActivityAndFragmentDelegate (#9895) 2019-07-29 17:40:25 -07:00
Justin McCandless
4decc174ee
Add support for Android's visible password input type (#9999)
For framework PR https://github.com/flutter/flutter/issues/31738
2019-07-23 07:57:39 -07:00
Matt Carroll
649e025f70
Removed PlatformViewsController if-statements from TextInputPlugin (#34286). (#9938) 2019-07-19 13:52:45 -07:00
Amir Hardon
7ae3c3e112
Preserve the alpha for VD content by setting a transparent background. (#9849)
The previous attempt to do this by setting the theme to
Theme_Translucent_NoTitleBar was reported to offsetting touch events on
specific Xiaomi devices.
2019-07-16 12:45:20 -07:00
Amir Hardon
74af88ba9f
Make the virtual display's window translucent (#9828)
By default alpha is not preserved for the VD's contents.
We make the window translucent as a side effect of doing so is preserving alpha.
There should not be extra performance cost for setting the window to be translucent as there is only a single window within the VD.

Fixes flutter/flutter#33756
2019-07-15 16:51:36 -07:00
Michael Klimushyn
a03e747435
Add hooks for InputConnection lock and unlocking (#9727)
With this, plugins can know whether or not their input connection should
be cached. In very rare cases this can be used by plugins to know how to
more properly handle their own input connections, in cases where they're
overriding typical input behavior themselves.
2019-07-11 09:47:35 -07:00
Gary Qian
fa7627d17c
Fix backspace crash on Chinese devices (#9734) 2019-07-10 12:08:03 -07:00
Amir Hardon
fc1d86b758
Revert "Avoid a full screen overlay within virtual displays (#9343)" (#9581)
This reverts commit 0c874c62d0ad596484a83afaa5a6c546d96679fc.
2019-06-28 13:43:23 -07:00
Amir Hardon
3390019225
fix NPE when a touch event is sent to an unknown Android platform view (#9476) 2019-06-25 09:45:20 -07:00
Amir Hardon
56954457a5
Don't hang to a platform view's input connection after it's disposed (#9423)
Addresses the crash reported in https://github.com/flutter/flutter/issues/19718#issuecomment-504174596
2019-06-24 13:13:00 -07:00
Amir Hardon
3757f19923
delegate checkInputConnectionProxy to the relevant platform view (#9426)
The previous logic allowed proxying for any view that belonged to one of the platform views' virtual displays which may lead to us allowing proxying for a view that the platform view isn't allowing proxying for, previous logic also didn't account for unattached views.

This change instead delegates the decision to the platform view.

We use the fact that each virtual display has its unique context to associate any view with its relevant virtual display.

A nice side effect of calling the platform view's checkInputConnectionProxy for webviews is that the plugin now has a way to get a handle to the ThreadedInputConnectionProxyView, which may be useful for getting keyboard working on webview's prior to Android N.
2019-06-21 14:30:58 -07:00
Simon Lightfoot
0c874c62d0 Avoid a full screen overlay within virtual displays (#9343)
Add views that are added directly to a platform view's window as siblings to the platform view's container view, rather than as children of a full screen container.

This prevents a false-negative for a visibility check from a specific ads SDK (Teads), which [reported the following warning](https://github.com/flutter/flutter/issues/12114#issuecomment-500906158):
```
W/teads#Visibility(17978): The Teads AdView is visible at 0%, hidded by 1 View(s):
W/teads#Visibility(17978):   -  View of class io.flutter.plugin.platform.SingleViewPresentation$FakeWindowViewGroup, with id: -1, with contentDescription: null, with a size of: [width: 1050, height: 875] is hidding 100% of the ad
```
2019-06-20 16:46:26 -07:00
Matt Carroll
3bcd6a8f7b
Android Embedding Refactor PR34: Fill in missing nullability annotations. (#9384) 2019-06-19 23:44:15 -07:00
Amir Hardon
4c9fa49408
request FlutterView focus when setting a platform view text client (#9366) 2019-06-18 19:05:36 -07:00
Gary Qian
675033fc05
Check for invalid indexes when performing InputAdpator backspace. (#9322) 2019-06-17 15:13:30 -07:00
XieRan.sai
9da409c0e5 Fix crash on Huawei device with AndroidView (#9192)
Fixes a rare NullPointerException on Huawei devices:
```
Stacktrace:
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.DisplayAdjustments android.view.Display.getDisplayAdjustments()' on a null object reference
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1793)
...
```
2019-06-17 11:06:27 -07:00
Todd Volkert
ace5d59072
Fix rawTypes errors in Android embedding classes (#9326) 2019-06-14 00:27:06 -07:00
Matt Carroll
4fc95ebb29
Fixed memory leaks within FlutterFragment and FlutterView (#34268, #34269, #34270). (#9288) 2019-06-11 17:01:20 -07:00