185 Commits

Author SHA1 Message Date
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
Matt Carroll
8040117420
Fix TextInputPlugin NPE caused by PlatformViewsController ref in new embedding (#34283). (#9283) 2019-06-11 15:21:55 -07:00
Amir Hardon
259d334e05
Reland "Keyboard support for embedded Android views. (#9203) (#9257)
#9203 broke the keyboard_resize integration test(see more details in flutter/flutter#34085 (comment)).

This re-lands @9203 and fixes the issue the integration test uncovered by always allowing to hide the keyboard.

The difference from the original change is 07d2598
2019-06-10 12:56:35 -07:00
Jonah Williams
ddd36e8338
Revert "Keyboard support for embedded Android views. (#9203)" (#9239) 2019-06-07 18:21:57 -07:00
Amir Hardon
e80df363d2
Keyboard support for embedded Android views. (#9203)
Generally what this PR is doing is setting up a delegation mechanism
for Android's onCreateInputConnection.

It works by letting the framework know when an embedded view gets loses
focus(within the virtual display), the framework maintains a focus node
for each Android view that is kept in sync with the focus state of the
embedded view.

The TextInputPlugin is extended to allow for 2 type of text clients a
"framework client"(what we had before) and a "platform view client".
When the AndroidView's focus node in the framework is focused the
framework sets a "platform view text client" for the TextInputPlugin,
which will result in the TextInputPlugin delegating
createInputConnection to the platform view.

When a platform view is resized, we are detaching it from a virtual
display and attaching it to a new one, as a side affect a platform view
might lose an active input connection, to workaround that we "lock" the
connection when resizing(by caching it and forcing the cached copy until
the resize is done).

Additional things worth calling out in this PR:

To properly answer which views are allowed for input connection
proxying we compare a candidate view's root view to the set of root
views of all virtual displays.
We also preserve a view's focus state across resizes.
Note that this PR only wires text for the io.flutter.view.FlutterView
For the new Android embedding some additional plumbing is necessary.

Corresponding framework PR: flutter/flutter#33901

flutter/flutter#19718
2019-06-06 21:58:04 -07:00
Amir Hardon
647a8524b0
Revert "Switch PlatformViewsController from Activity ref to Application ref. (#9193)" (#9211)
This reverts commit 5ea125eaf9e15a3e4eefe89b13cb86b0ba820d8f.
2019-06-06 09:29:10 -07:00
Matt Carroll
5ea125eaf9
Switch PlatformViewsController from Activity ref to Application ref. (#9193) 2019-06-05 14:24:16 -07:00
Matt Carroll
008090b8ab
Extracted PlatformViewsChannel from PlatformViewsController. (#7847) 2019-06-03 11:04:33 -07:00
Kaushik Iska
d4794122ab
Change the virtual display size restriction to warning (#9110)
* Change the virtual display size restriction to warning

- Fixes: https://github.com/flutter/flutter/issues/33290

- This is so we don't block usecases where users show the platform
  view partially.

- https://github.com/flutter/flutter/issues/31990 should address this
  issue more broadly.

* Fix error message
2019-05-30 08:07:41 +05:30
Chris Bracken
509a43fe27
Apply minor cleanups to Android embedding (#9088)
Eliminate an unused import, add missing @Override annotations, and
eliminate an unused logger.
2019-05-25 15:45:14 -07:00