Skip to content

Android: Chrome Custom Tab web content missing from dump ui since the persistent DeviceKitServer (#334), and sticky across a polling session #415

Description

@rhoque-league

Environment

  • mobilecli: regressed at 1.0.1, still present through 1.0.10 (1.0.0 unaffected)
  • devicekit-android agent: 1.2.6
  • Device: Android emulator, google_apis system image, API 36 (Android 16)
  • Chrome: stable, Custom Tabs

Summary

Since #334 ("dump ui via persistent devicekit server on android") made Android dump ui reuse a single persistent DeviceKitServer UiAutomation for the whole session, the web form fields inside a Chrome Custom Tab (e.g. the <input>s of a hosted OAuth login) frequently never appear in dump ui. The Custom Tab's application window is dumped, but Chrome's renderer (web) accessibility nodes inside it are not populated.

The miss is sticky: because every dump in a session shares one UiAutomation, a client that polls for an element (e.g. a 30s locator wait in a UI-automation framework) never recovers — every poll reuses the same stale connection.

Root cause (from the code)

Chromium builds a Custom Tab's renderer accessibility tree when a fresh accessibility client connects.

  • Pre-feat: dump ui via persistent devicekit server on android #334, dump ui spawned a fresh one-shot ViewTreeDump instrumentation per call — a new UiAutomation (fresh a11y client) each dump — so Chrome (re)built the web tree, and a repeated/polling dump would eventually catch it.
  • feat: dump ui via persistent devicekit server on android #334 replaced that with one persistent DeviceKitServer UiAutomation, established once (typically before the Custom Tab's web content loads) and reused for every subsequent dump. With no new a11y client, Chrome never rebuilds the web tree — and because all dumps share that one connection, polling can't recover it.

#334's "output schema verified identical" check exercised native UI only, not a WebView/Custom Tab, so this regression wasn't caught.

Reproduction

  1. Android emulator (google_apis, API 36), current Chrome.
  2. mobilecli dump ui on some screen A — this starts the persistent DeviceKitServer (its UiAutomation connects now).
  3. From an app, open a Chrome Custom Tab hosting a web form (any hosted OAuth login with <input> fields).
  4. mobilecli dump ui (repeatedly) → the web <input> nodes are absent; only the native Custom Tab chrome + application window appear.
  5. adb shell am force-stop com.mobilenext.devicekit to drop the persistent server, then mobilecli dump ui again → the server relaunches with a fresh UiAutomation and the web fields can appear.

Concretely: a locator that polls dump ui for one of the form inputs times out for the entire wait window under the persistent server, but resolves when a fresh instrumentation is used.

Not a fix

--full (#398) — that only un-filters TYPE_INPUT_METHOD (soft-keyboard) windows. The Custom Tab is a normal TYPE_APPLICATION window that is already dumped; the missing part is the renderer nodes inside it, which --full does not affect.

Workaround

Launch Chrome with --force-renderer-accessibility (write it to /data/local/tmp/chrome-command-line; requires a rootable/userdebug image + adb root), which forces Chrome to build the renderer tree from the DOM regardless of a11y-client lifecycle. Needs root; not viable on non-rootable / Play-Store images.

Suggested fixes

  • An opt-in flag/env to use the pre-feat: dump ui via persistent devicekit server on android #334 one-shot ViewTreeDump path (fresh UiAutomation per dump).
  • Or refresh / re-establish the UiAutomation a11y client when a WebView / Custom-Tab window is foreground, so Chrome rebuilds the renderer tree.
  • Or detect an application window hosting a Chrome/WebView renderer with an empty subtree and force a re-attach before returning the dump.

Notes

  • Intermittent for a single dump (the initial connection occasionally lands while the tree is up), but reliably breaks a polling client — the common case for UI automation.
  • Observable verified on API 36; the same mechanism explains reports appearing after the mobilewright 0.0.53 → 0.0.58 bump, which crossed mobilecli 1.0.0 → 1.0.1.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions