appium-adb
Version:
Android Debug Bridge interface
105 lines • 5 kB
TypeScript
import type { ADB } from '../adb';
/**
* Check whether the device supports lock settings management with `locksettings`
* command line tool. This tool has been added to Android toolset since API 27 Oreo
*
* @return True if the management is supported. The result is cached per ADB instance
*/
export declare function isLockManagementSupported(this: ADB): Promise<boolean>;
/**
* Check whether the given credential is matches to the currently set one.
*
* @param credential - The credential value. It could be either
* pin, password or a pattern. A pattern is specified by a non-separated list
* of numbers that index the cell on the pattern in a 1-based manner in left
* to right and top to bottom order, i.e. the top-left cell is indexed with 1,
* whereas the bottom-right cell is indexed with 9. Example: 1234.
* null/empty value assumes the device has no lock currently set.
* @return True if the given credential matches to the device's one
* @throws {Error} If the verification faces an unexpected error
*/
export declare function verifyLockCredential(this: ADB, credential?: string | null): Promise<boolean>;
/**
* Clears current lock credentials. Usually it takes several seconds for a device to
* sync the credential state after this method returns.
*
* @param credential - The credential value. It could be either
* pin, password or a pattern. A pattern is specified by a non-separated list
* of numbers that index the cell on the pattern in a 1-based manner in left
* to right and top to bottom order, i.e. the top-left cell is indexed with 1,
* whereas the bottom-right cell is indexed with 9. Example: 1234.
* null/empty value assumes the device has no lock currently set.
* @throws {Error} If operation faces an unexpected error
*/
export declare function clearLockCredential(this: ADB, credential?: string | null): Promise<void>;
/**
* Checks whether the device is locked with a credential (either pin or a password
* or a pattern).
*
* @returns `true` if the device is locked
* @throws {Error} If operation faces an unexpected error
*/
export declare function isLockEnabled(this: ADB): Promise<boolean>;
/**
* Sets the device lock.
*
* @param credentialType - One of: password, pin, pattern.
* @param credential - A non-empty credential value to be set.
* Make sure your new credential matches to the actual system security requirements,
* e.g. a minimum password length. A pattern is specified by a non-separated list
* of numbers that index the cell on the pattern in a 1-based manner in left
* to right and top to bottom order, i.e. the top-left cell is indexed with 1,
* whereas the bottom-right cell is indexed with 9. Example: 1234.
* @param oldCredential - An old credential string.
* It is only required to be set in case you need to change the current
* credential rather than to set a new one. Setting it to a wrong value will
* make this method to fail and throw an exception.
* @throws {Error} If there was a failure while verifying input arguments or setting
* the credential
*/
export declare function setLockCredential(this: ADB, credentialType: string, credential: string, oldCredential?: string | null): Promise<void>;
/**
* Retrieve the screen lock state of the device under test.
*
* @return True if the device is locked.
*/
export declare function isScreenLocked(this: ADB): Promise<boolean>;
/**
* Dismisses keyguard overlay.
*/
export declare function dismissKeyguard(this: ADB): Promise<void>;
/**
* Presses the corresponding key combination to make sure the device's screen
* is not turned off and is locked if the latter is enabled.
*/
export declare function cycleWakeUp(this: ADB): Promise<void>;
/**
* Send the special keycode to the device under test in order to lock it.
*/
export declare function lock(this: ADB): Promise<void>;
/**
* Checks mShowingLockscreen or mDreamingLockscreen in dumpsys output to determine
* if lock screen is showing
*
* A note: `adb shell dumpsys trust` performs better while detecting the locked screen state
* in comparison to `adb dumpsys window` output parsing.
* But the trust command does not work for `Swipe` unlock pattern.
*
* In some Android devices (Probably around Android 10+), `mShowingLockscreen` and `mDreamingLockscreen`
* do not work to detect lock status. Instead, keyguard preferences helps to detect the lock condition.
* Some devices such as Android TV do not have keyguard, so we should keep
* screen condition as this primary method.
*
* @param dumpsys - The output of dumpsys window command.
* @return True if lock screen is showing.
*/
export declare function isShowingLockscreen(dumpsys: string): boolean;
/**
* Checks screenState has SCREEN_STATE_OFF in dumpsys output to determine
* possible lock screen.
*
* @param dumpsys - The output of dumpsys window command.
* @return True if lock screen is showing.
*/
export declare function isScreenStateOff(dumpsys: string): boolean;
//# sourceMappingURL=lockmgmt.d.ts.map