Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Visit the preview URL for this PR (updated for commit 87267f8): https://flutter-docs-prod--pr13356-modernize-android-platform-9reff6dv.web.app |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as resolved.
This comment was marked as resolved.
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
commented
Jun 26, 2026
/gbcrun |
Uh oh!
There was an error while loading. Please reload this page.
Staged preview of the updated flutter.dev site (updated for commit 4bfa8f6): https://flutter-dev-230821--www-pr13356-modernize-android-plat-dmbcf7g6.web.app |
Co-authored-by: "Shams Zakhour (ignore Sfshaza)" <shaza@google.com>
parlough
left a comment
There was a problem hiding this comment.
Looks good to me, deferring to Gray's approval on the technical content. Thanks for coming back to this!
One question:
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
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.
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>
Fixes#13355
Affected page staged here: https://flutter-docs-prod--docs-pr13356-modernize-android-plat-5mie5i65.web.app/platform-integration/android/platform-views