/** * @file * * 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. {@link 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. */ import type { DeviceSettingNamespace } from './device-settings-command.cjs'; /** * Parameters for {@link deleteDeviceSetting} and {@link readDeviceSetting}. */ export interface DeviceSettingParams { /** * The device to address. */ readonly deviceId: string; /** * The setting's name within {@link namespace}, e.g. `show_ime_with_hard_keyboard`. */ readonly name: string; /** * The settings namespace the name lives in. * * @default {@link DeviceSettingNamespace.Secure} */ readonly namespace?: DeviceSettingNamespace; } /** * Parameters for {@link withSoftKeyboardEnabled}. * * @typeParam T - What the wrapped work returns. */ export interface WithSoftKeyboardEnabledParams { /** * The work to run while the on-screen keyboard is permitted. */ readonly callback: (this: void) => Promise; /** * The device to address. */ readonly deviceId: string; } /** * Parameters for {@link writeDeviceSetting}. */ export interface WriteDeviceSettingParams extends DeviceSettingParams { /** * The value to write. */ readonly value: string; } /** * Clears a device setting, returning it to never-having-been-written. * * @param params - The device, the setting and its namespace. * @returns A {@link Promise} that resolves once the setting is gone. */ export declare function deleteDeviceSetting(params: DeviceSettingParams): Promise; /** * Reads a device setting. * * @param params - The device, the setting and its namespace. * @returns A {@link Promise} that resolves to the setting's value, or the literal `null` when it has never * been written. */ export declare function readDeviceSetting(params: DeviceSettingParams): Promise; /** * Permits 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. * * @typeParam T - What the wrapped work returns. * @param params - The device and the work to run. * @returns A {@link Promise} that resolves to whatever the callback returned. */ export declare function withSoftKeyboardEnabled(params: WithSoftKeyboardEnabledParams): Promise; /** * Writes a device setting. * * @param params - The device, the setting, its namespace and the value to write. * @returns A {@link Promise} that resolves once the setting is written. */ export declare function writeDeviceSetting(params: WriteDeviceSettingParams): Promise;