appium-android-driver 12.6.0 → 12.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [12.6.2](https://github.com/appium/appium-android-driver/compare/v12.6.1...v12.6.2) (2025-12-23)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * **deps:** bump teen_process from 3.0.6 to 4.0.7 ([#1046](https://github.com/appium/appium-android-driver/issues/1046)) ([1e88bc4](https://github.com/appium/appium-android-driver/commit/1e88bc4c83015609200fe8c6bd8b791ede1720fa))
6
+
7
+ ## [12.6.1](https://github.com/appium/appium-android-driver/compare/v12.6.0...v12.6.1) (2025-12-21)
8
+
9
+ ### Miscellaneous Chores
10
+
11
+ * Migrate lock helpers to typescript ([#1045](https://github.com/appium/appium-android-driver/issues/1045)) ([6779082](https://github.com/appium/appium-android-driver/commit/6779082ba788ee803277c5033dc1c1cb37d68cf4))
12
+
1
13
  ## [12.6.0](https://github.com/appium/appium-android-driver/compare/v12.5.0...v12.6.0) (2025-12-21)
2
14
 
3
15
  ### Features
@@ -1,41 +1,37 @@
1
+ import type { AndroidDriver, AndroidDriverCaps } from '../../driver';
2
+ import type { UnlockType } from '../types';
1
3
  /**
2
- * @this {AndroidDriver}
3
- * @param {number} [seconds]
4
- * @returns {Promise<void>}
4
+ * Locks the device and optionally unlocks it after a specified number of seconds.
5
+ *
6
+ * @param seconds - Optional number of seconds to wait before unlocking. If not provided or invalid, the device remains locked.
5
7
  */
6
- export function lock(this: import("../../driver").AndroidDriver, seconds?: number): Promise<void>;
8
+ export declare function lock(this: AndroidDriver, seconds?: number): Promise<void>;
7
9
  /**
8
- * @this {AndroidDriver}
9
- * @returns {Promise<boolean>}
10
+ * Checks if the device screen is currently locked.
11
+ *
12
+ * @returns True if the screen is locked, false otherwise
10
13
  */
11
- export function isLocked(this: import("../../driver").AndroidDriver): Promise<boolean>;
14
+ export declare function isLocked(this: AndroidDriver): Promise<boolean>;
12
15
  /**
13
- * @this {AndroidDriver}
14
- * @returns {Promise<void>}
16
+ * Unlocks the device using the unlock options from session capabilities.
15
17
  */
16
- export function unlock(this: import("../../driver").AndroidDriver): Promise<void>;
18
+ export declare function unlock(this: AndroidDriver): Promise<void>;
17
19
  /**
18
- * @this {AndroidDriver}
19
- * @param {string} [key] The unlock key. The value of this key depends on the actual unlock type and
20
- * could be a pin/password/pattern value or a biometric finger id.
21
- * If not provided then the corresponding value from session capabilities is
22
- * used.
23
- * @param {import('../types').UnlockType} [type] The unlock type.
24
- * If not provided then the corresponding value from session capabilities is used.
25
- * @param {string} [strategy] Setting it to 'uiautomator' will enforce the driver to avoid using special
26
- * ADB shortcuts in order to speed up the unlock procedure.
27
- * 'uiautomator' by default.
28
- * @param {number} [timeoutMs] The maximum time in milliseconds to wait until the screen gets unlocked
29
- * 2000ms byde fault.
30
- * @returns {Promise<void>}
20
+ * Unlocks the device with the specified options.
21
+ *
22
+ * @param key - The unlock key. The value of this key depends on the actual unlock type and
23
+ * could be a pin/password/pattern value or a biometric finger id.
24
+ * If not provided then the corresponding value from session capabilities is used.
25
+ * @param type - The unlock type. If not provided then the corresponding value from session capabilities is used.
26
+ * @param strategy - Setting it to 'uiautomator' will enforce the driver to avoid using special
27
+ * ADB shortcuts in order to speed up the unlock procedure. 'uiautomator' by default.
28
+ * @param timeoutMs - The maximum time in milliseconds to wait until the screen gets unlocked. 2000ms by default.
31
29
  */
32
- export function mobileUnlock(this: import("../../driver").AndroidDriver, key?: string, type?: import("../types").UnlockType, strategy?: string, timeoutMs?: number): Promise<void>;
30
+ export declare function mobileUnlock(this: AndroidDriver, key?: string, type?: UnlockType, strategy?: string, timeoutMs?: number): Promise<void>;
33
31
  /**
34
- * @this {AndroidDriver}
35
- * @param {AndroidDriverCaps?} [caps=null]
36
- * @returns {Promise<void>}
32
+ * Unlocks the device with the specified capabilities.
33
+ *
34
+ * @param caps - Optional capabilities to use for unlocking. If not provided, uses session capabilities.
37
35
  */
38
- export function unlockWithOptions(this: import("../../driver").AndroidDriver, caps?: AndroidDriverCaps | null): Promise<void>;
39
- export type AndroidDriverCaps = import("@appium/types").Capabilities<import("../../constraints").AndroidDriverConstraints>;
40
- export type AndroidDriver = import("../../driver").AndroidDriver;
36
+ export declare function unlockWithOptions(this: AndroidDriver, caps?: AndroidDriverCaps | null): Promise<void>;
41
37
  //# sourceMappingURL=exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../../lib/commands/lock/exports.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,2EAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAczB;AAED;;;GAGG;AACH,sEAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;AAED;;;GAGG;AACH,oEAFa,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;;;;;;;;;;;;GAcG;AACH,+EAbW,MAAM,SAIN,OAAO,UAAU,EAAE,UAAU,aAE7B,MAAM,cAGN,MAAM,GAEJ,OAAO,CAAC,IAAI,CAAC,CAazB;AAID;;;;GAIG;AACH,qFAHW,iBAAiB,OAAC,GAChB,OAAO,CAAC,IAAI,CAAC,CA0CzB;gCAKY,OAAO,eAAe,EAAE,YAAY,CAAC,OAAO,mBAAmB,EAAE,wBAAwB,CAAC;4BAC1F,OAAO,cAAc,EAAE,aAAa"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../../lib/commands/lock/exports.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY/E;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpE;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,UAAU,EACjB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAWf;AAID;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,EACnB,IAAI,GAAE,iBAAiB,GAAG,IAAW,GACpC,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
@@ -12,13 +12,13 @@ const bluebird_1 = __importDefault(require("bluebird"));
12
12
  const helpers_1 = require("./helpers");
13
13
  const lodash_1 = __importDefault(require("lodash"));
14
14
  /**
15
- * @this {AndroidDriver}
16
- * @param {number} [seconds]
17
- * @returns {Promise<void>}
15
+ * Locks the device and optionally unlocks it after a specified number of seconds.
16
+ *
17
+ * @param seconds - Optional number of seconds to wait before unlocking. If not provided or invalid, the device remains locked.
18
18
  */
19
19
  async function lock(seconds) {
20
20
  await this.adb.lock();
21
- if (Number.isNaN(seconds)) {
21
+ if (Number.isNaN(seconds ?? NaN)) {
22
22
  return;
23
23
  }
24
24
  const floatSeconds = parseFloat(String(seconds));
@@ -29,33 +29,29 @@ async function lock(seconds) {
29
29
  await this.unlock();
30
30
  }
31
31
  /**
32
- * @this {AndroidDriver}
33
- * @returns {Promise<boolean>}
32
+ * Checks if the device screen is currently locked.
33
+ *
34
+ * @returns True if the screen is locked, false otherwise
34
35
  */
35
36
  async function isLocked() {
36
37
  return await this.adb.isScreenLocked();
37
38
  }
38
39
  /**
39
- * @this {AndroidDriver}
40
- * @returns {Promise<void>}
40
+ * Unlocks the device using the unlock options from session capabilities.
41
41
  */
42
42
  async function unlock() {
43
43
  await unlockWithOptions.bind(this)();
44
44
  }
45
45
  /**
46
- * @this {AndroidDriver}
47
- * @param {string} [key] The unlock key. The value of this key depends on the actual unlock type and
48
- * could be a pin/password/pattern value or a biometric finger id.
49
- * If not provided then the corresponding value from session capabilities is
50
- * used.
51
- * @param {import('../types').UnlockType} [type] The unlock type.
52
- * If not provided then the corresponding value from session capabilities is used.
53
- * @param {string} [strategy] Setting it to 'uiautomator' will enforce the driver to avoid using special
54
- * ADB shortcuts in order to speed up the unlock procedure.
55
- * 'uiautomator' by default.
56
- * @param {number} [timeoutMs] The maximum time in milliseconds to wait until the screen gets unlocked
57
- * 2000ms byde fault.
58
- * @returns {Promise<void>}
46
+ * Unlocks the device with the specified options.
47
+ *
48
+ * @param key - The unlock key. The value of this key depends on the actual unlock type and
49
+ * could be a pin/password/pattern value or a biometric finger id.
50
+ * If not provided then the corresponding value from session capabilities is used.
51
+ * @param type - The unlock type. If not provided then the corresponding value from session capabilities is used.
52
+ * @param strategy - Setting it to 'uiautomator' will enforce the driver to avoid using special
53
+ * ADB shortcuts in order to speed up the unlock procedure. 'uiautomator' by default.
54
+ * @param timeoutMs - The maximum time in milliseconds to wait until the screen gets unlocked. 2000ms by default.
59
55
  */
60
56
  async function mobileUnlock(key, type, strategy, timeoutMs) {
61
57
  if (!key && !type) {
@@ -72,9 +68,9 @@ async function mobileUnlock(key, type, strategy, timeoutMs) {
72
68
  }
73
69
  // #region Internal Helpers
74
70
  /**
75
- * @this {AndroidDriver}
76
- * @param {AndroidDriverCaps?} [caps=null]
77
- * @returns {Promise<void>}
71
+ * Unlocks the device with the specified capabilities.
72
+ *
73
+ * @param caps - Optional capabilities to use for unlocking. If not provided, uses session capabilities.
78
74
  */
79
75
  async function unlockWithOptions(caps = null) {
80
76
  if (!(await this.adb.isScreenLocked())) {
@@ -89,31 +85,35 @@ async function unlockWithOptions(caps = null) {
89
85
  await this.adb.dismissKeyguard();
90
86
  return;
91
87
  }
92
- const { unlockType, unlockKey, unlockStrategy, unlockSuccessTimeout } = (0, helpers_1.validateUnlockCapabilities)(capabilities);
88
+ const validated = (0, helpers_1.validateUnlockCapabilities)(capabilities);
89
+ const { unlockType, unlockKey, unlockStrategy, unlockSuccessTimeout } = validated;
90
+ if (!unlockType) {
91
+ throw new Error('unlockType is required after validation');
92
+ }
93
93
  if (unlockKey &&
94
94
  unlockType !== helpers_1.FINGERPRINT_UNLOCK &&
95
95
  (lodash_1.default.isNil(unlockStrategy) || lodash_1.default.toLower(unlockStrategy) === 'locksettings') &&
96
96
  (await this.adb.isLockManagementSupported())) {
97
97
  await helpers_1.fastUnlock.bind(this)({
98
98
  credential: unlockKey,
99
- credentialType: (0, helpers_1.toCredentialType)(/** @type {import('../types').UnlockType} */ (unlockType)),
99
+ credentialType: (0, helpers_1.toCredentialType)(unlockType),
100
100
  });
101
101
  }
102
102
  else {
103
- const unlockMethod = {
103
+ const unlockMethodMap = {
104
104
  [helpers_1.PIN_UNLOCK]: helpers_1.pinUnlock,
105
105
  [helpers_1.PIN_UNLOCK_KEY_EVENT]: helpers_1.pinUnlockWithKeyEvent,
106
106
  [helpers_1.PASSWORD_UNLOCK]: helpers_1.passwordUnlock,
107
107
  [helpers_1.PATTERN_UNLOCK]: helpers_1.patternUnlock,
108
108
  [helpers_1.FINGERPRINT_UNLOCK]: helpers_1.fingerprintUnlock,
109
- }[unlockType];
109
+ };
110
+ const unlockMethod = unlockMethodMap[unlockType];
111
+ if (!unlockMethod) {
112
+ throw new Error(`Unknown unlock type: ${unlockType}`);
113
+ }
110
114
  await unlockMethod.bind(this)(capabilities);
111
115
  }
112
116
  await helpers_1.verifyUnlock.bind(this)(unlockSuccessTimeout);
113
117
  }
114
118
  // #endregion
115
- /**
116
- * @typedef {import('@appium/types').Capabilities<import('../../constraints').AndroidDriverConstraints>} AndroidDriverCaps
117
- * @typedef {import('../../driver').AndroidDriver} AndroidDriver
118
- */
119
119
  //# sourceMappingURL=exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../../lib/commands/lock/exports.js"],"names":[],"mappings":";;;;;AAwBA,oBAYC;AAMD,4BAEC;AAMD,wBAEC;AAiBD,oCAWC;AASD,8CAwCC;AAjID,wDAAyB;AACzB,uCAemB;AACnB,oDAAuB;AAEvB;;;;GAIG;AACI,KAAK,UAAU,IAAI,CAAC,OAAO;IAChC,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACtB,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO;IACT,CAAC;IACD,MAAM,kBAAC,CAAC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,CAAC;IACnC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;AACtB,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,QAAQ;IAC5B,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;AACzC,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,MAAM;IAC1B,MAAM,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS;IAC/D,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,MAAM,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,SAAS,EAAE,GAAG;YACd,UAAU,EAAE,IAAI;YAChB,cAAc,EAAE,QAAQ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C;IAChF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IACD,IACE,SAAS;QACT,UAAU,KAAK,4BAAkB;QACjC,CAAC,gBAAC,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,gBAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,cAAc,CAAC;QACzE,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC,EAC5C,CAAC;QACD,MAAM,oBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,UAAU,EAAE,SAAS;YACrB,cAAc,EAAE,IAAA,0BAAgB,EAAC,UAAwB,CAAC;SAC3D,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,eAAe,GAAoF;YACvG,CAAC,oBAAU,CAAC,EAAE,mBAAS;YACvB,CAAC,8BAAoB,CAAC,EAAE,+BAAqB;YAC7C,CAAC,yBAAe,CAAC,EAAE,wBAAc;YACjC,CAAC,wBAAc,CAAC,EAAE,uBAAa;YAC/B,CAAC,4BAAkB,CAAC,EAAE,2BAAiB;SACxC,CAAC;QACF,MAAM,YAAY,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,sBAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAED,aAAa"}
@@ -1,89 +1,103 @@
1
+ import type { Position, StringRecord } from '@appium/types';
2
+ import type { AndroidDriver, AndroidDriverCaps } from '../../driver';
3
+ import type { UnlockType, FastUnlockOptions } from '../types';
4
+ export declare const PIN_UNLOCK = "pin";
5
+ export declare const PIN_UNLOCK_KEY_EVENT = "pinWithKeyEvent";
6
+ export declare const PASSWORD_UNLOCK = "password";
7
+ export declare const PATTERN_UNLOCK = "pattern";
8
+ export declare const FINGERPRINT_UNLOCK = "fingerprint";
9
+ export declare const KEYCODE_NUMPAD_ENTER = 66;
10
+ export declare const UNLOCK_WAIT_TIME = 100;
11
+ export declare const INPUT_KEYS_WAIT_TIME = 100;
1
12
  /**
13
+ * Converts an unlock type to a credential type string.
2
14
  *
3
- * @param {import('../types').UnlockType} unlockType
4
- * @returns {string}
15
+ * @param unlockType - The unlock type
16
+ * @returns The credential type string
17
+ * @throws {Error} If the unlock type is not known
5
18
  */
6
- export function toCredentialType(unlockType: import("../types").UnlockType): string;
19
+ export declare function toCredentialType(unlockType: UnlockType): string;
7
20
  /**
8
- * @template {AndroidDriverCaps} T
9
- * @param {T} caps
10
- * @returns {T}
21
+ * Validates unlock capabilities and returns them if valid.
22
+ *
23
+ * @param caps - The capabilities to validate
24
+ * @returns The validated capabilities
25
+ * @throws {Error} If the capabilities are invalid
11
26
  */
12
- export function validateUnlockCapabilities<T extends AndroidDriverCaps>(caps: T): T;
27
+ export declare function validateUnlockCapabilities<T extends AndroidDriverCaps>(caps: T): T;
13
28
  /**
14
- * @this {AndroidDriver}
15
- * @param {import('../types').FastUnlockOptions} opts
29
+ * Performs a fast unlock using ADB commands.
30
+ *
31
+ * @param opts - Fast unlock options with credential and credential type
16
32
  */
17
- export function fastUnlock(this: import("../../driver").AndroidDriver, opts: import("../types").FastUnlockOptions): Promise<void>;
33
+ export declare function fastUnlock(this: AndroidDriver, opts: FastUnlockOptions): Promise<void>;
18
34
  /**
35
+ * Encodes a password by replacing spaces with %s.
19
36
  *
20
- * @param {string} key
21
- * @returns {string}
37
+ * @param key - The password key
38
+ * @returns The encoded password
22
39
  */
23
- export function encodePassword(key: string): string;
40
+ export declare function encodePassword(key: string): string;
24
41
  /**
42
+ * Converts a string key to an array of characters.
25
43
  *
26
- * @param {string} key
27
- * @returns {string[]}
44
+ * @param key - The key string
45
+ * @returns An array of characters
28
46
  */
29
- export function stringKeyToArr(key: string): string[];
47
+ export declare function stringKeyToArr(key: string): string[];
30
48
  /**
31
- * @this {AndroidDriver}
32
- * @param {AndroidDriverCaps} capabilities
33
- * @returns {Promise<void>}
49
+ * Unlocks the device using fingerprint.
50
+ *
51
+ * @param capabilities - Driver capabilities containing unlockKey
34
52
  */
35
- export function fingerprintUnlock(this: import("../../driver").AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
53
+ export declare function fingerprintUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
36
54
  /**
37
- * @this {AndroidDriver}
38
- * @param {AndroidDriverCaps} capabilities
39
- * @returns {Promise<void>}
55
+ * Unlocks the device using PIN by clicking on-screen buttons.
56
+ *
57
+ * @param capabilities - Driver capabilities containing unlockKey
40
58
  */
41
- export function pinUnlock(this: import("../../driver").AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
59
+ export declare function pinUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
42
60
  /**
43
- * @this {AndroidDriver}
44
- * @param {AndroidDriverCaps} capabilities
45
- * @returns {Promise<void>}
61
+ * Unlocks the device using PIN by sending key events.
62
+ *
63
+ * @param capabilities - Driver capabilities containing unlockKey
46
64
  */
47
- export function pinUnlockWithKeyEvent(this: import("../../driver").AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
65
+ export declare function pinUnlockWithKeyEvent(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
48
66
  /**
49
- * @this {AndroidDriver}
50
- * @param {AndroidDriverCaps} capabilities
51
- * @returns {Promise<void>}
67
+ * Unlocks the device using password.
68
+ *
69
+ * @param capabilities - Driver capabilities containing unlockKey
52
70
  */
53
- export function passwordUnlock(this: import("../../driver").AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
71
+ export declare function passwordUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
54
72
  /**
73
+ * Calculates the position of a pattern key based on the initial position and piece size.
55
74
  *
56
- * @param {number} key
57
- * @param {import('@appium/types').Position} initPos
58
- * @param {number} piece
59
- * @returns {import('@appium/types').Position}
75
+ * @param key - The pattern key number (1-9)
76
+ * @param initPos - The initial position of the pattern view
77
+ * @param piece - The size of each pattern piece
78
+ * @returns The calculated position for the key
60
79
  */
61
- export function getPatternKeyPosition(key: number, initPos: import("@appium/types").Position, piece: number): import("@appium/types").Position;
80
+ export declare function getPatternKeyPosition(key: number, initPos: Position, piece: number): Position;
62
81
  /**
63
- * @param {string[]|number[]} keys
64
- * @param {import('@appium/types').Position} initPos
65
- * @param {number} piece
66
- * @returns {import('@appium/types').StringRecord[]}
82
+ * Generates pointer actions for pattern unlock gesture.
83
+ *
84
+ * @param keys - Array of pattern keys (string or number)
85
+ * @param initPos - The initial position of the pattern view
86
+ * @param piece - The size of each pattern piece
87
+ * @returns An array of W3C action objects for pattern unlock
67
88
  */
68
- export function getPatternActions(keys: string[] | number[], initPos: import("@appium/types").Position, piece: number): import("@appium/types").StringRecord[];
89
+ export declare function getPatternActions(keys: string[] | number[], initPos: Position, piece: number): StringRecord[];
69
90
  /**
70
- * @this {AndroidDriver}
71
- * @param {number?} [timeoutMs=null]
91
+ * Verifies that the device has been unlocked.
92
+ *
93
+ * @param timeoutMs - Optional timeout in milliseconds (default: 2000)
94
+ * @throws {Error} If the device fails to unlock within the timeout
72
95
  */
73
- export function verifyUnlock(this: import("../../driver").AndroidDriver, timeoutMs?: number | null): Promise<void>;
96
+ export declare function verifyUnlock(this: AndroidDriver, timeoutMs?: number | null): Promise<void>;
74
97
  /**
75
- * @this {AndroidDriver}
76
- * @param {AndroidDriverCaps} capabilities
98
+ * Unlocks the device using pattern gesture.
99
+ *
100
+ * @param capabilities - Driver capabilities containing unlockKey
77
101
  */
78
- export function patternUnlock(this: import("../../driver").AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
79
- export const PIN_UNLOCK: "pin";
80
- export const PIN_UNLOCK_KEY_EVENT: "pinWithKeyEvent";
81
- export const PASSWORD_UNLOCK: "password";
82
- export const PATTERN_UNLOCK: "pattern";
83
- export const FINGERPRINT_UNLOCK: "fingerprint";
84
- export const KEYCODE_NUMPAD_ENTER: 66;
85
- export const UNLOCK_WAIT_TIME: 100;
86
- export const INPUT_KEYS_WAIT_TIME: 100;
87
- export type AndroidDriverCaps = import("@appium/types").Capabilities<import("../../constraints").AndroidDriverConstraints>;
88
- export type AndroidDriver = import("../../driver").AndroidDriver;
102
+ export declare function patternUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
89
103
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../lib/commands/lock/helpers.js"],"names":[],"mappings":"AAmDA;;;;GAIG;AACH,6CAHW,OAAO,UAAU,EAAE,UAAU,GAC3B,MAAM,CAalB;AAED;;;;GAIG;AACH,2CAJiC,CAAC,SAApB,iBAAkB,QACrB,CAAC,GACC,CAAC,CAsCb;AAED;;;GAGG;AACH,6EAFW,OAAO,UAAU,EAAE,iBAAiB,iBAqB9C;AAED;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,EAAE,CAIpB;AAED;;;;GAIG;AACH,4FAHW,iBAAiB,GACf,OAAO,CAAC,IAAI,CAAC,CAKzB;AAED;;;;GAIG;AACH,oFAHW,iBAAiB,GACf,OAAO,CAAC,IAAI,CAAC,CAqBzB;AAED;;;;GAIG;AACH,gGAHW,iBAAiB,GACf,OAAO,CAAC,IAAI,CAAC,CAezB;AAED;;;;GAIG;AACH,yFAHW,iBAAiB,GACf,OAAO,CAAC,IAAI,CAAC,CAezB;AAED;;;;;;GAMG;AACH,2CALW,MAAM,WACN,OAAO,eAAe,EAAE,QAAQ,SAChC,MAAM,GACJ,OAAO,eAAe,EAAE,QAA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