-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement PlatformViewsController. #5722
Conversation
Framework side and plugin side CLs are in progress. |
Framework code is available in: flutter/flutter#19325 |
Sample plugin implementation is available here: flutter/plugins#657 |
@jason-simmons @Hixie This PR is now ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -51,48 +63,145 @@ public PlatformViewRegistry getRegistry() { | |||
} | |||
|
|||
public void onFlutterViewDestroyed() { | |||
// TODO(amirh): tear down all vd resources. | |||
for (int id : vdControllers.keySet()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can iterate over vdControllers.values() here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
switch (call.method) { | ||
case "create": | ||
createPlatformView(call); | ||
break; | ||
mFlutterView.post(new Runnable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These messages should be received on the platform thread. Does something fail if you call createPlatformView directly here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks
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
This reverts commit 80a85e4.
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:
flutter/flutter#19030