buildAllWindowTrees

fun buildAllWindowTrees(): List<ApiUiNode>

Returns list of ApiUiNode roots (at most one — the active window).

Recovery flow after UiAutomation dies:

  1. Initial grace period (2s) — complete silence, no IPC calls at all.

  2. Poll phase — check serviceInfo every 500ms. No rootInActiveWindow until connected.

  3. Once serviceInfo != null — re-apply FLAG and attempt full tree build.