Skip to content

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

Closed

Description

@MartinZikmund

Current behavior 🐛

On Android (Skia), after the ApplicationActivity is recreated within the same process (e.g. a configuration or ApplicationInfo change relaunch, or Activity.Recreate()), the window never draws again and the UI thread slows to a crawl: dispatcher work runs at roughly one item per frame, and Idle priority work can wait 10-50 s.

Root cause: the first-frame gate added to hold the splash until the first Skia frame (NativeWindowWrapper.ArmFirstFrameGate, armed in ApplicationActivity.OnCreate) is re-armed on every Activity creation. But the static render view (UnoSKVulkanView / UnoSKCanvasView) is reused, and its private _firstFrameSignaled flag is already true, so nothing releases the gate again. OnPreDraw then returns false forever. ViewRootImpl cancels every draw and re-schedules a traversal each frame, and each traversal posts a sync barrier that starves Handler posts, including the NativeDispatcher.

Activity.Recreate() also crashes with a NullReferenceException: InitializeComponent attaches the reused content before ApplicationActivity.OnCreate has created the LayoutProvider.

This is also 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. In every hung shard, the app's own late PACKAGE_ADDED broadcast relaunches the Activity a few seconds into the run (5 of 5 hung shards vs 0 of 23 healthy ones). From then on, the app's HWUI frame stats stop and WaitForIdle takes 10-50 s per call.

Expected behavior 🎯

A recreated Activity draws normally and the dispatcher stays responsive. Activity.Recreate() does not crash.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Run a Skia Android app (or the SamplesApp runtime tests) on an emulator.
  2. Trigger an in-process Activity relaunch, e.g. adb shell wm density 400.
  3. The screen stops updating, and anything waiting for idle dispatcher work stalls.

Workaround 🛠️

Avoid in-process Activity relaunches (e.g. handle the configuration changes in the manifest).

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

Android

Uno.Sdk version (and other relevant versions) 📦

master (7.0)

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

Regression from the splash / white-flash first-frame gate.

Activity

  1. added
    kind/bug
    platform/android 🤖
    on Sep 23, 2026
  2. Jen-Uno commented on Sep 30, 2026

    @Jen-Uno
    Contributor

    QA: closing out without a manual pass. The fix in #24599 ships with automated tests (Given_ApplicationActivity.cs) that exercise the change.

    If you still see this behaviour on a build that includes that PR, please reopen or comment here.

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

Metadata

Metadata

Assignees

Labels

kind/bugplatform/android 🤖

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions