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.
Adds --dynamic and --interpreter flags to
tools/gn. These flags result in engines with
properties as follows:
--dynamic:
- JIT targeting native code on Android and
DBC on iOS
--interpreter
- Target DBC even if running on Android.
For example:
gn --android --dynamic --interpreter --runtime-mode release
Will generate an engine:
- Without Dart asserts
- Without Observatory
- With JIT compililation to DBC
into out/android_dynamic_release_dbc
This allows applications to start a Flutter engine instance during app startup
and keep it running throughout the app process' lifetime.
FlutterActivity subclasses can override createFlutterNativeView to provide a
preinitialized FlutterNativeView instance and override retainFlutterNativeView
to signal that the FlutterNativeView should be kept alive when the activity
is destroyed.
* Revert "Roll dart sdk to e6d7d67f4b35556805dd083fed15bf3ed41f7e33. (#5165)"
This reverts commit 75b94b4ea5307c723c6003b9d7a786ac3f22bce1.
* Revert "Enables system chrome customization on Android M/O and greater (#5112)"
This reverts commit f4136be0d552a5b7f1f8bfafc3c5da4a70dda190.
The APKAssetProvider will hold a reference to its Java peer
(see c2b081e229)
After dropping this reference, the UI thread must detach from JNI before exiting.