Skip to content

fix(android): Re-arm first-frame gate on Activity recreation - #24599

Merged
morning4coffe-dev merged 7 commits into
masterfrom
dev/mazi/flaky-android-idle
Sep 25, 2026
Merged

morning4coffe-dev merged 7 commits into
masterfrom
dev/mazi/flaky-android-idle

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #24598

PR Type:

🐞 Bugfix

What changed? 🚀

This is the main cause of red master CI builds. Android Skia runtime-test shards get canceled at the 45-minute job cap in about 12 of the last 30 master builds; a healthy shard takes 8-11 minutes.

What happens. In every hung shard, the Activity is relaunched in the same process a few seconds into the run. It shows as SurfaceDestroyed, then OnSuspending/OnResuming, then a second Vulkan rendering initialized. The trigger is the app's own PACKAGE_ADDED broadcast arriving late: in healthy runs it lands before am start. That's 5 of 5 hung shards vs 0 of 23 healthy ones. After the relaunch, the app's HWUI app_time_stats stop (0-8 frames vs 276-428 in healthy shards), and WaitForIdle takes 10-50 s per call.

Root cause.

  • ApplicationActivity.OnCreate re-arms NativeWindowWrapper's first-frame gate (the splash / white-flash fix).
  • The static render view is reused, though, and its private _firstFrameSignaled is already true, so nothing ever releases the gate again.
  • OnPreDraw returns false forever. ViewRootImpl then cancels each draw and re-schedules a traversal every frame.
  • Each traversal posts a sync barrier, which limits NativeDispatcher's Handler posts to about one item per vsync.
  • It is not a flood of higher-priority work: the looper itself is throttled.

Fix.

  • fix(android): Re-arm first-frame gate on Activity recreation: the gate is now the single source of truth. The first frame presented after arming releases it (TryReleaseFirstFrameGate, interlocked), both render views drop their own flag, and a recreated Activity requests a frame explicitly.
  • fix(android): Avoid crash when the Activity is recreated in place: Activity.Recreate() crashed with an NRE because InitializeComponent attaches the reused content before OnCreate created the LayoutProvider. It is now created lazily, at the same point as before for a fresh Activity.
  • fix(android): Keep the window open on configuration recreation: OnDestroy raised the native close for every destruction, so Recreate(), a rotation or a density change closed the Uno window whose content the new Activity keeps. It now skips that when IsChangingConfigurations is set. Ported from fix(android): restore Skia content after activity recreation #24586 (@morning4coffe-dev), which fixed the same two bugs independently and is closed in favor of this PR.

Validation

  • Runtime, API 35 emulator, CI-style relaunch (wm density 400) during ComboBoxIntegrationTests:
    • Baseline without relaunch: 50 tests in 31 s.
    • Baseline with relaunch: 237 s, slow idles up to 24 s, 0 frames after the relaunch. This reproduces the CI signature.
    • Fixed with relaunch: 37 s, 28 frames after the relaunch.
  • Runtime, new test Given_ApplicationActivity.When_Recreated_Dispatcher_Stays_Responsive (Skia Android only):
    • Fails with the gate fix reverted: 300 empty dispatcher items took 5034 ms.
    • Passes with both fixes.
    • On the untouched baseline it crashes with the Recreate NRE.
  • Compile: new test When_Recreated_Window_Stays_Open (checks Window.Closed is not raised). Its runtime evidence is this CI run.
  • Code review: CI device logcats of hung vs healthy shards, as above.

Risks

  • The new test recreates the Activity mid-shard. This CI run is the check that later tests in the shard are unaffected.
  • Not addressed: why the PACKAGE_ADDED broadcast sometimes arrives late on the CI emulator. Waiting for it before am start would be a possible CI-side mitigation.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01WHHcu5U9N25wvKGNFCrpJm

@github-actions github-actions Bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia labels Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 4m 7s —— View job


Review complete ✅

Todo list

  • Gather context (diff, related files, AGENTS.md rules)
  • Review ApplicationActivity.cs changes
  • Review UnoSKCanvasView.cs / UnoSKVulkanView.cs changes
  • Review NativeWindowWrapper.Android.cs changes
  • Review new runtime test Given_ApplicationActivity.cs
  • Post inline comments for findings
  • Post summary

