feat(maestro): support killApp via close mode
Merged
RO
7h ago+824+824+012345678901234567890123456789-29-29-01234567890123456789
Summary
Supports Maestro killApp, which kills the app process the way the system would. On ADB-backed Android it runs am kill. iOS, Limrun and WebDriver-provider backends treat it as stopApp, and the docs and support matrix say so. There is no new public CLI surface.
- The kill precondition reads the resumed activity from the ActivityManager (AMS), not window focus. A resumed target is refused with
android-kill-requires-background-app. A process that survives the kill fails withandroid-kill-process-survived. If no activity dump answers, the kill is refused withandroid-process-probe-unavailable. If the dump answers but shows nothing resumed, the kill goes ahead. - The strict
pidofcheck applies only to the kill's final check. Ordinary close, stopApp and relaunch keep main's behaviour. - The Android lifecycle loads the kill code lazily.
upstream/116_kill_appis no longer listed as a divergence. The preconditions are recorded inDOCUMENTED_DEVIATIONS. - Rebased onto main as one commit, co-authored by Rohit. 30 files.
Validation
Tested commit 4661ed90c5.
pnpm check:affected --run: green (full fail-open set; 4856 unit tests).pnpm maestro:conformance: 62/62 pass.- Android, Maestro, daemon-session and replay-port suites: 2701 tests pass.
Live agent-device replay --maestro on an Android 37 emulator with a fresh daemon and no other emulators or simulators running:
- launchApp โ pressKey Home โ killApp: passes. Logcat shows
Killing 5797:com.callstack.agentdevicelab/u0a231 (adj 700): kill backgroundright afteram kill.pidofprints nothing, and there are no lowmemorykiller or signal-9 lines. - launchApp (
stopApp: false): cold start, new pid 6043 (Start proc 6043 โฆ for next-top-activity). - launchApp โ killApp with the app in the foreground: fails at step 2 with
android-kill-requires-background-app.ResumedActivitystill namescom.callstack.agentdevicelab/.MainActivity, and the process survives.
Unresolved: if am kill runs before the system has finished backgrounding the app (for example a picture-in-picture app), the process may survive and the kill fail. This is an inference; it did not happen in the live runs.
๐ค Generated with Claude Code