Skip to content

Cleaning up the Hosting native Android views page - #13356

Merged
sfshaza2 merged 13 commits into
mainfrom
modernize-android-platform-views
Jul 17, 2026
Merged

Cleaning up the Hosting native Android views page#13356
sfshaza2 merged 13 commits into
mainfrom
modernize-android-platform-views

Conversation

@sfshaza2

@sfshaza2sfshaza2 commented May 5, 2026

Copy link
Copy Markdown
Contributor

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

@gemini-code-assistgemini-code-assistBot 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 threadsites/docs/src/content/platform-integration/android/platform-views.md Outdated
Comment threadsites/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 reidbakerMay 5, 2026 20:16
@reidbaker
reidbaker requested review from gmackall and removed request for reidbakerMay 5, 2026 20:16
Comment threadsites/docs/src/_includes/docs/platform-view-perf.md Outdated
Comment threadsites/docs/src/_includes/docs/platform-view-perf.md Outdated
Comment threadsites/docs/src/content/platform-integration/android/platform-views.md Outdated
@sfshaza2
sfshaza2 requested a review from gmackallMay 6, 2026 04:00
@sfshaza2

This comment was marked as outdated.

Comment threadsites/docs/src/content/platform-integration/android/platform-views.md Outdated
Comment threadsites/docs/src/content/platform-integration/android/platform-views.md Outdated
Comment threadsites/docs/src/content/platform-integration/android/platform-views.md Outdated
@parlough

This comment was marked as resolved.

@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 4bfa8f6):

https://flutter-docs-prod--docs-pr13356-modernize-android-plat-5mie5i65.web.app

@sfshaza2

Copy link
Copy Markdown
ContributorAuthor

/gbcrun

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

flutter-website-bot commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Staged preview of the updated flutter.dev site (updated for commit 4bfa8f6):

https://flutter-dev-230821--www-pr13356-modernize-android-plat-dmbcf7g6.web.app

@parlough
parlough requested a review from gmackallJuly 16, 2026 01:36

@parloughparlough left a comment

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.

Looks good to me, deferring to Gray's approval on the technical content. Thanks for coming back to this!

One question:

