feat(lock-screen): read the lock state with lock-screen status

KD
2h ago
+730-75

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 isKeyguardShowing from dumpsys window, the read lock and unlock verify. A dump without it fails with lock-screen-state-unreadable.
  • iPhone and iPad simulators get a lockScreenStatus runner command that reads com.apple.springboard.lockstate, without bringing the session app forward.
  • Other targets refuse it like lock and unlock.
  • status keeps 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/main passed with exactCommit: true. CI owns coverage, Swift runner builds, and smoke lanes.
  • At b526a7c25, status → lock → status → unlock → status returned unlocked, locked, unlocked on an Android 16 emulator, matching isKeyguardShowing each 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 lockScreenStatus fact, as with shake and lock.

🤖 Generated with Claude Code


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