1914 Commits

Author SHA1 Message Date
Jason Simmons
6336502de9 Handle one-way platform messages in the embedder library (flutter/engine#9331)
Messages sent to the embedder host may be one-way messages with no response
handler.  If the host calls FlutterEngineSendPlatformMessageResponse on a
one-way message, then just delete the message response handle.

Also update the documentation to indicate that
FlutterEngineSendPlatformMessageResponse must be called for all messages.
Previously the docs implied that some FlutterPlatformMessage objects may
have a null response_handle.  The embedder will now set a response_handle for
every message (even if the sender does not expect a response).
2019-06-14 13:58:09 -07:00
Michael Klimushyn
177353d759 Fix a11y in embedded Android views post O (flutter/engine#9321)
This patch works around Android's limitations on reflection. With it embedded
platform views that use virtual node hierarchy trees should be accessible on all
Android versions to date.

The workarounds in this PR are brittle. Ideally the methods would be made public
in Android instead so we wouldn't need to employ tactics like these to work
around the missing methods.

`AccessibilityNodeInfo#getChildId` is blocked from any type of reflection
access, but the underlying private member that the getter accesses,
`mChildNodeIds`, can still be reflected on. On Android versions where we can't
access the getter, this patch falls back on reflectively accessing the field
instead. Unfortunately this field is a
[`LongArray`](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util/LongArray.java),
a utility data class private to Android. So in this case we're reflecting to
both access the member and actually read data from it, since we need to use
reflection to call `LongArray.get(index)`.

`AccessibilityNodeInfo#getParent()` doesn't have any lucky available underlying
members. However, `AccessibilityNodeInfo` itself is `Parcelable`, and
`mParentNodeId` is one of the pieces of data that's written to a parcel via
`AccessibilityNodeInfo#writeToParcel`. So the fallback for that is to write the
node to a parcel and then read the parcel for the ID in question. This will
break if the implementation details of `AccessibilityNodeInfo#writeToParcel`
ever change. The details have already changed enough in the past to require two
sets of logic for reading from the parcel.
2019-06-14 11:43:41 -07:00
Todd Volkert
8ad6910047 Fix rawTypes errors in Android embedding classes (flutter/engine#9326) 2019-06-14 00:27:06 -07:00
Jason Simmons
31d498ce5c Build the GLFW shell on Linux host builds but not target builds (flutter/engine#9320)
Linux targets building the embedder library may be targeting environments
that do not support GLFW and GTK.
2019-06-13 16:22:33 -07:00
gaaclarke
686215ac99 Added class docstrings for classes inside of shell/common. (flutter/engine#9303)
Added class docstrings for classes inside of shell/common.
2019-06-13 16:15:10 -07:00
Francisco Magdaleno
344f8e359c [macos] Adds clipboard string read/write support to macOS (flutter/engine#9313) 2019-06-13 15:15:20 -07:00
Jason Simmons
73b80c1efb Only build embedder unit tests for host builds (flutter/engine#9315)
Linux target builds for non-x86/x64 platforms were failing due to the
dependency on SwiftShader
2019-06-13 12:49:10 -07:00
Jenn Magder
23b2997ec0 Decorate UIApplicationDelegate wrappers with matching UIKit deprecation (flutter/engine#9304) 2019-06-13 10:16:42 -07:00
Jason Simmons
520c272514 When running in AOT modes create a flutter_assets directory that can be used as the bundle path (flutter/engine#9306)
The engine RunBundleAndSnapshotFromLibrary API expects a bundle path directory
containing the application's assets.  If the Android embedding is using
AOT ELF library packaging and does not need to extract assets, then create an
empty directory at the bundle path.

Fixes https://github.com/flutter/flutter/issues/34287
2019-06-12 17:34:02 -07:00
Chinmay Garde
c45b5c0dee Wire up Swiftshader based OpenGL ES unit-tests on hosts. (flutter/engine#9264)
Currently, all our host unit-tests that have rendering concerns use the software backend because of OpenGL ES availability and stability issues on the various platforms where we run host tests. Unfortunately, entire subsystems are disabled (and not tested) when rendering with the software backend. This patch pulls in SwiftShader and via pending patches in the buildroot, configures the host unit-tests to optionally use OpenGL ES in a stable manner without relying on the OpenGL drivers being present (and functional).

I have wired up the embedder test fixture in this patch to use the SwiftShader based OpenGL ES driver. I will update the shell and runtime unittests in a subsequent patch as well. The on and offscreen surfaces are configured as 1x1 pbuffer surface because we should be able to write pixel tests using OpenGL directly wihout having to deal with surfaces.
2019-06-12 12:32:09 -07:00
Zachary Anderson
35107c4dca Revert tracing changes (flutter/engine#9296)
* Revert "[fuchsia] Fix alignment of Fuchsia/non-Fuchsia tracing (#9289)"

This reverts commit e7d406fe36790b1a8161d4687a6a4a144ba44254.

* Revert "Align fuchsia and non-fuchsia tracing (#9199)"

This reverts commit 1ccb372e5f8ceaaf90f5b43b42df617d7f18d955.
2019-06-12 10:25:49 -07:00
Dan Field
899cd81833 [iOS] [a11y] Don't allow scroll views to grab a11y focus (flutter/engine#9282) 2019-06-11 18:02:47 -07:00
Matt Carroll
fb2826eb79 Fixed memory leaks within FlutterFragment and FlutterView (#34268, #34269, #34270). (flutter/engine#9288) 2019-06-11 17:01:20 -07:00
liyuqian
fe0db192d9 Report timings faster (100ms) in profile/debug (flutter/engine#9287)
This should satisfy the low-latency need of DevTools.

Test added:
* ReportTimingsIsCalledSoonerInNonReleaseMode
* ReportTimingsIsCalledLaterInReleaseMode
2019-06-11 16:51:20 -07:00
stuartmorgan
87070e4145 Add refresh callback to GLFW shell (flutter/engine#9280)
In some cases, the window needs to be redrawn without a resize. This
adds a callback for that case to trigger a repaint.

Since there's no embedding API for repainting, trigger it with a window
metrics event using the current window size.

Fixes https://github.com/flutter/flutter/issues/30731
2019-06-11 16:16:14 -07:00
Matt Carroll
6aed5635cd Expose a hasRenderedFirstFrame() method in FlutterView (#34275). (flutter/engine#9285) 2019-06-11 15:47:04 -07:00
Matt Carroll
aaee816c89 Fix TextInputPlugin NPE caused by PlatformViewsController ref in new embedding (#34283). (flutter/engine#9283) 2019-06-11 15:21:55 -07:00
stuartmorgan
0c39e8283e Fix crash on minimize with GLFW shell (flutter/engine#9278)
Fixes a divide-by-zero in pixel density computation.
2019-06-11 11:50:19 -07:00
Jason Simmons
888d951d19 Load AOT compiled Dart assets only from ELF libraries (flutter/engine#9260)
Previously AOT compiled Dart code would be packaged as a group of assets
within the APK.  This has been replaced by a single ELF library containing
the same data.
2019-06-11 10:10:45 -07:00
Chinmay Garde
b01f09fea6 Whitelist the —enable_mirrors flag to fix regression in existing embedder. (flutter/engine#9266) 2019-06-11 10:09:16 -07:00
Dan Field
903bb51f0e Unbreak internal rolls (flutter/engine#9270)
Adds back constructor for Rasterizer temporarily
2019-06-11 08:52:41 -07:00
Matt Carroll
b29ba6d09d Removed VIRTUAL_KEYBOARD check in TextInputPlugin because it's blocking Espresso work and its purpose is unknown. (flutter/engine#9238) 2019-06-10 13:30:39 -07:00
liyuqian
43f4c1d3c7 Make flow layers' attributes immutable (flutter/engine#9176)
For https://github.com/flutter/flutter/issues/33807

We still need to make layers' children immutable for full immutability.
That will require us to change the SceneBuilder API to build the layer
bottom up instead of top down (post-order traversal instead of pre-order
traversal).
2019-06-10 13:09:37 -07:00
Amir Hardon
8fcd81b36a Reland "Keyboard support for embedded Android views. (#9203) (flutter/engine#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
Wu Zhong
cdfbefc864 Correct typo (flutter/engine#9244) 2019-06-09 09:06:43 -07:00
Jonah Williams
162f3b9e38 Revert "Keyboard support for embedded Android views. (#9203)" (flutter/engine#9239) 2019-06-07 18:21:57 -07:00
Dan Field
c64bdc2629 Document AccessibilityBridge.java (flutter/engine#9237) 2019-06-07 16:00:38 -07:00
Ben Konyi
00de8257d5 Remove unnecessary whitelisted flags for --dart-flags (flutter/engine#9233) 2019-06-07 14:43:43 -07:00
Amir Hardon
5f0df6eba8 Keyboard support for embedded Android views. (flutter/engine#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
Jason Simmons
2e011a7df5 Update Engine::ReportTimings to use the new FML_TRACE macros (flutter/engine#9215) 2019-06-06 10:58:59 -07:00
liyuqian
fb0ea0ef4c Add onReportTimings and FrameRasterizedCallback API (flutter/engine#8983)
Using it, a Flutter app can monitor missing frames in the release mode, and a custom Flutter runner (e.g., Fuchsia) can add a custom FrameRasterizedCallback.

Related issues:
https://github.com/flutter/flutter/issues/26154
https://github.com/flutter/flutter/issues/31444
https://github.com/flutter/flutter/issues/32447

Need review as soon as possible so we can merge this before the end of May to catch the milestone.

Tests added:
* NoNeedToReportTimingsByDefault
* NeedsReportTimingsIsSetWithCallback
* ReportTimingsIsCalled
* FrameRasterizedCallbackIsCalled
* FrameTimingSetsAndGetsProperly
* onReportTimings preserves callback zone
* FrameTiming.toString has the correct format

This will need a manual engine roll as the TestWindow defined in the framework needs to implement onReportTimings.
2019-06-06 10:42:48 -07:00
Amir Hardon
a7c1f0c283 Revert "Switch PlatformViewsController from Activity ref to Application ref. (#9193)" (flutter/engine#9211)
This reverts commit ff4e1cc751f66f87de0b9277a8aa1ffacc68809c.
2019-06-06 09:29:10 -07:00
Dan Field
1ccb372e5f Align fuchsia and non-fuchsia tracing (flutter/engine#9199) 2019-06-05 15:14:27 -07:00
Matt Carroll
ff4e1cc751 Switch PlatformViewsController from Activity ref to Application ref. (flutter/engine#9193) 2019-06-05 14:24:16 -07:00
Greg Spencer
722d833715 Add the key event source, vendorId, and productId from Android (flutter/engine#9186)
This adds the key event source from Android so that the framework can differentiate between keyboard events and game controller events. Also added vendor and product ids so that Flutter code can decide to do special processing based on the kind of device, if desired.
2019-06-04 16:46:23 -07:00
Ben Konyi
ec114a767e Allow for whitelisted flags to be passed to the Dart VM (flutter/engine#9148)
* Allow for whitelisted flags to be passed to the Dart VM

Fixed part of https://github.com/flutter/flutter/issues/32176
2019-06-04 14:51:29 -07:00
Amir Hardon
b90961e0a3 Fix platform views channel regression (flutter/engine#9185)
This regression was introduced in #7847.

The PlatformViewsChannel method call handler was always setting the result to `notImplemented` even after handling a result, this resulted in a "Reply already submitted" exception being thrown.
Note that the method channel code is swallowing this exception and logging an error, so we didn't crash instead we were logging an error(this is why the integration test didn't fail).

Filed https://github.com/flutter/flutter/issues/33863 to make sure tests fail when such exceptions are thrown.

This PR also cleans up an unused `NoSuchPlatformViewException` that was introduced in #7847.

https://github.com/flutter/flutter/issues/33866
2019-06-04 12:38:38 -07:00
Emmanuel Garcia
4fcb1520ed Revert change by mistake: extract resources (flutter/engine#9180) 2019-06-03 23:44:46 -07:00
Emmanuel Garcia
63f6cd7409 Use shared library when libapp.so is found (flutter/engine#9172) 2019-06-03 16:23:28 -07:00
Chris Yang
33d335d61e Do nothing if the params didn't change when compositing iOS platform views. (flutter/engine#8999) 2019-06-03 13:08:29 -07:00
Matt Carroll
4e26d76bd7 Extracted PlatformViewsChannel from PlatformViewsController. (flutter/engine#7847) 2019-06-03 11:04:33 -07:00
stuartmorgan
ea35ff30c0 Copy the macOS podspec during builds (flutter/engine#9158)
The podspec must be copied to the build output root, otherwise
--local-engine won't work in projects containing plugins.

Mirrors the iOS podspec copy rule.
2019-05-31 17:22:09 -07:00
Kevin Lindkvist
0a6a20fa55 Remove references to Fuchsia's ContextWriter (flutter/engine#9157) 2019-05-31 16:12:07 -07:00
Dan Field
7513edc9c2 Preserve safe area (flutter/engine#8848)
Preserve safe area on Window regardless of insets.
2019-05-31 09:24:38 -07:00
Jason Simmons
3e6486cb34 Always run the resource extractor in FlutterMain (flutter/engine#9149)
FlutterMain.findAppBundlePath is using the presence of the flutter_assets
directory as a signal that the app is initialized.  For consistency,
FlutterMain will run the resource extractor at startup and create
flutter_assets even if no resources need to be extracted.
2019-05-30 16:50:31 -07:00
Jason Simmons
833ee537b7 Suppress an unchecked cast warning in ShimPluginRegistry (flutter/engine#9145) 2019-05-30 13:10:03 -07:00
stuartmorgan
03ec25fb58 Fix type mismatches in C++ standard codec (flutter/engine#9112)
There were some implicit casts in the standard codec implementation that
didn't show up on Linux, but do on Windows.
2019-05-30 10:17:08 -07:00
Chris Yang
1020a201ca Dynamically add certain iOS AppDelegate methods. (flutter/engine#8843) 2019-05-30 09:06:49 -07:00
Matt Carroll
85c5d57ca8 New Plugin API PR5: Integrates plugin lifecycle control with FlutterFragment. (flutter/engine#9083) 2019-05-29 20:46:07 -07:00
Matt Carroll
f21942ddcc Implemented Log proxy that only logs in BuildConfig.DEBUG (#25391). (flutter/engine#9122) 2019-05-29 20:19:29 -07:00