Skip to content

Cleaning up the Hosting native Android views page#13356

Open
sfshaza2 wants to merge 6 commits into
mainfrom
modernize-android-platform-views
Open

Cleaning up the Hosting native Android views page#13356
sfshaza2 wants to merge 6 commits into
mainfrom
modernize-android-platform-views

Conversation

@sfshaza2

@sfshaza2 sfshaza2 commented May 5, 2026

Copy link
Copy Markdown
Contributor

@sfshaza2 sfshaza2 requested a review from a team as a code owner May 5, 2026 20:00

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sites/docs/src/content/platform-integration/android/platform-views.md Outdated
Comment thread sites/docs/src/content/platform-integration/android/platform-views.md Outdated
@flutter-website-bot

flutter-website-bot commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Visit the preview URL for this PR (updated for commit 87267f8):

https://flutter-docs-prod--pr13356-modernize-android-platform-9reff6dv.web.app

@sfshaza2 sfshaza2 requested review from jmagman and reidbaker May 5, 2026 20:16
@reidbaker reidbaker requested review from gmackall and removed request for reidbaker May 5, 2026 20:16
Comment thread sites/docs/src/_includes/docs/platform-view-perf.md Outdated
Comment thread sites/docs/src/_includes/docs/platform-view-perf.md Outdated
Comment thread sites/docs/src/content/platform-integration/android/platform-views.md Outdated
@sfshaza2 sfshaza2 requested a review from gmackall May 6, 2026 04:00
@sfshaza2

sfshaza2 commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

@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` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment about best performance also applies here

@parlough

parlough commented Jun 1, 2026

Copy link
Copy Markdown
Member

@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.

@flutter-website-bot

flutter-website-bot commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

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

@sfshaza2

Copy link
Copy Markdown
Contributor Author

/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 |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Suggested change
| **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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Developers will be confused about which Android platform view mode to use

4 participants