Skip to content

Harden Android snapshot helper so stock UIAutomator fallback can be removed #1253

Description

@thymikee

Problem

Android direct snapshots currently prefer the bundled Android snapshot helper, but still fall back to stock adb exec-out uiautomator dump /dev/tty in several cases. That fallback keeps old behavior alive and makes direct Android providers such as Limrun depend on two snapshot backends instead of one.

We want the helper to become the only Android direct snapshot backend. WebDriver providers should remain separate: BrowserStack/AWS WebDriver snapshots come from WebDriver source(), not the Android helper.

Current fallback cases to investigate

The stock fallback is currently used when:

  • the helper artifact is missing or cannot be resolved
  • helper capture fails or returns unparseable output
  • helper returns only system/non-application windows
  • helper returns no accessibility nodes
  • helper returns insufficient foreground app content
  • helper returns insufficient application-window content in standalone/device snapshots

These should be treated as helper/product issues to verify and fix where possible, not permanent reasons to keep the old fallback.

Desired outcome

Make android-helper the only normal Android direct snapshot backend.

The final behavior should be:

  • successful Android direct snapshots report androidSnapshot.backend === "android-helper"
  • no production snapshot path shells out to stock uiautomator dump as a recovery backend
  • helper artifact/install failures produce actionable errors with diagnostics, not silent fallback
  • helper capture/parse failures preserve structured helper/ADB details
  • content-poor helper output is either fixed in the helper or fails with a clear reason and screenshot/snapshot guidance
  • WebDriver provider snapshots remain provider-native and out of scope for this helper path

Suggested approach

  1. Add tests that pin each current fallback reason as an explicit helper failure or helper-supported success.
  2. Improve the helper for content discovery cases: system-only windows, no nodes, foreground app window lacking content, overlay-only app windows.
  3. Remove or gate the stock UIAutomator fallback behind an internal temporary escape hatch if needed for debugging.
  4. Delete fallback-specific metadata once no normal path emits uiautomator-dump.
  5. Verify on local emulator and Limrun Android that helper-backed snapshots work for Settings and the repo test app.

Validation

  • Unit tests for each former fallback case
  • Provider integration tests expecting androidSnapshot.backend === "android-helper"
  • Live Android helper verification: snapshot -i --json shows helper backend and package-version-matching helperVersion
  • Limrun Android smoke snapshot on a short session

Related context

This is a follow-up to the Android helper/direct-provider work and PR #1243's move away from old ADB gesture fallbacks. The same cleanup direction applies to snapshots: prefer the repo-owned helper path and make failures explicit instead of silently recovering through stock UIAutomator.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions