1157 Commits

Author SHA1 Message Date
Chinmay Garde
22ee8ee08f
Migrate existing embedder unit tests to use the fixture. (#8296)
Also allows tests to specify their own embedder contexts.
2019-03-25 15:10:24 -07:00
Amir Hardon
345ae7d373
Delegate a11y events and action to/from embedded Android platform views. (#8250)
Delegate a11y events and action to/from embedded Android platfrom views.

This handles delegation of:
  * AccessibilityNodeProvider#performAction
  * ViewGroup#requestSendAccessibilityEvent
  * View#onHoverEvent

Additionally updates the currently input accessibility focused node state that is
tracked by the a11y bridge when an embedded view's node is focused.
2019-03-25 14:26:49 -07:00
Chinmay Garde
d6ead18f43
Make it easy to write embedder unit tests by creating a fixture and config builder. (#8276)
All embedder unit-tests have to setup the Flutter project arguments from scratch
before launching the engine. The boilerplate and having to deal with the low
level C API during each engine launch is a hinderance to writing tests.

This patch introduces an EmbedderTest fixture that sets up all the embedder side snapshots before allowing the unit test to create a FlutterConfigBuilder` that
the test can use to incrementally build and edit the Flutter project
configuration. From the given state state of a configuration, multiple engines
can be launched with their lifecylces managed by appropriate RAII wrappers.

This allows the a fully configured Flutter engine to be launched using 4 lines
of code in a fixture.

```
EmbedderConfigBuilder builder;
builder.SetSoftwareRendererConfig();
builder.SetAssetsPathFromFixture(this);
builder.SetSnapshotsFromFixture(this);
auto engine = builder.LaunchEngine();
```
2019-03-25 11:58:38 -07:00
Jason Simmons
68bd4f2c64
Do not drop the DartExecutor's message handler when a FlutterNativeView is detached from the FlutterView (#8254)
An activity can use ViewFactory.retainNativeFlutterView to reuse a
FlutterNativeView across multiple instances of the activity.  In this
scenario, the FlutterNativeView should continue to handle incoming messages
sent from Dart.
2019-03-21 18:08:58 -07:00
Amir Hardon
06635d38a9
Mirror Android platform views a11y tree in the Flutter a11y tree. (#8237)
This PR mirrors virtual a11y tree of embedded platform views in the Flutter
a11y tree.

Non virtual hierarchies are not currently supported.

Only works on Android versions earlier than Android P as it relies on
reflection access to hidden system APIs which cannot be done starting
Android P.

A11y is not yet working as we also need to delegate a11y events from the
platform view to the FlutterView. This will be done in a following PR to
keep the change size a little saner.
2019-03-21 15:26:44 -07:00
Matt Carroll
28433c513c
FlutterJNI no longer asserts it is attached when dispatching platform messages and instead fizzles with a warning if not attached. Not sure what root cause of issue is, but this is necessary to avoid crashes. (#8246) 2019-03-21 13:45:13 -07:00
Jason Simmons
fa435385b6
Use the GPU thread for Android surface on-screen context lifecycle operations (#8234)
Fixes https://github.com/flutter/flutter/issues/29679
2019-03-20 17:43:53 -07:00
Matt Carroll
188adf7e5e
Removed Activity reference from AccessibilityBridge by using a View for insets instead of the Activity (#18115) (#8231) 2019-03-20 14:18:34 -07:00
stuartmorgan
d452dd5c36
Initial import of GLFW Linux shell from FDE (#8159)
Changes include:
- File structure
- Header guards
- Include paths
- Namespaces
- Integration with the engine's GN build
- Conversion from jsoncpp to rapidjson
- Style and clang-format adjustment to match engine repository
2019-03-20 17:15:52 -04:00
Amir Hardon
6a8a45fc4f
Have the AccessibilityBridge attach/detach itself to the (#8229)
PlatformViewsDelegate.

Since onDetachedFromWindow can be called after the activity was
destroyed, the previous call to detach the accessibility bridge could
have crash as the NativeFlutterView was already null.
2019-03-20 12:26:30 -07:00
Matt Carroll
1dbd2046b5
Moved io.flutter.embedding.engine.android package to io.flutter.embedding.android (#8221) 2019-03-20 11:30:49 -07:00
Kaushik Iska
a1dcb2ea98
[ios] Set contentsScale before we commit CATransaction (#8218)
Layout occurs after [CATransaction commit]. layoutSubviews was where we set the contentsScale on the CALayer. This meant that for one frame, we would see content on the overlay view which was did not have the correct content scale.

This change makes it so that we initialize the FlutterOverlayView with the correct contentsScale.

This also updates the overlay_gr_context_ when we first create the overlay_view. This is an artifact of #8175.

This manifests as jank as seen in: flutter/flutter#29573
2019-03-19 16:36:11 -07:00
Francisco Magdaleno
fa1931f6a0
Send macOS keyboard data to the engine (#8219) 2019-03-19 15:58:11 -07:00
Amir Hardon
45f69ac471
Plumb a reference of PlatformViewsController and AccessibilityBridge to each other (#8208)
This is in preparation for implementing platform views a11y on Android.

And e2e working prototype is available here: https://github.com/amirh/engine/tree/a11y_hacks

flutter/flutter#19418
2019-03-19 15:48:45 -07:00
Dan Field
bc8ebcb96b
Export FlutterSemanticsUpdateNotification and improve docs (#8203)
* Export FlutterSemanticsUpdateNotification and improve docs
2019-03-18 19:32:49 -07:00
Chinmay Garde
ad5b722a72
Simplify the fallback waiter and add traces for vsync scheduling overhead. (#8185) 2019-03-18 15:49:16 -07:00
Chris Yang
6980a83563
[platform_view] iOSP platformView composition optimize. (#8202)
Optimize the performance of the platform view composition.
When recomposition is required, we previously remove all the platform view related views (intercepting view, platform view) and re-add them for each frame. This is mentioned in flutter/flutter#23793.
This PR enhanced the performance by re-arrange the existing UIViews and only add the newly created Views.

As a result, it would also fix flutter/flutter#29427
2019-03-18 15:38:40 -07:00
Amir Hardon
629072277d
Merge only gpu and platform threads for platform views, fix deadlock. (#8045)
The reason we didn't merge just the gpu and platform threads from the get go was a deadlock in Shell:OnPlatformViewCreated and Shell:OnPlatformViewDestroyed.

The deadlock was caused by the platform thread starting a thread-hopping flow that ends ends up with the gpu thread releasing a latch that the platform thread is waiting on just after starting the cross-thread dance.
If the platform and gpu threads are the same, that last task that is posted to the gpu thread will never get executed as the gpu/platform thread is blocked on a latch.

This works around the deadlock by having a special case in the code for the scenario where the gpu and platform threads are the same.

Fixes: flutter/flutter#23974
2019-03-18 14:13:30 -07:00
liyuqian
015c0246ae
Fix log level typo from ERROR to INFO (#8180)
The old typo is probably caused by
https://github.com/flutter/flutter/issues/29320 which has just been
fixed.

TBR: chinmaygarde@google.com
2019-03-15 14:01:23 -07:00
Kaushik Iska
cad97fe746
Update overlays_gr_context_ correctly (#8175)
There can be cases where SubmitFrame gets called
before overlays are a part of the frame, in these
cases, we should not update the GRContext ahead of time.

This commit makes it so we will update it only when
the frame really shows the overlay.

This addresses: https://github.com/flutter/flutter/issues/28920
2019-03-15 08:35:48 -07:00
Matt Carroll
b32d0ab982
Bugfix: Prevent crash when responding to a platform message after FlutterJNI detaches from native (#28651). (#8170) 2019-03-14 21:13:03 -07:00
Chinmay Garde
4b01d795fe
Add frame and target time metadata to vsync events and connect platform vsync events using flows. (#8172)
This will allow us to easily visualize the time the platform informed the engine of a vsync event, its arguments, and when the engine began its UI thread workload using this information.
2019-03-14 16:48:01 -07:00
Matt Carroll
09db84fad6
Android Embedding PR 19: Add accessibility to new FlutterView. (#8109) 2019-03-14 14:24:49 -07:00
Chinmay Garde
246f0e3f4a
Add an allocator specific check to ensure that strings passed to the timeline are not heap allocated. (#8168)
Verified that the tests fail on issues like https://github.com/flutter/engine/pull/8166. Unfortunately, there is no x-platform way to perform this check but this should gate incorrect traces being added to the engine.
2019-03-14 14:15:46 -07:00
liyuqian
66fdeb163e
Add dump-shader-skp switch to help ShaderWarmUp (#8148)
Allow Flutter to automatically dump the skp that triggers new shader compilations. This is useful for writing custom ShaderWarmUp to reduce jank. By default, it's not enabled to reduce the overhead. This is only available in profile or debug build.

Later, we can add service protocol support to pull the skp from the client to the host. Currently, it works fine for Android-based devices (including our urgent internal clients) where we can `adb shell` into the cache directory.
2019-03-14 12:58:09 -07:00
Jason Simmons
fcc66fc235
Suppress deprecation warning for use of Build.CPU_ABI (#8154) 2019-03-13 14:36:35 -07:00
Jason Simmons
b1b388f1c2
Encode scroll motion events in the Android touch processor (#8149) 2019-03-13 11:30:42 -07:00
Jason Simmons
9f50dae33f
Look up ICU symbols based on the path to libflutter.so as a fallback (#8139)
The ICU data is packaged within libflutter.so, and the engine uses
dlsym(RTLD_DEFAULT) to look up the ICU data symbols in the libraries
loaded by the process.

This approach apparently fails on some Xiaomi devices.  If RTLD_DEFAULT
can not find the symbols, then the platform will pass the path to the
libflutter.so library so the engine can use that to resolve the symbols.

Fixes https://github.com/flutter/flutter/issues/28208
2019-03-12 18:33:33 -07:00
Matt Carroll
8b0df6ded5
Bugfix #29203: NPE in getAccessibilityProvider in old FlutterView. (#8126) 2019-03-11 23:45:03 -07:00
Matt Carroll
20165b3147
Integrated AndroidTouchProcessor within the old FlutterView (#8095) 2019-03-11 16:04:44 -07:00
Michael Goderbauer
bd0f9085e5
Adds a platfromViewId to SemanticsNode (#8055) 2019-03-11 11:30:35 -07:00
Dan Field
0d2cf5857b
Fix the Windows build (#8106)
* Make macro for logging embedder errors build on Windows
2019-03-10 10:46:27 -07:00
Chinmay Garde
a28b530073
Log non-kSuccess returns from embedder API calls. (#8096)
Embedders don’t realize that some calls to the API return an error and don’t handle the same. Log such erroneous returns.
2019-03-09 20:04:16 -08:00
Jonah Williams
4e54bc93ca
Guard initialization of touch exploration listener (#8103) 2019-03-09 15:07:26 -08:00
Dan Field
dc216bdcf0
Fix typo (#8102)
programatically -> programmatically
2019-03-09 08:58:07 -08:00
Chinmay Garde
03d5f3c2d1
Clarify arguments to FlutterEngineOnVsync (#8093) 2019-03-08 18:09:17 -08:00
Matt Carroll
718329ce6e
Android Embedding PR 17: Clarify AccessibilityBridge and move logic out of FlutterView. (#8061) 2019-03-08 18:09:04 -08:00
Matt Carroll
edfc0cfaaf
Android Embedding PR 16: Add touch support to FlutterView. (#8034) 2019-03-08 18:08:26 -08:00
Chinmay Garde
3c8ef04e91
Allow embedders to post tasks onto the render thread. (#8089)
Some embedders may have to wait on fences asynchronously before committing
contents. This allows them to post a task onto the engine managed thread used
for rendering.
2019-03-08 16:30:48 -08:00
Michael Klimushyn
1d10e0eb67
Guard against NewAPI failures (#8048)
Adds minimum SDK checks around minimum APIs.

flutter/flutter#28848
2019-03-08 13:33:58 -08:00
liyuqian
87edd94e9c
Add read-only persistent cache (#8049)
Some clients (e.g., embedded devices) prefer generating persistent cache files for the specific device beforehand, and ship them as readonly files in OTA packages.
2019-03-08 12:15:45 -08:00
Core
260669c65e Fix deleting text when the last character is some special characters on IOS (#7982) 2019-03-08 10:47:06 -08:00
Chris Bracken
a48cd16e07
Update a11y word forward/back enum names (#8073)
This updates the FlutterSemanticsAction enumerator identifiers for the
'move cursor forward/back one word' actions (added in
flutter/engine#8033) for consistency with the 'move cusor forward/back
on character' identifiers.

ABI compatibility is unaffected, but this with require the following
change in any embedder making use of these fields:

Rename:
    kFlutterSemanticsActionMoveCursorForwardByWordIndex
to:
    kFlutterSemanticsActionMoveCursorForwardByWord

Rename:
    kFlutterSemanticsActionMoveCursorBackwardByWordIndex
to:
    kFlutterSemanticsActionMoveCursorBackwardByWord
2019-03-07 16:46:44 -08:00
Chinmay Garde
b5f59ed89d Delay the vsync callback till the frame start time specified by embedder. (#8072)
The current assumption is that the embedder will wait till the vsync event and
then fire the callback. However, some embedders have that information upfront.
Since the time point has already been specified by the embedder, there is no
reason to burden the embedder with having to setup a wait either.
2019-03-07 16:28:22 -08:00
Dan Field
7426305f5d
Mark const extern (#8077)
* Mark const extern

* fix build
2019-03-07 16:10:03 -08:00
Jonah Williams
ca0bac4fb0
Revert "add signal to pointer kinds" (#8066) 2019-03-06 20:55:34 -08:00
Dan Field
a93d99db98
A11y callback (#8005)
* implement callback for a11y readiness
* use FlutterSemanticsUpdateNotification from header, move to VC header
2019-03-06 16:53:14 -08:00
Gary Qian
3661d5e43b
Re-land "Buffer lifecycle in WindowData" (#8032) 2019-03-06 15:38:34 -08:00
stuartmorgan
471a2c89a6
Send scroll events from the macOS shell (#8056)
Adds scroll event handling to the macOS shell, sending them using the
new embedding API.

Currently, trackpad scrolling is just handled like scrollwheel
scrolling, since the trackpad-gesture-based scroll handling in Flutter
is still in progress.

Adds code to synthesize Add events if mouse tracking isn't enabled,
so that it doesn't rely on Flutter being lenient about handling events
from pointers that have never been added.
2019-03-06 13:15:01 -08:00
Chinmay Garde
e37bd27b48
Fix weak pointer use violations in shell and platform view. (#8046) 2019-03-05 15:21:06 -08:00