Verdict: Ship (1 minor finding, non-blocking)

This is a solid root-cause fix, not a guard-only patch — matching the debugging-discipline requirements:

  • The first-frame gate moves to a single source of truth (NativeWindowWrapper._awaitingFirstFrame, now an int with Volatile/Interlocked ops) instead of each render view tracking its own _firstFrameSignaled bool. That's exactly the broken invariant identified in the PR body (the view outlives Activity recreation, its local flag doesn't reset, so the gate never re-releases) — fixing it at the state-ownership level rather than patching symptoms.
  • The LayoutProvider crash fix is also root-cause: switching to lazy (??=) initialization resolves the ordering problem where InitializeComponent (invoked from base.OnCreate) could access the property before the derived OnCreate had assigned it, rather than adding a defensive null-check.
  • Traced the full lifecycle (arm in OnCreate → explicit InvalidateRender() for the reused-view/in-place-recreate case → release in the GL/Vulkan frame callback → OnPreDraw gating), including why the explicit invalidate is needed even though SurfaceChanged already requests a render (it doesn't fire when the window/surface is retained across an in-place Activity.Recreate(), which is exactly what the new test exercises). No threading or ordering issues found in the Volatile/Interlocked usage.
  • New runtime test is correctly scoped ([PlatformCondition(..., SkiaAndroid)], [RunsOnUIThread], reflection-gated Mono.Android access is justified since RuntimeTests doesn't reference it directly), and the PR body documents fail-before/pass-after evidence per the red/fix/green requirement.

One inline finding posted (informational, not a correctness bug): the new test isn't annotated with [GitHubWorkItem(...)] linking it to the issue it guards (#24598), which is the documented convention in .claude/rules/runtime-tests.md for issue-covering tests.

Not flagged as blocking, worth a look: the test's await Task.Delay(1000); before measuring dispatcher responsiveness is a fixed sleep rather than a deterministic wait — likely intentional here (letting the recreated Activity's render pipeline settle before the timing assertion), but flagging since fixed delays are a common source of CI flakiness in exactly the kind of shard this PR is trying to stabilize.

@unodevops

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 44s —— View job


Review complete ✅

Todo list

  • Gather context (diff since last review, AGENTS.md rules)
  • Review ApplicationActivity.cs changes
  • Review UnoSKCanvasView.cs / UnoSKVulkanView.cs changes
  • Review NativeWindowWrapper.Android.cs changes
  • Review runtime test Given_ApplicationActivity.cs (incl. prior GitHubWorkItem finding)
  • Post inline comments for new findings
  • Post summary

Verdict: Ship (0 new findings)

This re-review covers the branch since the last automated pass. The only change since then is commit a7d59ed6 (test(android): Keep the recreation test linkable on other heads), which adds [UnconditionalSuppressMessage("Trimming", "IL2035", Justification = "Both assemblies only exist on Android, the only platform this test runs on.")] to When_Recreated_Dispatcher_Stays_Responsive in Given_ApplicationActivity.cs.

  • This addresses a real problem: the method's [DynamicDependency] attributes name Uno.UI.Runtime.Skia.Android and Mono.Android by string, which are Android-only assemblies. Uno.UI.RuntimeTests builds and runs trim/link analysis on non-Android heads too (Apple), where those assemblies don't exist, so the trimmer flags an unresolvable reference (IL2035) even though the method itself is gated to SkiaAndroid at runtime via [PlatformCondition].
  • The suppression is scoped to the method, carries a justification, and follows the exact convention used elsewhere in the repo (e.g. ApiInformation.cs, TypeMappings.cs) — narrow, not a project-wide <NoWarn> or blanket pragma.
  • System.Diagnostics.CodeAnalysis was already imported in this file, so no new using was needed.

No correctness, lifecycle, or test-coverage issues found in this delta. The rest of the diff (ApplicationActivity.cs, NativeWindowWrapper.Android.cs, UnoSKCanvasView.cs, UnoSKVulkanView.cs) is unchanged since the prior review pass and still holds up as a root-cause fix per .claude/rules/debugging-discipline.md: the first-frame gate is now owned solely by NativeWindowWrapper (_awaitingFirstFrame, Volatile/Interlocked), rather than each render view tracking its own stale flag.

Still open, non-blocking (carried over from the prior review): the new test method still doesn't carry [GitHubWorkItem("https://github.com/unoplatform/uno/issues/24598")] per the .claude/rules/runtime-tests.md convention for issue-covering tests. Not re-filed as a duplicate inline comment since it's already posted on this PR.
· branch dev/mazi/flaky-android-idle

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 235243 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ImageIconPage.png-dark
    • Focus_FocusVisual_Properties.png-dark
  • skia-windows-screenshots: 2310 changed over 2442

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarButtonWithIconTest.png-dark
    • AppBar_KeyBoard.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppWindowTitleBar Properties.png-dark
    • ArcSegment.png
    • Attributed_text_Simple.png
    • AutoBorderStretchwithbottommargin.png-dark
    • AutoBorderStretchwithtopmargin.png
    • AutomationPropertiesExtensions_Role.png-dark
    • AutoSuggestBox_BitmapIcon.png-dark
    • AutoSuggestBox_BitmapIcon.png
    • BasicAutoSuggestBox.png-dark
    • BasicAutoSuggestBox.png
    • BasicThemeResources.png-dark
    • BasicThemeResources.png
    • BitmapIcon_Monochromatic.png-dark
    • BitmapIcon_Monochromatic.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Uno_Web.Http.CookieManagerTests
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 235243 has failed on Uno.UI - CI.

MartinZikmund and others added 5 commits September 24, 2026 10:16
The Skia first-frame gate is armed on every ApplicationActivity creation,
but the render views kept their own "first frame signaled" flag. They
outlive a recreated Activity, so after a relaunch nothing ever released
the gate: OnPreDraw cancelled every draw of the new window, and each
cancelled draw re-schedules a traversal whose sync barrier limits the
dispatcher to one item per frame. Idle work then took 10-50 s to run,
which is what hangs the Android runtime-test shards on CI when the late
PACKAGE_ADDED broadcast relaunches the Activity.

The gate is now the single source of truth: the first frame presented
after it is armed releases it. A recreated Activity also requests that
frame explicitly, as the reused render view may otherwise stay idle.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01WHHcu5U9N25wvKGNFCrpJm
Activity.Recreate (and any relaunch that preserves the window) crashed
with a NullReferenceException: NativePage.OnCreate runs
InitializeComponent, which reparents the reused content into the kept,
already attached window. The attach handler then starts the
LayoutProvider, which ApplicationActivity.OnCreate only created after
base.OnCreate returned.

The LayoutProvider is now created on first use, so it exists whenever
the content is attached. OnCreate still creates it at the same point
as before for a fresh Activity.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01WHHcu5U9N25wvKGNFCrpJm
Recreates the ApplicationActivity and checks that 300 empty dispatcher
items still drain quickly. Without the first-frame gate fix the new
window keeps cancelling its draw and the drain takes ~5 s; with it,
well under the 2 s bound.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01WHHcu5U9N25wvKGNFCrpJm
The DynamicDependency attributes name Android-only assemblies, which the
trimmer reports as IL2035 on the Apple heads, where it fails the build.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01WHHcu5U9N25wvKGNFCrpJm
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/flaky-android-idle branch from a7d59ed to 1359f47 Compare September 24, 2026 08:19
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 43s —— View job


Review complete ✅

Todo list

  • Gather context (diff since last review, AGENTS.md rules)
  • Review ApplicationActivity.cs changes
  • Review UnoCanvasView.cs / UnoVulkanView.cs / UnoWebGpuView.cs changes
  • Review NativeWindowWrapper.Android.cs changes
  • Review runtime test Given_ApplicationActivity.cs
  • Post inline comments for new findings
  • Post summary

Verdict: Ship (0 new findings)

The only change since the last automated review is commit 1359f479 (test(android): Link the recreation test to its issue), which adds:

[GitHubWorkItem("https://github.com/unoplatform/uno/issues/24598")]

to When_Recreated_Dispatcher_Stays_Responsive in Given_ApplicationActivity.cs. This directly resolves the sole open finding from the prior reviews (traceability metadata linking the issue-covering test to #24598, per .claude/rules/runtime-tests.md). It doesn't skip or alter test behavior — purely additive metadata — so there's nothing new to flag.

No other findings, open or new. The rest of the diff is unchanged from the prior passes and still holds up as a root-cause fix per .claude/rules/debugging-discipline.md:

  • The first-frame gate is now owned solely by NativeWindowWrapper (_awaitingFirstFrame, Volatile/Interlocked), replacing the per-render-view _firstFrameSignaled flags that couldn't survive Activity recreation.
  • The LayoutProvider NRE fix uses lazy (??=) initialization to correct the ordering problem, not a defensive null-guard.
  • The new runtime test is correctly scoped ([PlatformCondition(..., SkiaAndroid)], [RunsOnUIThread], narrowly-justified [UnconditionalSuppressMessage(IL2035)]) and now fully carries the required traceability metadata.

No cross-cutting concerns remain.
· branch dev/mazi/flaky-android-idle

@unodevops

Copy link
Copy Markdown
Contributor

MartinZikmund and others added 2 commits September 24, 2026 14:13
OnDestroy raised the native close for every Activity destruction, so a
configuration-driven recreation (rotation, density change, Recreate)
closed the Uno window even though its content is carried over to the
new Activity.

Ported from #24586.

Co-Authored-By: morning4coffe-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GwbrDBytd9CFt9aZoV8s1o
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 36s —— View job


Review complete ✅

Todo list

  • Gather context (diff since last review, AGENTS.md rules)
  • Review ApplicationActivity.cs changes
  • Review NativeWindowWrapper.Android.cs / render-view files (unchanged since last review)
  • Review runtime test Given_ApplicationActivity.cs
  • Post inline comments for new findings
  • Post summary

Verdict: Ship (1 minor, non-blocking finding)

The delta since the last automated review is two new commits: c17078af (fix(android): Keep the window open on configuration recreation) and e6c996bd (test(android): Cover the window staying open after recreation).

  • Root cause, correctly scoped: ApplicationActivity.OnDestroy previously called NativeWindowWrapper.Instance.OnNativeClosed() unconditionally, which cascades through RaiseClosing → BaseWindowImplementation.Close() → RaiseClosed, firing Window.Closed on every Activity teardown — including the config-driven recreate this PR's earlier commits already handle for the first-frame gate. The fix gates that call on !IsChangingConfigurations, the standard Android API for distinguishing "recreated in place" from "actually finishing." This is a one-line, root-cause fix (state/lifecycle invariant), not a guard bolted onto a symptom, and it directly resolves the risk called out in the PR body ("a relaunch raises Window.Closed on the main window (tracked separately)").
  • Test coverage matches the fix: When_Recreated_Window_Stays_Open subscribes to Window.Closed, drives the same reflection-based Activity.Recreate() used by the sibling dispatcher test, and asserts the flag never flips — a real regression guard, correctly [PlatformCondition(..., SkiaAndroid)]-gated and carrying [GitHubWorkItem(...)] from the outset (the traceability gap flagged in earlier review passes doesn't recur here).
  • Traced the synchronization: because OnDestroy of the old Activity instance runs synchronously before the new Activity's constructor sets ApplicationActivity.Instance, waiting for the instance reference to change is sufficient to know OnDestroy (and thus a would-be Closed raise) already happened — no race in the test.

One minor, non-blocking finding posted inline: the new test duplicates the "reflect Instance, invoke Recreate(), wait for the new instance" boilerplate that already exists in When_Recreated_Dispatcher_Stays_Responsive. Now that it appears twice, it's worth extracting into a shared helper — purely a simplification, not a correctness issue.

No cross-cutting concerns remain; the rest of the diff (render views, NativeWindowWrapper.Android.cs) is unchanged from prior review passes.
· branch dev/mazi/flaky-android-idle

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 235495 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
  • skia-windows-screenshots: 2310 changed over 2498

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AppBarToggleButtonTest.png
    • ApplicationViewSpanningRectsPage.png-dark
    • AppWindowPositionAndSize.png
    • AppXamlDefinedResources.png
    • Attributed_text_Supserscript.png-dark
    • AutoBorderStretchwithbottommargin.png-dark
    • AutoBorderStretchwithtopmargin.png
    • AutoSizedTopLeft.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • BackGesture.png-dark
    • BackGesture.png
    • BasicAutoSuggestBox.png-dark
    • BasicAutoSuggestBox.png
    • BasicThemeResources.png-dark
    • BasicThemeResources.png
    • BitmapIcon_Foreground.png-dark
    • BitmapIcon_Foreground.png
    • BorderRightwithmargins.png-dark
    • BorderRightwithmargins.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@morning4coffe-dev morning4coffe-dev 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! Fixes the Android first-frame gate on Activity recreation by removing the per-view state that outlived the Activity. Great root-cause fix with runtime tests.

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 11s —— View job


Review complete ✅

Todo list

  • Gather context (diff since last review, AGENTS.md rules)
  • Review ApplicationActivity.cs / NativeWindowWrapper.Android.cs / render-view changes
  • Review runtime test Given_ApplicationActivity.cs
  • Post inline comments for new findings
  • Post summary

Verdict: Ship (0 new findings)

This "reopened" trigger re-runs against the same HEAD (e6c996bd) already covered by the prior automated passes — no new commits landed since the last review, so I re-verified the whole diff from scratch rather than diffing against it.

  • Root cause holds up per .claude/rules/debugging-discipline.md: NativeWindowWrapper (a singleton) is now the single owner of the first-frame gate (_awaitingFirstFrame, Volatile/Interlocked), so it survives Activity recreation correctly — the render views no longer carry their own stale _firstFrameSignaled flag. Traced OnCreate's sequencing (OnActivityCreated registers the pre-draw listener on the new DecorView → ArmFirstFrameGate → explicit InvalidateRender() only when _renderView (static, reused) already exists) and confirmed no race: the pre-draw listener can't fire before ArmFirstFrameGate runs, since both execute synchronously on the same thread before any traversal is scheduled on the new DecorView.
  • LayoutProvider NRE fix is genuinely lazy (??=) rather than a null-guard bolted onto the symptom, correctly resolving the ordering where InitializeComponent (called from base.OnCreate) could observe the property before the derived OnCreate assigned it.
  • OnDestroy window-close fix: gating OnNativeClosed() on !IsChangingConfigurations is a one-line, root-cause fix for the lifecycle invariant (config-driven recreate vs. real teardown), backed by When_Recreated_Window_Stays_Open, which correctly asserts Window.Closed never fires.
  • Test coverage: both new tests are correctly scoped ([PlatformCondition(..., SkiaAndroid)], [RunsOnUIThread], narrowly-justified [UnconditionalSuppressMessage(IL2035)] on the Android-only [DynamicDependency] reflection), and both now carry [GitHubWorkItem(...)] linking them to [Android] Recreated Activity never draws again, dispatcher throttled to one item per frame #24598 per .claude/rules/runtime-tests.md. The second test correctly unsubscribes its Closed handler in a finally block.
  • No event-declaration, DependencyProperty, async/cancellation, or platform-suffix violations found in this diff.

Cross-cutting, still open from a prior pass (non-blocking, not re-filed as a duplicate inline comment): the "reflect ApplicationActivity.Instance, invoke Recreate(), wait for the new instance" boilerplate is still duplicated between the two test methods — worth extracting into a shared helper, but purely a simplification and not a correctness issue.

No new concerns beyond what's already been reviewed and approved (@morning4coffe-dev).
· branch dev/mazi/flaky-android-idle

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 235599 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ImageIconPage.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
  • skia-windows-screenshots: 2310 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ApplicationViewSizing.png-dark
    • AppWindowFeatures.png-dark
    • AppWindowTitleBar Properties.png-dark
    • Arrange_Performance01.png-dark
    • Attributed_text_Simple.png-dark
    • AuthenticationBroker_Demo.png-dark
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_Name.png
    • AutoSuggestBox_BitmapIcon.png
    • AutoSuggestBox_Description.png-dark
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics_Automated.png-dark
    • Basics_Automated.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BitmapIcon_Monochromatic.png-dark
    • BitmapIcon_Monochromatic.png
    • BorderBottomwithmargins.png-dark
    • BorderBottomwithmargins.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Uno_Web.Http.CookieManagerTests
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

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

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Recreated Activity never draws again, dispatcher throttled to one item per frame

4 participants