Set device lock
set_device_lockSets a PIN, pattern, or password lock screen on an Android device so Keystore-backed crypto flows can run on a fresh emulator that lacks a secure lock.
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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"value": "<value>"
},
"name": "set_device_lock"
}
}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). |