Cleaning up the Hosting native Android views page#13356
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Android platform views documentation to include the new Hybrid Composition++ (HCPP) mode and provides a comparison matrix for different implementation strategies. The review feedback focuses on improving the clarity and technical accuracy of the documentation, specifically regarding the enablers for HCPP, the use of 'accessibility' over 'a11y', and clarifying the limitations of the Texture Layer mode concerning SurfaceViews and text magnification.
|
Visit the preview URL for this PR (updated for commit 87267f8): https://flutter-docs-prod--pr13356-modernize-android-platform-9reff6dv.web.app |
|
@gmackall, can you check if this is ok? |
|
|
||
| | Mode | Benefits | Considerations | Enabler | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **Texture layer** | • Best Flutter performance<br>• Full widget transforms work | • Janky during quick scrolling<br>• SurfaceViews lose accessibility and text magnifier breaks | Default behavior or standard `AndroidView` | |
There was a problem hiding this comment.
I think we should weaken this to "good" flutter performance. I don't have results from benchmarking here, but abstractly based on the architecture
TLHC: PV -> Renders to Texture -> Uploads to Impeller -> Impeller composites Flutter Content & PV Content
HCPP: PV -> Renders to native android Surface, Impeller renders to native Android Surface, SurfaceFlinger composites the two together
there should be more synchronization work for TLHC to do, so I imagine HCPP would have better flutter performance (though TLHC's flutter performance is still good).
| | Mode | Benefits | Considerations | Enabler | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **Texture layer** | • Best Flutter performance<br>• Full widget transforms work | • Janky during quick scrolling<br>• SurfaceViews lose accessibility and text magnifier breaks | Default behavior or standard `AndroidView` | | ||
| | **Hybrid composition** | • Full native fidelity<br>• Correct accessibility and SurfaceView support | • Causes thread merging, which degrades Flutter FPS | `PlatformViewLink` with `AndroidViewSurface` | |
There was a problem hiding this comment.
Given that flutter's thread merge of (ui and platform) threads is probably what people will think of, we should clarify here that HC's thread merge is (raster and platform)
There was a problem hiding this comment.
Also, on the enabler:
I think what matters here is the AndroidViewController in use. See
https://github.com/flutter/flutter/blob/master/dev/integration_tests/hybrid_android_views/lib/android_platform_view.dart
which builds either a TLHC or a HC PV by swapping them out:
onCreatePlatformView: (PlatformViewCreationParams params) {
print('useHybridComposition=$useHybridComposition');
late AndroidViewController controller;
if (useHybridComposition) {
controller = PlatformViewsService.initExpensiveAndroidView(
id: params.id,
viewType: params.viewType,
layoutDirection: TextDirection.ltr,
);
} else {
controller = PlatformViewsService.initSurfaceAndroidView(
id: params.id,
viewType: params.viewType,
layoutDirection: TextDirection.ltr,
);
}| This approach provides: | ||
|
|
||
| * good performance for Android Views | ||
| * best performance for Flutter rendering |
There was a problem hiding this comment.
comment about best performance also applies here
|
@sfshaza2 Seems Gray already left some comments that are ready to address. Let me know if you need any help or have any issues updating the branch to the new site structure. |
|
Staged preview of the updated docs.flutter.dev site (updated for commit 2954e41): https://flutter-docs-prod--docs-pr13356-modernize-android-plat-5mie5i65.web.app |
|
/gbcrun |
| | :--- | :--- | :--- | :--- | | ||
| | **Texture layer** | • Best Flutter performance<br>• Full widget transforms work | • Janky during quick scrolling<br>• SurfaceViews lose accessibility and text magnifier breaks | Default behavior or standard `AndroidView` | | ||
| | **Hybrid composition** | • Full native fidelity<br>• Correct accessibility and SurfaceView support | • Causes thread merging, which degrades Flutter FPS | `PlatformViewLink` with `AndroidViewSurface` | | ||
| | **HCPP** (Experimental) | • Full fidelity and performance<br>• Solves original sync overhead | • Requires Android API 34+ and Vulkan support | • `<meta-data>` in `AndroidManifest.xml`<br>• `--enable-hcpp` local flag | |
There was a problem hiding this comment.
Also, I forgot to add that HCPP requires impeller in the docs of our markdown, but I've put up a pr to add it there:
flutter/flutter#189382
and we should probably note this here as well
| | **HCPP** (Experimental) | • Full fidelity and performance<br>• Solves original sync overhead | • Requires Android API 34+ and Vulkan support | • `<meta-data>` in `AndroidManifest.xml`<br>• `--enable-hcpp` local flag | | |
| | **HCPP** (Experimental) | • Full fidelity and performance<br>• Solves original sync overhead | • Requires Android API 34+, Vulkan support, and use of the Impeller rendering engine | • `<meta-data>` in `AndroidManifest.xml`<br>• `--enable-hcpp` local flag | |
or similar wording
Fixes #13355
Affected page staged here: https://flutter-docs-prod--pr13356-modernize-android-platform-9reff6dv.web.app/platform-integration/android/platform-views