feat(lock-screen): lock and unlock the screen on Android and iOS simulators
Merged
IM
4d ago+2092+2092+0123456789012345678901234567890123456789-97-97-01234567890123456789
Summary
Closes #4798. The iOS side follows the reviewed design of #3001.
agent-device lock-screen <lock|unlock> and client.command.lockScreen({ action }) return { action: 'lock-screen', state: 'locked' | 'unlocked', message } once the device reports that state. No app is activated and there is no --settle.
- Android:
KEYCODE_SLEEP, orKEYCODE_WAKEUPthenwm dismiss-keyguard, verified byisKeyguardShowing. A screen lock set to None refuseslockwithlock-screen-disabled; a PIN, pattern, or password refusesunlockwithlock-screen-secure. Both send nothing. A deferred keyguard ("Power button instantly locks" off) is awaited forlock_screen_lock_after_timeout, 5–60 s. - iOS simulator:
pressLockButtonafterresponds(to:); unlock swipes up from the bottom edge, back to the app in front. A dark screen is woken first. Success needscom.apple.springboard.lockstate, a lock surface forlock, and a lit screen forunlock. A passcode prompt giveslock-screen-secure. - Other targets, including physical iPhones and Android TV:
UNSUPPORTED_OPERATION.
lock-screen names the surface it shows, like app-switcher. Two system-button cells are picked by the positional, as in hardware-button.
Before / after
Base has no lock-screen. Head, Settings in front:
Pixel 9 AVD, Android 16:
lock (None) -> lock-screen-disabled, dispatched no; no sleep in logcat
lock (swipe) -> locked (0.81 s); repeat sends nothing (0.19 s)
unlock -> unlocked (0.90 s), Settings in front
unlock (PIN) -> lock-screen-secure, dispatched no; keyguard stays up
lock (PIN, instant lock off, lock after 15 s) -> locked (15.7 s)
iPhone 17 Pro simulator, iOS 27.2:
lock -> locked; repeat presses nothing (0.22 s)
unlock on a dark lock screen -> unlocked (2.61 s), screen on, Settings in front
Validation
- Head
e55a5d4d7:check:affected --run --headpassed format, lint, typecheck, layering, Fallow, build, package, integration-node, and vitest-related;pnpm gatepassed provider-integration, command-docs, capabilities-matrix, xctest-selection, runner-error-codes, and daemon-wire-compat. - Runner lock-screen tests: 18/18 on the simulator. Each Swift and TypeScript mutant fails a test.
- The
chore(gates)commit addssystem/lock-screen.tstoAPPROVED_CLOSURE_ADDITIONS, because the system family keeps one module per command. Please approve or reject that row; its owner is a placeholder.