set_device_lock
Set a PIN, pattern, or password lock screen on an Android device. Required before using AndroidKeyStore-backed crypto; prevents "secure lock screen required" errors on fresh emulators.
Instructions
Set a secure lock screen (type: pin [default], pattern, or password). REQUIRED before AndroidKeyStore / Keystore-backed crypto flows, which fail with 'A secure lock screen is required' on a fresh emulator that has no lock. Follow with is_device_secure to confirm.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Lock type: pin (default), pattern, or password. | |
| value | Yes | Credential to set, e.g. "1234". | |
| serial | No | Target device serial (adb -s). Optional when exactly one device is attached. | |
| old_value | No | The CURRENT credential, required only when a lock is already set and you want to change it (locksettings refuses to overwrite otherwise). |