feat(lock-screen): read the lock state with lock-screen status
KD
2h ago+730+730+012345678901234567890123456789-75-75-01234567890123456789
Summary
Add lock-screen status and client.command.lockScreen({ action: 'status' }). It returns the { action: 'lock-screen', state, message } shape of lock and unlock and changes nothing. Appium users (driver.isLocked(), mobile: isLocked) had no way to ask.
- Android reads
isKeyguardShowingfromdumpsys window, the readlockandunlockverify. A dump without it fails withlock-screen-state-unreadable. - iPhone and iPad simulators get a
lockScreenStatusrunner command that readscom.apple.springboard.lockstate, without bringing the session app forward. - Other targets refuse it like
lockandunlock. statuskeeps the ref frame and records as an observation. On Android it runs neither the blocking-dialog guard nor the screen-recording dialog recovery, so an ANR is not closed first.
Before / after
$ agent-device lock-screen status --platform android # base 24f8181c3
Error (INVALID_ARGS): lock-screen requires exactly one action: lock, unlock.
$ agent-device lock-screen status # head
The screen is unlocked
Validation
- At
0233f177b,pnpm check:affected --run --base upstream/mainpassed withexactCommit: true. CI owns coverage, Swift runner builds, and smoke lanes. - At
b526a7c25,status → lock → status → unlock → statusreturned unlocked, locked, unlocked on an Android 16 emulator, matchingisKeyguardShowingeach time, and on an iOS 27.2 simulator. The 29 lock-screen and model runner XCTests passed. - Risk: a provider plugin built before this change has no
lockScreenStatusfact, as withshakeandlock.
🤖 Generated with Claude Code

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.