Skip to content

device-settings

Reads and writes Android device settings — and wraps the one setting a screenshot suite has to change.

The screenshot AVDs are built hw.keyboard=yes, so Android suppresses the on-screen keyboard even where the page asks for one. show_ime_with_hard_keyboard is what turns it back on. withSoftKeyboardEnabled flips it, runs the work, and puts the device back exactly as it found it — including restoring a setting that had never been written, which takes a delete rather than a write (see device-setting-restore).

Every function here shells out, so the whole module is integration-time code; the restore decision and the argument list it depends on are unit-tested in their own modules.

InterfaceDescription
DeviceSettingParamsParameters for deleteDeviceSetting and readDeviceSetting.
WithSoftKeyboardEnabledParamsParameters for withSoftKeyboardEnabled.
WriteDeviceSettingParamsParameters for writeDeviceSetting.
FunctionDescription
deleteDeviceSettingClears a device setting, returning it to never-having-been-written.
readDeviceSettingReads a device setting.
withSoftKeyboardEnabledPermits the on-screen keyboard for the duration of a callback, then restores the device exactly. The restore runs whether the callback succeeded or threw — a suite that dies mid-capture must not leave the device configured differently than it found it.
writeDeviceSettingWrites a device setting.