@sfshaza2
sfshaza2 merged commit 94f78f3 into mainJul 17, 2026
14 checks passed
@sfshaza2
sfshaza2 deleted the modernize-android-platform-views branch July 17, 2026 04:09
gmackall added a commit to gmackall/website that referenced this pull request Aug 3, 2026
Follow-up to flutter#13356, which introduced a few inaccuracies on the
Hosting native Android views page.
- Thread merging: hybrid composition merges the raster thread into the
platform thread, not "the raster and UI threads". The UI thread (which
runs Dart) and the platform thread (the Android main thread) are
distinct, so describing them as "the UI/platform thread" was also
wrong. See AndroidExternalViewEmbedder::PostPrerollAction, where the
raster tasks end up handled on the platform thread. This also brings
back the detail, lost when platform-view-perf.md was inlined, that the
cost is rasterization competing with other platform thread work.
- Implementation matrix: the pipeline listed under hybrid composition
("renders to texture -> uploads to Impeller -> Impeller composites")
actually describes texture layer. Moved it to the texture layer row
and gave hybrid composition its real pipeline: Flutter content is
rendered into an ImageReader and painted by a FlutterImageView
overlay (PlatformOverlayView extends FlutterImageView), which sits in
the same window as the platform views, so the Android view hierarchy
composites the two. SurfaceFlinger compositing is what distinguishes
HCPP, which drives real SurfaceControl layers by way of
PlatformViewsController2.
- HCPP requirements: Vulkan is not required for Impeller. Impeller has
an OpenGLES backend and falls back to it when Vulkan is unusable
(emulators, known bad SoCs, and so on). The real constraint is the
reverse: HCPP requires the Vulkan backend specifically, as gated by
PlatformViewAndroid::IsSurfaceControlEnabled.
gmackall added a commit to gmackall/website that referenced this pull request Aug 3, 2026
Mostly a follow-up to flutter#13356, which introduced several inaccuracies on
the Hosting native Android views page. The compositing description in
the hybrid composition section predates that PR.
- Thread merging: hybrid composition merges the raster thread into the
platform thread, not "the raster and UI threads". The UI thread (which
runs Dart) and the platform thread (the Android main thread) are
distinct, so describing them as "the UI/platform thread" was also
wrong. See AndroidExternalViewEmbedder::PostPrerollAction, where the
raster tasks end up handled on the platform thread. This also brings
back the detail, lost when platform-view-perf.md was inlined, that the
cost is rasterization competing with other platform thread work.
- Compositing under hybrid composition: the page claimed Flutter content
goes into a texture that SurfaceFlinger then composes with the
platform views. It actually goes into an ImageReader that is painted
by a FlutterImageView (see FlutterImageView.onDraw, and
PlatformOverlayView, which extends it). That view lives in the same
window as the platform views, so the Android view hierarchy composites
them; SurfaceFlinger only composites whole windows. This holds for the
main Flutter surface too, which PlatformViewsController converts to a
FlutterImageView once a platform view is added.
SurfaceFlinger compositing is instead what distinguishes HCPP, which
drives real SurfaceControl layers by way of PlatformViewsController2.
Attributing it to hybrid composition erased that distinction.
- Implementation matrix: the pipeline listed under hybrid composition
("renders to texture -> uploads to Impeller -> Impeller composites")
actually describes texture layer, so it moves to the texture layer
row, and hybrid composition gets the pipeline described above.
- HCPP requirements: Vulkan is not required for Impeller. Impeller has
an OpenGLES backend and falls back to it when Vulkan is unusable
(emulators, known bad SoCs, and so on). The real constraint is the
reverse: HCPP requires the Vulkan backend specifically, as gated by
PlatformViewAndroid::IsSurfaceControlEnabled.
gmackall added a commit to gmackall/website that referenced this pull request Aug 3, 2026
Mostly a follow-up to flutter#13356, which introduced several inaccuracies on
the Hosting native Android views page. The compositing description in
the hybrid composition section predates that PR.
- Thread merging: hybrid composition merges the raster thread into the
platform thread, not "the raster and UI threads". The UI thread (which
runs Dart) and the platform thread (the Android main thread) are
distinct, so describing them as "the UI/platform thread" was also
wrong. See AndroidExternalViewEmbedder::PostPrerollAction, where the
raster tasks end up handled on the platform thread. This also brings
back the detail, lost when platform-view-perf.md was inlined, that the
cost is rasterization competing with other platform thread work.
- Compositing under hybrid composition: the page claimed Flutter content
goes into a texture that SurfaceFlinger then composes with the
platform views. It actually goes into ImageReaders painted by
FlutterImageViews, which live in the same window as the platform
views, so the Android view hierarchy composites them. SurfaceFlinger
only composites whole windows.
Describe both layer kinds, since they behave differently. The main
render surface is swapped for a background FlutterImageView by
FlutterView.convertToImageView once a platform view is added, while
content drawn above a platform view goes into overlay layers
(PlatformOverlayView) that SurfacePool allocates and recycles per
frame.
SurfaceFlinger compositing is instead what distinguishes HCPP, which
drives real SurfaceControl layers by way of PlatformViewsController2.
Attributing it to hybrid composition erased that distinction.
- Implementation matrix: the pipeline listed under hybrid composition
("renders to texture -> uploads to Impeller -> Impeller composites")
actually describes texture layer, so it moves to the texture layer
row, and hybrid composition gets the pipeline described above.
- HCPP requirements: Vulkan is not required for Impeller. Impeller has
an OpenGLES backend and falls back to it when Vulkan is unusable
(emulators, known bad SoCs, and so on). The real constraint is the
reverse: HCPP requires the Vulkan backend specifically, as gated by
PlatformViewAndroid::IsSurfaceControlEnabled.
sfshaza2 pushed a commit that referenced this pull request Aug 17, 2026
Some items that I missed in
#13356, sorry should have caught
them there
- Correct the hybrid-composition rendering-path description to reflect
ImageReader/FlutterImageView layering and Android view-hierarchy
composition.
- Explain background and overlay Flutter layers used when platform views
are present.
- Clarify that HCPP requires Impeller’s Vulkan backend; OpenGLES
fallback does not support HCPP.
- Refine the platform/raster-thread explanation and associated
performance trade-offs.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for freeto 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

@sfshaza2@flutter-website-bot@parlough@gmackall