Repository navigation
Done
Labels
enhancementNew feature or request
Description
Purpose
Agents and test runners can't lock or unlock a device. Tests that cover what an app does on a lock (pausing playback, hiding sensitive content, re-auth on return, notifications on the lock screen) fall back to raw adb on Android and have no route on an iOS simulator. hardware-button sleep|wake|power presses a key and leaves the keyguard alone, and it refuses on iOS simulators.
API
agent-device lock-screen lock
agent-device lock-screen unlockawait client.command.lockScreen({ action: 'lock' });
// => { action: 'lock-screen', state: 'lock', message: 'Locked the screen' }- One positional,
<lock|unlock>, picked the waykeyboard <status|dismiss|enter>picks a cell. An unknown value isINVALID_ARGSbefore any device call. - No
--settle. The command must not activate or re-foreground the session app. - Unlock returns to whatever was in front before the lock.
Behavior
| Target | lock |
unlock |
|---|---|---|
| Android phone/tablet (emulator or device) | KEYCODE_SLEEP |
KEYCODE_WAKEUP, then wm dismiss-keyguard |
| iOS simulator | runner: XCUIDevice pressLockButton |
runner: bottom-edge swipe up from the lock screen |
| iOS physical, tvOS, Android TV, macOS, web | UNSUPPORTED_OPERATION |
UNSUPPORTED_OPERATION |
- A device with a secure lock (PIN, pattern, passcode) is not unlocked.
unlockrefuses with a typed reason, and nothing types a credential. - iOS
pressLockButtonis a privateXCUIDeviceselector, the one WebDriverAgent's lock uses. The runner checksresponds(to:)and refuses when the selector is missing.
Completion conditions
- Android: after
lock,dumpsys windowreportsisKeyguardShowing=true. Afterunlock, it reportsfalseand the previous app is in front. - iOS simulator: after
lock, a screenshot shows the lock screen. Afterunlock, the previous app is in front. - Tests for the refusals and for each platform's commands, help text, and
commands.md.
Prototype evidence (854bba6c5)
- Pixel 9 AVD, Android 16, lock screen set to swipe:
hardware-button sleepthenwakegivesisKeyguardShowing=true.wm dismiss-keyguardgivesfalse, back in Settings.
- iPhone 17 Pro simulator, iOS 27.2, with a locally rebuilt runner that called
pressLockButton: the lock screen showed.- A swipe up from the bottom edge returned to Settings.
homealso unlocks, but lands on the Home Screen.
Open questions
- Is a private
XCUIDeviceselector acceptable here? feat(hardware-button): press phone volume and power buttons on Android and iOS #3848 left iOS lock out because there's no public API. - One
lock-screen <lock|unlock>command, orlockandunlockas two commands?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity