Skip to content

[android_hardware_smoke_test] Synchronize platform view compositing#189151

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
andywolff:sync_composition
Jul 10, 2026
Merged

[android_hardware_smoke_test] Synchronize platform view compositing#189151
auto-submit[bot] merged 5 commits into
flutter:masterfrom
andywolff:sync_composition

Conversation

@andywolff

@andywolff andywolff commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #189079 - one in 100 runs failed with blank/black golden screenshots on the Vulkan backend for platform view tests in the android_hardware_smoke_test integration test suite.

Previously, the driver tests (goldens.dart) hardcoded a 3 frame wait before screenshotting. In CI, native views occasionally did not paint that quickly, causing blank screenshot failures.

To resolve this, we replace the hardcoded wait with a native drawing synchronization mechanism: the Kotlin TextView subclass overrides onDraw to notify Dart over Method Channels when it paints. I tried a tree-wide OnDrawListener, but it fired too early, so I went with this. Dart awaits this draw signal followed by 1 frame to ensure the compositor submits the frame before capturing coordinates.

Verified on my local device by temporarily marking the native view as invisible for 3 seconds. Tests produced black screens before this change and correct results after this change.

Pre-launch Checklist

Replace the hardcoded 3-frame wait in platform view tests with a native
draw event listener to prevent intermittent black screenshot failures.
@github-actions github-actions Bot added the a: text input Entering text in a text field or keyboard related problems label Jul 8, 2026
@andywolff

andywolff commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

started staging runs

Vulkan Shard ( Linux_android_emu_vulkan_stable android_hardware_smoke_vulkan_tests ): https://ci.chromium.org/b/8676815650908894593

OpenGL ES Shard ( Linux_android_emu android_hardware_smoke_opengles_tests ): https://ci.chromium.org/b/8676815638421172241

@andywolff

Copy link
Copy Markdown
Contributor Author

/gemini review

@andywolff andywolff added the CICD Run CI/CD label Jul 8, 2026

@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 modifies the Android hardware smoke test to synchronize platform view rendering. It introduces an ObservableTextView that triggers an onDraw method channel callback when painted, allowing the Dart side to await this callback and wait only 1 frame rather than a fixed 3 frames. Review feedback suggests using mapKeys for a more idiomatic Kotlin map transformation and storing the posted Runnable as a member variable to safely remove it on disposal, preventing potential race conditions.

@andywolff
andywolff marked this pull request as ready for review July 9, 2026 17:12
@andywolff
andywolff requested a review from flar July 9, 2026 17:12

@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 hardware smoke test to improve synchronization between native platform views and the Dart framework. It introduces an 'ObservableTextView' in Kotlin that overrides 'onDraw' to trigger a method channel callback, allowing the Dart app to wait for the native view to finish painting before proceeding. The 'goldens.dart' file was updated to use this callback for better timing, and the 'MainActivity' was modified to register the new view factory with this callback mechanism. No review comments were provided for this pull request.

@andywolff
andywolff removed the request for review from flar July 10, 2026 17:28
@jmagman jmagman added the platform-android Android applications specifically label Jul 10, 2026
@jmagman
jmagman requested a review from gmackall July 10, 2026 17:33
gmackall
gmackall previously approved these changes Jul 10, 2026

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

lgtm aside from removing onCreated from AndroidPlatformView if it is indeed unused now

kPlatformViewTextureLayerTest => AndroidPlatformView(
kPlatformViewTextureLayerTest => const AndroidPlatformView(
mode: PlatformViewMode.textureLayer,
onCreated: onPlatformViewCreated,

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 this is all of the onCreated uses in AndroidPlatformView (inside dev/integration_tests/android_hardware_smoke_test/lib/platform_view.dart) right? Should we remove the parameter if it's unused now?

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.

whoops forgot to submit the comment before leaving review, this is what I was referring to

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, done in d854cb3

@github-actions github-actions Bot removed the platform-android Android applications specifically label Jul 10, 2026
@andywolff
andywolff requested a review from gmackall July 10, 2026 20:29
@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 10, 2026
@auto-submit

auto-submit Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/189151, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 10, 2026
@andywolff

Copy link
Copy Markdown
Contributor Author

I reran dashboard checks flakes and they passed, so I'm adding autosubmit label back

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 10, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jul 10, 2026
Merged via the queue into flutter:master with commit b8690a4 Jul 10, 2026
26 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 10, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 12, 2026
flutter/flutter@f7b66f3...cf9e8af

2026-07-12 [email protected] Flip from deprecated strict analysis modes to lint rules (flutter/flutter#187692)
2026-07-12 [email protected] Roll Skia from 6ecffccd32d5 to 8bf65996caba (5 revisions) (flutter/flutter#189333)
2026-07-11 [email protected] Roll Fuchsia Linux SDK from czpzDg9ABY2oKLAOY... to vhIlDkWIy21IrlB9E... (flutter/flutter#189309)
2026-07-11 [email protected] iOS: clean up swiftc.py after migration to target triples (flutter/flutter#189240)
2026-07-10 [email protected] Increase number of 'Mac tool_integration_tests' subshards from 5 to 10 (flutter/flutter#189040)
2026-07-10 [email protected] Fix PopupWindowControllerLinux missing WindowControllerLinux implementation (flutter/flutter#189189)
2026-07-10 [email protected] [android_hardware_smoke_test] Synchronize platform view compositing (flutter/flutter#189151)
2026-07-10 [email protected] UberSDF thin roundrect handling (flutter/flutter#189224)
2026-07-10 [email protected] Roll Skia from ab3a7b98c94d to 6ecffccd32d5 (15 revisions) (flutter/flutter#189270)
2026-07-10 [email protected] [skwasm][canvaskit] Honor Paint.filterQuality in Canvas.drawAtlas (flutter/flutter#186108)
2026-07-10 [email protected] Android_hardware_smoke_test: Cache flutter engine when running vulkan backend instrumented tests (flutter/flutter#189026)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

android_hardware_smoke_vulkan_tests flaked - black screen in platform view tests

3 participants