1057 Commits

Author SHA1 Message Date
Greg Spencer
3658bd7ea7
Revert "Reland: Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (#21979)" (#22004)
This reverts commit 3cd70f2cfb21baf30cc62de29d311118aa757c60 because it causes some failures in web tests.
2020-10-20 11:42:01 -07:00
Greg Spencer
3cd70f2cfb
Reland: Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (#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
Jason Simmons
a6857802b7
Fix the initialization of AndroidSurfaceFactoryImpl (#21977)
Fixes https://github.com/flutter/flutter/issues/68446
2020-10-19 16:22:36 -07:00
Jason Simmons
787b9c5376
Break the reference cycle between the surface factory and the external view embedder (#21918)
See https://github.com/flutter/flutter/issues/68315
2020-10-16 15:03:26 -07:00
Chris Bracken
c449c8ee50
Eliminate FLUTTER_NOLINT where possible (#21904)
This removes most of the remaining FLUTTER_NOLINT comments and opts
these files back into linter enforcement.

I've filed https://github.com/flutter/flutter/issues/68273 to require
that all FLUTTER_NOLINT comments be followed by a GitHub issue URL
describing the problem to be fixed.
2020-10-16 12:44:49 -07:00
Mehmet Fidanboylu
abdc8d3853
Forward Error objects to uncaught exception handler if there is one. (#21806) 2020-10-16 08:21:04 -07:00
Kaushik Iska
ab8b2073ed
Fix incldues to be flutter/shell rather than shell/ (#21889) 2020-10-15 16:51:17 -07:00
Jason Simmons
c7e5d546f2
Prevent a race between SurfaceTexture.release and updateTexImage (#21777) 2020-10-14 15:02:02 -07:00
Kaushik Iska
df57e21529
[android] Refactor surface factory and wire in external view embedder (#21839) 2020-10-14 14:27:02 -07:00
Jason Simmons
2e3f1326d2
Call PlatformView.dispose when removing hybrid composition platform views (#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
9981026173
Allow TalkBack navigation while a platform view is rendered (#21719) 2020-10-13 17:52:02 -07:00
Yuqian Li
c2938d06b1
Revert "Migration to PlatformDispatcher and multi-window #20496" (#21792)
* Revert "Fix documentation build for window changes. (#21780)"

This reverts commit 931a04683d6eb49fc92059b2384ac5b1618d5422.

* Revert "Migration to PlatformDispatcher and multi-window (#20496)"

This reverts commit 85b0031f73544e448354047dc6a236c0b0808252.
2020-10-12 19:26:41 -07:00
Greg Spencer
85b0031f73
Migration to PlatformDispatcher and multi-window (#20496)
This is a PR for converting the dart:ui code in the engine to use a multi-window API. The goal here is to convert from the window singleton to an API that has the concept of multiple windows. Also, I'm matching up the new PlatformDispatcher class to talk directly to the PlatformConfiguration class in the engine. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows. The multi-window API in this PR currently only ever creates one window.

The design doc for this change is here.

The major changes in this PR:

Move the platfom-specific attributes out of Window, and into the new PlatformDispatcher class that holds all of the platform state, so that the platform code need only update the configuration on this class.
Create FlutterView, FlutterWindow, and SingletonFlutterWindow classes to separate out the concepts of a view (of which there may be multiple in a window), a window (of which there may be multiple on a screen, and they host views), and a window where there is only ever expected to be one (this hosts the entire API of the former Window class, and will eventually be the type of the window singleton).
Next step after this PR lands:

Remove the Window class entirely (it is replaced by SingletonFlutterWindow). Some minor changes in the Framework are needed to switch to using SingletonFlutterWindow directly first.

The Window class still exists in this PR, but will be removed as soon as the framework is converted to point to the SingletonFlutterWindow class instead. They share the same API, just have different names (Window is currently a subclass of SingletonFlutterWindow). The intention is that the Window name will be freed up to use as a widget class name in the framework for managing windows. The singleton called window will remain, and keep the same API it has now.
2020-10-09 16:29:16 -07:00
Dan Field
48687ca3ca
Forbid android.util.Log (#21696) 2020-10-08 14:52:05 -07:00
Hamdi Kahloun
b2ace0cccb
SecurityException: Permission Denial (#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
Jonah Williams
15c587404c
Preserve specified AssetResolvers when performing a hot restart or updating the asset directory (#21611)
Follow up from #21436 . That PR works for all embeddings except for Android, which creates a special JNI AssetResolver. Since the shell cannot recreate this resolver, update the logic to preserve existing resolvers instead.
2020-10-08 09:22:01 -07:00
Emmanuel Garcia
aab33c155a
Ensure JNI is not called from raster thread (#21665) 2020-10-07 16:37:02 -07:00
Jason Simmons
43828e86fa
Workaround for an Android emulator EGL bug that can cause inaccurate GL version strings (#21258) 2020-10-02 12:17:02 -07:00
Jason Simmons
88fd4cea43
Extract the WindowInsetsAnimation.Callback subclass into a separate class that will be lazily loaded (#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
83b9df9df5
Revert "Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (#21163)" (#21513)
This reverts commit 539034ae850d422a5449edcb36c60ad90ac91905.
2020-09-30 09:34:05 -07:00
Greg Spencer
539034ae85
Use dispatchKeyEventPreIme, and handle keys sent to InputConnection.sendKeyEvent on Android (#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
Kaushik Iska
149df4318d
Reland multiple display support for embedder API (#21464) 2020-09-28 12:35:34 -07:00
Kaushik Iska
8d165faca1
Revert multiple display support for embedder API (#21456)
This reverts commits
- 67fdd7ededcbb161a857cc187619ae115c8c8e7f.
- 854943d5c8670a241524b71945b2c8ca77246556.

See: https://github.com/flutter/flutter/issues/66829
2020-09-28 09:46:46 -07:00
Emmanuel Garcia
db9991279d
Support dragging native platform views (#21396) 2020-09-25 17:46:34 -07:00
Kaushik Iska
67fdd7eded
Embedder API Support for display settings (#21355)
Embedders can now notify shell during startup about the various displays and their corresponding settings.
Adds a notion of Display update type which can later include chages to displays during runtime such as addition / removal / reconfiguration of displays.

We also remove the responsibility of providing the refresh rate from `vsync_waiter` to `DisplayManager`.
Rewires existing platform implementations of the said API to use `Shell::OnDisplayUpdate` to notify the display manager of the startup configuration.

DisplayManager is also thread-safe to account for rasterizer and UI thread accesses.
2020-09-25 11:04:10 -07:00
Gary Qian
de3db5db92
Locale -> LanguageRange conversion to be more general in Android platformResolvedLocale (#21350) 2020-09-23 21:52:02 -07:00
Jason Simmons
1345359642
Fix boolean value checks in StandardMessageCodec (#21270)
Fixes https://github.com/flutter/flutter/issues/65619
2020-09-23 16:31:07 -07:00
xster
caa8e6dd9f
Re-land deprecate Android v1 embedding classes (#21347) 2020-09-23 11:25:20 -07:00
Jason Simmons
034ab2e18e
Retain the WindowInsetsAnimation callback if code shrinking is enabled (#21330) 2020-09-23 09:17:02 -07:00
Zachary Anderson
c62d665299
Revert "Deprecate Android v1 embedding classes (#20868)" (#21338)
This reverts commit 3011b14a25ea5c9fd54ecffc2e154e587c4a6b1a.
2020-09-22 14:38:18 -07:00
xster
88e53777d1
Enforce exclusivity for activity and fragments attached to the FlutterEngine (#21272) 2020-09-22 10:34:52 -07:00
Jason Simmons
11befe419e
Disconnect the view's AndroidKeyProcessor when detaching from the engine (#21307) 2020-09-21 17:42:02 -07:00
xster
3011b14a25
Deprecate Android v1 embedding classes (#20868) 2020-09-21 15:02:02 -07:00
Gary Qian
933f811d94
Remove extraneous window inset call on IME animation (#21213) 2020-09-16 14:04:50 -07:00
Hamdi Kahloun
8d7103f572
Fix NPE in PlatformPlugin.getClipboardData() (#21189) 2020-09-15 17:00:57 -07:00
Emmanuel Garcia
1ef10b240e
Account for current open image in FlutterImageView (#21191) 2020-09-15 14:10:55 -07:00
kaisa695275735
555d492a61
delete opengl texture when it detatch from surfacetexture. (#18733) 2020-09-14 14:07:39 -07:00
Chris Bracken
08dabe9601
Clean up C++ includes (#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00
Emmanuel Garcia
2b30bec2db
Fix comment indentation (#21114) 2020-09-11 17:50:26 -07:00
Emmanuel Garcia
85a7afa913
Add a new raster status kSkipAndRetry frame (#21059) 2020-09-11 16:29:11 -07:00
Chris Bracken
36f7f3ca82
Copyright header hygiene improvements (#21089)
Add copyright headers in a few files where they were missing.

Trim trailing blank comment line where present, for consistency with
other engine code.

Use the standard libtxt copyright header in one file where it differed
(extra (C) and comma compared to other files in libtxt).

This also amends tools/const_finder/test/const_finder_test.dart to look
for a const an additional four lines down to account for the copyright
header added to the test fixture.
2020-09-11 08:55:37 -07:00
kele86838437
ab0d4b43be
Update Androidx import (#19059) 2020-09-09 16:10:03 -07:00
linxuebin
564367b297
Increase thread priority before engine init (#20922)
We get huge ANRs in not pure flutter app.
We found that 0.15% of the engine initialization took more than 10 seconds, every 10 million starts.
2020-09-09 14:07:34 -07:00
Gary Qian
242d522077
[Android R] Sync keyboard animation with view insets vs Android 11/R/API 30 WindowInsetsAnimation (#20843) 2020-09-04 02:06:30 -07:00
xster
b22a8c69d9
Let FlutterActivity/Fragment/FragmentActivity have an app bundle path override instead of eager resolving during construction (#20769) 2020-09-03 17:31:30 -07:00
Guokai-Cheng
e284598d6d
Ensure the destructor is called since it destroys the EGLSurface before creating a new onscreen surface. (#20916) 2020-09-03 14:32:48 -07:00
Gary Qian
15bf1bbf6f
[Android R] Integrate DisplayCutouts into viewportMetrics (#20921) 2020-09-02 05:18:35 -07:00
Emmanuel Garcia
49d6805324
Ensure all images are closed in FlutterImageView (#20842) 2020-09-01 16:57:45 -07:00
Jason Simmons
d67923feb1
Pass text input key events to the EventResponder if they do not yield characters (#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
5f49a95499
Add auto plugin registration to FlutterFragmentActivity as well (#20865) 2020-08-31 13:43:46 -07:00