672 Commits

Author SHA1 Message Date
Matt Carroll
ff8b678e99 Android Embedding Refactor PR31: Integrate platform views with the new embedding and the plugin shim. (flutter/engine#9206) 2019-07-01 17:34:37 -07:00
Matt Carroll
1596cc6c63 Fixes a plugin overwrite bug in the plugin shim system. (flutter/engine#9589) 2019-07-01 15:26:22 -07:00
Amir Hardon
77a2f1c89b Revert "Avoid a full screen overlay within virtual displays (#9343)" (flutter/engine#9581)
This reverts commit 2b66f64511df7de1404802aab5ccbdbb8587244e.
2019-06-28 13:43:23 -07:00
Kaushik Iska
f6482d46e2 [android] External textures must be rescaled to fill the canvas (flutter/engine#9501)
* [android] External textures must be rescaled to fill the canvas

- After composition, we have a tight box that we need to fill.

- Video decoders typically operate using output buffers that are a whole
  number of blocks (vertically and horizontally). This fixes
  https://github.com/flutter/flutter/issues/34641 where the decoded
  dimensions are rounded up.

- The cropping information for the current frame arrives in the form of
  `SurfaceTexture.getTransformMatrix`. When we apply this transform we
  need to account for the fact that we have already composited. This
  means that in cases where the scaleX, scaleY are less than 1, we need
  to rescale the image. We do this while preserving the aspect ratio.
2019-06-26 13:51:14 -07:00
Jason Simmons
e4a2320fdd Simplify loading of app bundles on Android (flutter/engine#9360)
* Remove deprecated runBundle APIs
* Remove code related to dynamic patching (including support for multiple
  bundle paths)
* Change FlutterRunArugments.bundlePath to be the Android AssetManager path
  where the app's assets are located
2019-06-25 14:17:50 -07:00
Amir Hardon
e49d31bbec fix NPE when a touch event is sent to an unknown Android platform view (flutter/engine#9476) 2019-06-25 09:45:20 -07:00
Matt Carroll
59bd2aecc0 Removed unused imports in new embedding. (flutter/engine#9463) 2019-06-25 01:59:33 -07:00
Matt Carroll
71e9854a33 Fixed logLevel filter bug so that filter now works as expected. (flutter/engine#9460) 2019-06-24 23:03:42 -07:00
Amir Hardon
110c63afaf Don't hang to a platform view's input connection after it's disposed (flutter/engine#9423)
Addresses the crash reported in https://github.com/flutter/flutter/issues/19718#issuecomment-504174596
2019-06-24 13:13:00 -07:00
Chris Bracken
009ba77bda Eliminate unused import in FlutterView (flutter/engine#9439)
Eliminates an unused import in FlutterView.java. Fixes import ordering.
2019-06-24 11:17:18 -07:00
Matt Carroll
084284d533 Resolves embedding log chattyness by gating verbose, debug, and info logs by level (#34876). (flutter/engine#9425) 2019-06-21 16:40:32 -07:00
Amir Hardon
2203181ff2 delegate checkInputConnectionProxy to the relevant platform view (flutter/engine#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
Matt Carroll
78bd3aa73b Android Embedding Refactor PR35: Ensure all JNI methods are in FlutterJNI (#34751). (flutter/engine#9391) 2019-06-20 17:13:58 -07:00
Simon Lightfoot
2b66f64511 Avoid a full screen overlay within virtual displays (flutter/engine#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
1959c3d907 Android Embedding Refactor PR34: Fill in missing nullability annotations. (flutter/engine#9384) 2019-06-19 23:44:15 -07:00
Dan Field
4d5f19b50b Wire intent args for observatory port (flutter/engine#9378) 2019-06-19 13:13:13 -07:00
chunhtai
9fe6a47ab6 Introduce read only text field semantics (flutter/engine#9281) 2019-06-19 09:42:23 -07:00
Jason Simmons
1cd5ed308a Do not remove the DartServiceIsolate status callback during FlutterMain destruction (flutter/engine#9368)
FlutterMain and the DartServiceIsolate callback list are both globals, and the
callback list state may have already been destructed when FlutterMain's
destructor runs.
2019-06-18 22:34:04 -07:00
Amir Hardon
4ad78e92cd request FlutterView focus when setting a platform view text client (flutter/engine#9366) 2019-06-18 19:05:36 -07:00
Matt Carroll
adb4934a15 Add APIs for querying FlutterView for a FlutterEngine and listening for attachment/detachment (#29114). (flutter/engine#9356) 2019-06-18 16:34:30 -07:00
Matt Carroll
ffa6ad4bf0 Android Embedding Refactor PR32: Clean up logs in new embedding (#33544, #33102). (flutter/engine#9351) 2019-06-18 15:52:22 -07:00
Matt Carroll
ee7442f238 Android Embedding Refactor PR33: Clean up FlutterJNI (#25533). (flutter/engine#9354) 2019-06-18 15:35:22 -07:00
Jason Simmons
054cb2d952 Use the DartServiceIsolate status callback to publish the observatory URI to the Android embedder (flutter/engine#9337)
The Android embedder had been using a JNI call to get the observatory URI from
DartServiceIsolate.  This call was not thread safe and was redundant with the
server status callback mechanism used on iOS.
2019-06-17 16:17:29 -07:00
Jason Simmons
450c59a900 Send the isolate service ID from the engine to the embedder (flutter/engine#9324)
Applications can use an embedder API to obtain the isolate ID and then use it
in calls to the Dart service protocol.
2019-06-17 16:02:26 -07:00
Gary Qian
9b7873533c Check for invalid indexes when performing InputAdpator backspace. (flutter/engine#9322) 2019-06-17 15:13:30 -07:00
XieRan.sai
17fd7dbc37 Fix crash on Huawei device with AndroidView (flutter/engine#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
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
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
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
Matt Carroll
fb2826eb79 Fixed memory leaks within FlutterFragment and FlutterView (#34268, #34269, #34270). (flutter/engine#9288) 2019-06-11 17:01:20 -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
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
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
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
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
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
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
Matt Carroll
4e26d76bd7 Extracted PlatformViewsChannel from PlatformViewsController. (flutter/engine#7847) 2019-06-03 11:04:33 -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