* Flush all embedded Android view on hot restart.
Adds an OnEngineRestarted method to PlatformView, this is currently only
implemented for Android where we need to use it for embedded views.
* review comments followup
* rename to OnPreEngineRestart, call before Clone
Instead, send them with the new unknown PointerDeviceKind.
We hit this when running `adb shell input tap` in tests which sends events with
an unknown tool type.
This also fills in a missing conversion for TOOL_TYPE_ERASER.
* Add an explicit `-[FlutterViewController init]` implementation
`-[FlutterViewController init]` currently works because it inherits
the `-[UIViewController init]` convenience initializer that invokes
the `-[UIViewController initWithNibName:bundle:]` designated
initializer that `FlutterViewController` overrides.
However, this doesn't seem to be explicitly documented, so it's a bit
confusing (or at least non-obvious), and it seems potentially
brittle. Add an explicit implementation of `-[FlutterViewController
init]` instead.
* Deprecate -[FlutterDartProject initFromDefaultSourceForConfiguration] (#18886)
`-[FlutterDartProject initFromDefaultSourceForConfiguration]` no
longer seems very useful. It calls `-initWithPrecompiledDartBundle:`
or `-initWithFlutterAssets:dartMain:packages:`, but since it now
passes `nil` for all arguments, both paths end up doing the same
thing.
Additionally, `-initFromDefaultSourceForConfiguration` is awkward to
use in Swift. The automatically generated Swift interface is:
public convenience init!(fromDefaultSourceForConfiguration: ())
and it's not obvious how to call that.
Let's deprecate `-initFromDefaultSourceForConfiguration` and instead
expect callers to use the existing `-init` method. (We can make
`-init` do different things for different build configurations later
if necessary.)
Bonus: Rename some parameters to make it more obvious when they may
be `nil`.
Don't emit a "VSYNC" event when running on Fuchsia, as traces on Fuchsia
are typically recorded across the whole system, causing the events to
collide with each other.
Since frontend_server --incremental doesn't support --link-platform, instead of baking host app into the snapshot, load it from kernel file when running in debug mode.
When the FlutterView's window loses focus Flutter cannot bring up the
keyboard (so e.g tapping on text fields doesn't work).
This workaround makes sure that Flutter text fields are working but
unfortunately now the embedded Android view cannot bring up the keyboard
as it's window is not focused.
Submitting this until as a stop gap while we're trying to figure out if
it's possible to allow both windows to bring up the keyboard.
Each platform view created (by a plugin supplied factory) is attached to
a virtual display.
The virtual displays are controlled by VirtualDisplayController objects.
The PlatformViewsController maintains a mapping from a platform view's
id to its VirtualDisplayController, which allows it to operate on the
virtual display for a given platform view ID when asked so over the
method channel.
This is using API level 20 APIs, on lower API levels all platform views
method channel calls are noops.
We can make this work on API 19 with some refactoring to the
TextureRegistry (allow the engine Java code to recycle a texture entry
id).
This CL also adds a platform view id parameter to the
PlatformViewFactory#create() method. This allows plugins to route
platform channel messages to specific instances of a platform view.
TBD in future CLs:
* Forward touch events to the platform views.
* Support accessibility for platform views.
flutter/flutter#19030
To keep the scope of this CL as small of possible I'm leaving the actual
implementation of the platform view mechanics to a following CL.
This CL introduces:
* A PlatformViewsController class which will be responsible for creating,
resizing, and disposing platform views.
* A PlatformViewRegistry which is exposed through the PluginRegistry
and allows plugins to register factories for platform views.
Android plugin code will add support for a new platform view type by
implementing PlatformViewFactory, and registering a factory with the
registry, e.g:
```java
registrar.platformViewRegistry().registerViewFactory(
'webview',
new FlutterWebViewFactory()
);
```
On the Dart side, the framework will ask the engine to create new
platform views by sending a create message over the platformviews method
channel with the unique platform view type id, dimensions, and a unique
id allocated by the framework for the new platform view instance.
The platformviews method channel is also used for resizing and disposing
platform views.