appium-adb 14.0.2 → 14.0.4
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 +12 -0
- package/build/lib/adb.d.ts +3 -11
- package/build/lib/adb.d.ts.map +1 -1
- package/build/lib/helpers.d.ts +29 -67
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +65 -98
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js.map +1 -1
- package/build/lib/tools/system-calls.d.ts +157 -267
- package/build/lib/tools/system-calls.d.ts.map +1 -1
- package/build/lib/tools/system-calls.js +259 -312
- package/build/lib/tools/system-calls.js.map +1 -1
- package/lib/{helpers.js → helpers.ts} +113 -117
- package/lib/{logger.js → logger.ts} +1 -0
- package/lib/tools/{system-calls.js → system-calls.ts} +372 -407
- package/package.json +4 -4
|
@@ -1,326 +1,268 @@
|
|
|
1
|
+
import { SubProcess } from 'teen_process';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import type { ADB } from '../adb.js';
|
|
4
|
+
import type { ConnectedDevicesOptions, Device, AvdLaunchOptions, Version, RootResult, ShellExecOptions, SpecialAdbExecOptions, TFullOutputOption, ExecResult } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve full binary name for the current operating system.
|
|
7
|
+
*
|
|
8
|
+
* @param binaryName - The name of the binary
|
|
9
|
+
* @returns The binary name with appropriate extension for the current OS
|
|
10
|
+
*/
|
|
11
|
+
declare function _getBinaryNameForOS(binaryName: string): string;
|
|
1
12
|
/**
|
|
2
13
|
* Retrieve full path to the given binary.
|
|
3
14
|
*
|
|
4
|
-
* @
|
|
5
|
-
* @
|
|
6
|
-
* @return {Promise<string>} Full path to the given binary including current SDK root.
|
|
15
|
+
* @param binaryName - The name of the binary
|
|
16
|
+
* @returns The full path to the binary
|
|
7
17
|
*/
|
|
8
|
-
export function getSdkBinaryPath(this:
|
|
18
|
+
export declare function getSdkBinaryPath(this: ADB, binaryName: string): Promise<string>;
|
|
19
|
+
export declare const getBinaryNameForOS: typeof _getBinaryNameForOS & _.MemoizedFunction;
|
|
9
20
|
/**
|
|
10
21
|
* Retrieve full path to the given binary and caches it into `binaries`
|
|
11
22
|
* property of the current ADB instance.
|
|
12
23
|
*
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* to enumerate all the known locations where the binary
|
|
17
|
-
* might be located and stops the search as soon as the first
|
|
18
|
-
* match is found on the local file system.
|
|
19
|
-
* @throws {Error} If the binary with given name is not present at any
|
|
20
|
-
* of known locations or Android SDK is not installed on the
|
|
21
|
-
* local file system.
|
|
24
|
+
* @param binaryName - The name of the binary
|
|
25
|
+
* @returns The full path to the binary
|
|
26
|
+
* @throws {Error} If SDK root is not set or binary cannot be found
|
|
22
27
|
*/
|
|
23
|
-
export function getBinaryFromSdkRoot(this:
|
|
28
|
+
export declare function getBinaryFromSdkRoot(this: ADB, binaryName: string): Promise<string>;
|
|
24
29
|
/**
|
|
25
30
|
* Retrieve full path to the given binary.
|
|
26
31
|
* This method does not have cache.
|
|
27
32
|
*
|
|
28
|
-
* @param
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
31
|
-
* to enumerate all the known locations where the binary
|
|
32
|
-
* might be located and stops the search as soon as the first
|
|
33
|
-
* match is found on the local file system.
|
|
34
|
-
* e.g. '/Path/To/Android/sdk/platform-tools/adb'
|
|
35
|
-
* @throws {Error} If the binary with given name is not present at any
|
|
36
|
-
* of known locations or Android SDK is not installed on the
|
|
37
|
-
* local file system.
|
|
33
|
+
* @param binaryName - The name of the binary
|
|
34
|
+
* @returns The full path to the binary
|
|
35
|
+
* @throws {Error} If binary cannot be found in the Android SDK
|
|
38
36
|
*/
|
|
39
|
-
export function getAndroidBinaryPath(binaryName: string): Promise<string>;
|
|
37
|
+
export declare function getAndroidBinaryPath(binaryName: string): Promise<string>;
|
|
40
38
|
/**
|
|
41
39
|
* Retrieve full path to a binary file using the standard system lookup tool.
|
|
42
40
|
*
|
|
43
|
-
* @
|
|
44
|
-
* @
|
|
45
|
-
* @
|
|
46
|
-
* output.
|
|
47
|
-
* @throws {Error} If lookup tool returns non-zero return code.
|
|
41
|
+
* @param binaryName - The name of the binary
|
|
42
|
+
* @returns The full path to the binary
|
|
43
|
+
* @throws {Error} If binary cannot be found in PATH
|
|
48
44
|
*/
|
|
49
|
-
export function getBinaryFromPath(this:
|
|
45
|
+
export declare function getBinaryFromPath(this: ADB, binaryName: string): Promise<string>;
|
|
50
46
|
/**
|
|
51
47
|
* Retrieve the list of devices visible to adb.
|
|
52
48
|
*
|
|
53
|
-
* @
|
|
54
|
-
* @
|
|
55
|
-
* @
|
|
56
|
-
* no devices are connected.
|
|
57
|
-
* @throws {Error} If there was an error while listing devices.
|
|
49
|
+
* @param opts - Options for device retrieval
|
|
50
|
+
* @returns Array of connected devices
|
|
51
|
+
* @throws {Error} If adb devices command fails or returns unexpected output
|
|
58
52
|
*/
|
|
59
|
-
export function getConnectedDevices(this:
|
|
53
|
+
export declare function getConnectedDevices(this: ADB, opts?: ConnectedDevicesOptions): Promise<Device[]>;
|
|
60
54
|
/**
|
|
61
55
|
* Retrieve the list of devices visible to adb within the given timeout.
|
|
62
56
|
*
|
|
63
|
-
* @
|
|
64
|
-
* @
|
|
65
|
-
*
|
|
66
|
-
* @return {Promise<import('./types').Device[]>} The list of connected devices.
|
|
67
|
-
* @throws {Error} If no connected devices can be detected within the given timeout.
|
|
57
|
+
* @param timeoutMs - Maximum time to wait for devices (default: 20000ms)
|
|
58
|
+
* @returns Array of connected devices
|
|
59
|
+
* @throws {Error} If no devices are found within the timeout period
|
|
68
60
|
*/
|
|
69
|
-
export function getDevicesWithRetry(this:
|
|
61
|
+
export declare function getDevicesWithRetry(this: ADB, timeoutMs?: number): Promise<Device[]>;
|
|
70
62
|
/**
|
|
71
63
|
* Kick current connection from host/device side and make it reconnect
|
|
72
64
|
*
|
|
73
|
-
* @
|
|
74
|
-
* @
|
|
75
|
-
* offline, device or null
|
|
76
|
-
* Providing `null` will cause reconnection to happen from the host side.
|
|
77
|
-
*
|
|
78
|
-
* @throws {Error} If either ADB version is too old and does not support this
|
|
79
|
-
* command or there was a failure during reconnect.
|
|
65
|
+
* @param target - The target to reconnect (default: 'offline')
|
|
66
|
+
* @throws {Error} If reconnect command fails
|
|
80
67
|
*/
|
|
81
|
-
export function reconnect(this:
|
|
68
|
+
export declare function reconnect(this: ADB, target?: string | null): Promise<void>;
|
|
82
69
|
/**
|
|
83
70
|
* Restart adb server, unless _this.suppressKillServer_ property is true.
|
|
84
|
-
*
|
|
85
|
-
* @this {import('../adb.js').ADB}
|
|
86
71
|
*/
|
|
87
|
-
export function restartAdb(this:
|
|
72
|
+
export declare function restartAdb(this: ADB): Promise<void>;
|
|
88
73
|
/**
|
|
89
74
|
* Kill adb server.
|
|
90
|
-
* @this {import('../adb.js').ADB}
|
|
91
75
|
*/
|
|
92
|
-
export function killServer(this:
|
|
76
|
+
export declare function killServer(this: ADB): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Reset Telnet authentication token.
|
|
79
|
+
* @see {@link http://tools.android.com/recent/emulator2516releasenotes} for more details.
|
|
80
|
+
*
|
|
81
|
+
* @returns True if token was reset successfully, false otherwise
|
|
82
|
+
*/
|
|
83
|
+
export declare const resetTelnetAuthToken: (() => Promise<boolean>) & _.MemoizedFunction;
|
|
93
84
|
/**
|
|
94
85
|
* Execute the given emulator command using _adb emu_ tool.
|
|
95
86
|
*
|
|
96
|
-
* @
|
|
97
|
-
* @
|
|
87
|
+
* @param cmd - Array of command arguments
|
|
88
|
+
* @throws {Error} If emulator is not connected or command execution fails
|
|
98
89
|
*/
|
|
99
|
-
export function adbExecEmu(this:
|
|
90
|
+
export declare function adbExecEmu(this: ADB, cmd: string[]): Promise<void>;
|
|
91
|
+
export declare const EXEC_OUTPUT_FORMAT: {
|
|
92
|
+
readonly STDOUT: "stdout";
|
|
93
|
+
readonly FULL: "full";
|
|
94
|
+
};
|
|
100
95
|
/**
|
|
101
96
|
* Execute the given adb command.
|
|
102
97
|
*
|
|
103
|
-
* @
|
|
104
|
-
* @
|
|
105
|
-
* @
|
|
106
|
-
*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
* for more details.
|
|
110
|
-
* You can also set the additional `exclusive` param
|
|
111
|
-
* to `true` that assures no other parallel adb commands
|
|
112
|
-
* are going to be executed while the current one is running
|
|
113
|
-
* You can set the `outputFormat` param to `stdout` to receive just the stdout
|
|
114
|
-
* output (default) or `full` to receive the stdout and stderr response from a
|
|
115
|
-
* command with a zero exit code
|
|
116
|
-
* @return {Promise<TExecOpts extends import('./types').TFullOutputOption ? import('teen_process').TeenProcessExecResult : string>}
|
|
117
|
-
* Command's stdout or an object containing stdout and stderr.
|
|
118
|
-
* @throws {Error} If the command returned non-zero exit code.
|
|
119
|
-
*/
|
|
120
|
-
export function adbExec<TExecOpts extends import("teen_process").TeenProcessExecOptions & import("./types").ShellExecOptions & import("./types").SpecialAdbExecOptions>(this: import("../adb.js").ADB, cmd: string | string[], opts?: TExecOpts): Promise<TExecOpts extends import("./types").TFullOutputOption ? import("teen_process").TeenProcessExecResult<any> : string>;
|
|
98
|
+
* @param cmd - Command string or array of command arguments
|
|
99
|
+
* @param opts - Execution options
|
|
100
|
+
* @returns Command output (string or ExecResult depending on outputFormat)
|
|
101
|
+
* @throws {Error} If command execution fails or timeout is exceeded
|
|
102
|
+
*/
|
|
103
|
+
export declare function adbExec<TExecOpts extends ShellExecOptions & SpecialAdbExecOptions = ShellExecOptions & SpecialAdbExecOptions>(this: ADB, cmd: string | string[], opts?: TExecOpts): Promise<TExecOpts extends TFullOutputOption ? ExecResult : string>;
|
|
121
104
|
/**
|
|
122
105
|
* Execute the given command using _adb shell_ prefix.
|
|
123
106
|
*
|
|
124
|
-
* @
|
|
125
|
-
* @
|
|
126
|
-
* @
|
|
127
|
-
*
|
|
128
|
-
* @param {TShellExecOpts} [opts] - Additional options mapping.
|
|
129
|
-
* @return {Promise<TShellExecOpts extends import('./types').TFullOutputOption ? import('teen_process').TeenProcessExecResult : string>}
|
|
130
|
-
* Command's stdout.
|
|
131
|
-
* @throws {Error} If the command returned non-zero exit code.
|
|
107
|
+
* @param cmd - Command string or array of command arguments
|
|
108
|
+
* @param opts - Execution options
|
|
109
|
+
* @returns Command output (string or ExecResult depending on outputFormat)
|
|
110
|
+
* @throws {Error} If command execution fails
|
|
132
111
|
*/
|
|
133
|
-
export function shell<TShellExecOpts extends
|
|
112
|
+
export declare function shell<TShellExecOpts extends ShellExecOptions = ShellExecOptions>(this: ADB, cmd: string | string[], opts?: TShellExecOpts): Promise<TShellExecOpts extends TFullOutputOption ? ExecResult : string>;
|
|
134
113
|
/**
|
|
114
|
+
* Create a new ADB subprocess with the given arguments
|
|
135
115
|
*
|
|
136
|
-
* @
|
|
137
|
-
* @
|
|
138
|
-
* @returns {import('teen_process').SubProcess}
|
|
116
|
+
* @param args - Array of command arguments (default: empty array)
|
|
117
|
+
* @returns A SubProcess instance
|
|
139
118
|
*/
|
|
140
|
-
export function createSubProcess(this:
|
|
119
|
+
export declare function createSubProcess(this: ADB, args?: string[]): SubProcess;
|
|
141
120
|
/**
|
|
142
121
|
* Retrieve the current adb port.
|
|
143
122
|
* @todo can probably deprecate this now that the logic is just to read this.adbPort
|
|
123
|
+
* @deprecated Use this.adbPort instead
|
|
144
124
|
*
|
|
145
|
-
* @
|
|
146
|
-
* @return {number} The current adb port number.
|
|
125
|
+
* @returns The ADB server port number
|
|
147
126
|
*/
|
|
148
|
-
export function getAdbServerPort(this:
|
|
127
|
+
export declare function getAdbServerPort(this: ADB): number;
|
|
149
128
|
/**
|
|
150
|
-
* Retrieve the current emulator port from _adb
|
|
129
|
+
* Retrieve the current emulator port from _adb devices_ output.
|
|
151
130
|
*
|
|
152
|
-
* @
|
|
153
|
-
* @
|
|
154
|
-
* @throws {Error} If there are no connected devices.
|
|
131
|
+
* @returns The emulator port number
|
|
132
|
+
* @throws {Error} If no devices are connected or emulator port cannot be found
|
|
155
133
|
*/
|
|
156
|
-
export function getEmulatorPort(this:
|
|
134
|
+
export declare function getEmulatorPort(this: ADB): Promise<number>;
|
|
157
135
|
/**
|
|
158
136
|
* Retrieve the current emulator port by parsing emulator name string.
|
|
159
137
|
*
|
|
160
|
-
* @
|
|
161
|
-
* @
|
|
162
|
-
* @return {number|false} Either the current emulator port or
|
|
163
|
-
* _false_ if port number cannot be parsed.
|
|
138
|
+
* @param emStr - The emulator string (e.g., 'emulator-5554')
|
|
139
|
+
* @returns The port number if found, false otherwise
|
|
164
140
|
*/
|
|
165
|
-
export function getPortFromEmulatorString(this:
|
|
141
|
+
export declare function getPortFromEmulatorString(this: ADB, emStr: string): number | false;
|
|
166
142
|
/**
|
|
167
143
|
* Retrieve the list of currently connected emulators.
|
|
168
144
|
*
|
|
169
|
-
* @
|
|
170
|
-
* @
|
|
171
|
-
* @
|
|
145
|
+
* @param opts - Options for device retrieval
|
|
146
|
+
* @returns Array of connected emulator devices
|
|
147
|
+
* @throws {Error} If error occurs while getting emulators
|
|
172
148
|
*/
|
|
173
|
-
export function getConnectedEmulators(this:
|
|
149
|
+
export declare function getConnectedEmulators(this: ADB, opts?: ConnectedDevicesOptions): Promise<Device[]>;
|
|
174
150
|
/**
|
|
175
151
|
* Set _emulatorPort_ property of the current class.
|
|
176
152
|
*
|
|
177
|
-
* @
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
export function setEmulatorPort(this: import("../adb.js").ADB, emPort: number): void;
|
|
181
|
-
export class setEmulatorPort {
|
|
182
|
-
/**
|
|
183
|
-
* Set _emulatorPort_ property of the current class.
|
|
184
|
-
*
|
|
185
|
-
* @this {import('../adb.js').ADB}
|
|
186
|
-
* @param {number} emPort - The emulator port to be set.
|
|
187
|
-
*/
|
|
188
|
-
constructor(this: import("../adb.js").ADB, emPort: number);
|
|
189
|
-
emulatorPort: number;
|
|
190
|
-
}
|
|
153
|
+
* @param emPort - The emulator port number
|
|
154
|
+
*/
|
|
155
|
+
export declare function setEmulatorPort(this: ADB, emPort: number): void;
|
|
191
156
|
/**
|
|
192
157
|
* Set the identifier of the current device (_this.curDeviceId_).
|
|
193
158
|
*
|
|
194
|
-
* @
|
|
195
|
-
* @param {string} deviceId - The device identifier.
|
|
159
|
+
* @param deviceId - The device identifier
|
|
196
160
|
*/
|
|
197
|
-
export function setDeviceId(this:
|
|
198
|
-
export class setDeviceId {
|
|
199
|
-
/**
|
|
200
|
-
* Set the identifier of the current device (_this.curDeviceId_).
|
|
201
|
-
*
|
|
202
|
-
* @this {import('../adb.js').ADB}
|
|
203
|
-
* @param {string} deviceId - The device identifier.
|
|
204
|
-
*/
|
|
205
|
-
constructor(this: import("../adb.js").ADB, deviceId: string);
|
|
206
|
-
curDeviceId: string;
|
|
207
|
-
}
|
|
161
|
+
export declare function setDeviceId(this: ADB, deviceId: string): void;
|
|
208
162
|
/**
|
|
209
|
-
* Set the
|
|
163
|
+
* Set the current device object.
|
|
210
164
|
*
|
|
211
|
-
* @
|
|
212
|
-
* @param {import('./types').Device} deviceObj - The device object to be set.
|
|
165
|
+
* @param deviceObj - The device object containing udid and other properties
|
|
213
166
|
*/
|
|
214
|
-
export function setDevice(this:
|
|
167
|
+
export declare function setDevice(this: ADB, deviceObj: Device): void;
|
|
215
168
|
/**
|
|
216
169
|
* Get the object for the currently running emulator.
|
|
217
170
|
* !!! This method has a side effect - it implicitly changes the
|
|
218
171
|
* `deviceId` (only if AVD with a matching name is found)
|
|
219
172
|
* and `emulatorPort` instance properties.
|
|
220
173
|
*
|
|
221
|
-
* @
|
|
222
|
-
* @
|
|
223
|
-
* @
|
|
174
|
+
* @param avdName - The name of the AVD to find
|
|
175
|
+
* @returns The device object if found, null otherwise
|
|
176
|
+
* @throws {Error} If error occurs while getting AVD
|
|
224
177
|
*/
|
|
225
|
-
export function getRunningAVD(this:
|
|
178
|
+
export declare function getRunningAVD(this: ADB, avdName: string): Promise<Device | null>;
|
|
226
179
|
/**
|
|
227
|
-
* Get the object for the currently running emulator.
|
|
180
|
+
* Get the object for the currently running emulator with retry.
|
|
228
181
|
*
|
|
229
|
-
* @
|
|
230
|
-
* @param
|
|
231
|
-
* @
|
|
232
|
-
*
|
|
233
|
-
* is detected.
|
|
234
|
-
* @return {Promise<import('./types').Device|null>} Currently running emulator or _null_.
|
|
235
|
-
* @throws {Error} If no device has been detected within the timeout.
|
|
182
|
+
* @param avdName - The name of the AVD to find
|
|
183
|
+
* @param timeoutMs - Maximum time to wait (default: 20000ms)
|
|
184
|
+
* @returns The device object if found, null otherwise
|
|
185
|
+
* @throws {Error} If error occurs while getting AVD with retry
|
|
236
186
|
*/
|
|
237
|
-
export function getRunningAVDWithRetry(this:
|
|
187
|
+
export declare function getRunningAVDWithRetry(this: ADB, avdName: string, timeoutMs?: number): Promise<Device | null>;
|
|
238
188
|
/**
|
|
239
189
|
* Shutdown all running emulators by killing their processes.
|
|
240
190
|
*
|
|
241
|
-
* @
|
|
242
|
-
* @throws {Error} If killing tool returned non-zero return code.
|
|
191
|
+
* @throws {Error} If error occurs while killing emulators
|
|
243
192
|
*/
|
|
244
|
-
export function killAllEmulators(this:
|
|
193
|
+
export declare function killAllEmulators(this: ADB): Promise<void>;
|
|
245
194
|
/**
|
|
246
195
|
* Kill emulator with the given name. No error
|
|
247
|
-
* is thrown
|
|
196
|
+
* is thrown if given avd does not exist/is not running.
|
|
248
197
|
*
|
|
249
|
-
* @
|
|
250
|
-
* @param
|
|
251
|
-
*
|
|
252
|
-
* @
|
|
253
|
-
* an exception about unsuccessful killing
|
|
254
|
-
* @return {Promise<boolean>} - True if the emulator was killed, false otherwise.
|
|
255
|
-
* @throws {Error} if there was a failure by killing the emulator
|
|
198
|
+
* @param avdName - The name of the AVD to kill (null to kill current AVD)
|
|
199
|
+
* @param timeout - Maximum time to wait for emulator to be killed (default: 60000ms)
|
|
200
|
+
* @returns True if emulator was killed, false if it was not running
|
|
201
|
+
* @throws {Error} If emulator is still running after timeout
|
|
256
202
|
*/
|
|
257
|
-
export function killEmulator(this:
|
|
203
|
+
export declare function killEmulator(this: ADB, avdName?: string | null, timeout?: number): Promise<boolean>;
|
|
258
204
|
/**
|
|
259
205
|
* Start an emulator with given parameters and wait until it is fully started.
|
|
260
206
|
*
|
|
261
|
-
* @
|
|
262
|
-
* @param
|
|
263
|
-
* @
|
|
264
|
-
* @
|
|
265
|
-
* @throws {Error} If the emulator fails to start within the given timeout.
|
|
207
|
+
* @param avdName - The name of the AVD to launch
|
|
208
|
+
* @param opts - Launch options
|
|
209
|
+
* @returns The SubProcess instance for the launched emulator
|
|
210
|
+
* @throws {Error} If emulator fails to launch or boot
|
|
266
211
|
*/
|
|
267
|
-
export function launchAVD(this:
|
|
212
|
+
export declare function launchAVD(this: ADB, avdName: string, opts?: AvdLaunchOptions): Promise<SubProcess>;
|
|
213
|
+
/**
|
|
214
|
+
* Get the adb version. The result of this method is cached.
|
|
215
|
+
*
|
|
216
|
+
* @returns Version information object
|
|
217
|
+
* @throws {Error} If error occurs while getting adb version
|
|
218
|
+
*/
|
|
219
|
+
export declare const getVersion: ((this: ADB) => Promise<Version>) & _.MemoizedFunction;
|
|
268
220
|
/**
|
|
269
221
|
* Check if the current emulator is ready to accept further commands (booting completed).
|
|
270
222
|
*
|
|
271
|
-
* @
|
|
272
|
-
* @
|
|
273
|
-
* @returns {Promise<void>}
|
|
274
|
-
* @throws {Error} If the emulator is not ready within the given timeout.
|
|
223
|
+
* @param timeoutMs - Maximum time to wait (default: 20000ms)
|
|
224
|
+
* @throws {Error} If emulator is not ready within the timeout period
|
|
275
225
|
*/
|
|
276
|
-
export function waitForEmulatorReady(this:
|
|
226
|
+
export declare function waitForEmulatorReady(this: ADB, timeoutMs?: number): Promise<void>;
|
|
277
227
|
/**
|
|
278
228
|
* Check if the current device is ready to accept further commands (booting completed).
|
|
279
229
|
*
|
|
280
|
-
* @
|
|
281
|
-
* @
|
|
282
|
-
* @throws {Error} If the device is not ready within the given timeout.
|
|
230
|
+
* @param appDeviceReadyTimeout - Timeout in seconds (default: 30)
|
|
231
|
+
* @throws {Error} If device is not ready within the timeout period
|
|
283
232
|
*/
|
|
284
|
-
export function waitForDevice(this:
|
|
233
|
+
export declare function waitForDevice(this: ADB, appDeviceReadyTimeout?: number): Promise<void>;
|
|
285
234
|
/**
|
|
286
235
|
* Reboot the current device and wait until it is completed.
|
|
287
236
|
*
|
|
288
|
-
* @
|
|
289
|
-
* @
|
|
290
|
-
* @throws {Error} If the device failed to reboot and number of retries is exceeded.
|
|
237
|
+
* @param retries - Number of retry attempts (default: 90)
|
|
238
|
+
* @throws {Error} If reboot fails or device is not ready after reboot
|
|
291
239
|
*/
|
|
292
|
-
export function reboot(this:
|
|
240
|
+
export declare function reboot(this: ADB, retries?: number): Promise<void>;
|
|
293
241
|
/**
|
|
294
242
|
* Switch adb server root privileges.
|
|
295
243
|
*
|
|
296
|
-
* @
|
|
297
|
-
* @
|
|
298
|
-
* @return {Promise<import('./types').RootResult>}
|
|
244
|
+
* @param isElevated - True to enable root, false to disable
|
|
245
|
+
* @returns Result object indicating success and whether device was already rooted
|
|
299
246
|
*/
|
|
300
|
-
export function changeUserPrivileges(this:
|
|
247
|
+
export declare function changeUserPrivileges(this: ADB, isElevated: boolean): Promise<RootResult>;
|
|
301
248
|
/**
|
|
302
249
|
* Switch adb server to root mode
|
|
303
250
|
*
|
|
304
|
-
* @
|
|
305
|
-
* @return {Promise<import('./types').RootResult>}
|
|
251
|
+
* @returns Result object indicating success and whether device was already rooted
|
|
306
252
|
*/
|
|
307
|
-
export function root(this:
|
|
253
|
+
export declare function root(this: ADB): Promise<RootResult>;
|
|
308
254
|
/**
|
|
309
255
|
* Switch adb server to non-root mode.
|
|
310
256
|
*
|
|
311
|
-
* @
|
|
312
|
-
* @return {Promise<import('./types').RootResult>}
|
|
257
|
+
* @returns Result object indicating success and whether device was already rooted
|
|
313
258
|
*/
|
|
314
|
-
export function unroot(this:
|
|
259
|
+
export declare function unroot(this: ADB): Promise<RootResult>;
|
|
315
260
|
/**
|
|
316
261
|
* Checks whether the current user is root
|
|
317
262
|
*
|
|
318
|
-
* @
|
|
319
|
-
* @return {Promise<boolean>} True if the user is root
|
|
320
|
-
* @throws {Error} if there was an error while identifying
|
|
321
|
-
* the user.
|
|
263
|
+
* @returns True if current user is root, false otherwise
|
|
322
264
|
*/
|
|
323
|
-
export function isRoot(this:
|
|
265
|
+
export declare function isRoot(this: ADB): Promise<boolean>;
|
|
324
266
|
/**
|
|
325
267
|
* Installs the given certificate on a rooted real device or
|
|
326
268
|
* an emulator. The emulator must be executed with `-writable-system`
|
|
@@ -330,97 +272,45 @@ export function isRoot(this: import("../adb.js").ADB): Promise<boolean>;
|
|
|
330
272
|
* Read https://github.com/appium/appium/issues/10964
|
|
331
273
|
* for more details on this topic
|
|
332
274
|
*
|
|
333
|
-
* @
|
|
334
|
-
* @
|
|
335
|
-
* represented as a string or a buffer
|
|
336
|
-
* @throws {Error} If openssl tool is not available on the destination system
|
|
337
|
-
* or if there was an error while installing the certificate
|
|
275
|
+
* @param cert - Certificate as Buffer or base64-encoded string
|
|
276
|
+
* @throws {Error} If certificate installation fails
|
|
338
277
|
*/
|
|
339
|
-
export function installMitmCertificate(this:
|
|
278
|
+
export declare function installMitmCertificate(this: ADB, cert: Buffer | string): Promise<void>;
|
|
340
279
|
/**
|
|
341
280
|
* Verifies if the given root certificate is already installed on the device.
|
|
342
281
|
*
|
|
343
|
-
* @
|
|
344
|
-
* @
|
|
345
|
-
*
|
|
346
|
-
* @throws {Error} If openssl tool is not available on the destination system
|
|
347
|
-
* or if there was an error while checking the certificate
|
|
348
|
-
* @returns {Promise<boolean>} true if the given certificate is already installed
|
|
282
|
+
* @param cert - Certificate as Buffer or base64-encoded string
|
|
283
|
+
* @returns True if certificate is installed, false otherwise
|
|
284
|
+
* @throws {Error} If certificate hash cannot be retrieved
|
|
349
285
|
*/
|
|
350
|
-
export function isMitmCertificateInstalled(this:
|
|
286
|
+
export declare function isMitmCertificateInstalled(this: ADB, cert: Buffer | string): Promise<boolean>;
|
|
351
287
|
/**
|
|
352
288
|
* Creates chunks for the given arguments and executes them in `adb shell`.
|
|
353
289
|
* This is faster than calling `adb shell` separately for each arg, however
|
|
354
290
|
* there is a limit for a maximum length of a single adb command. that is why
|
|
355
291
|
* we need all this complicated logic.
|
|
356
292
|
*
|
|
357
|
-
* @
|
|
358
|
-
* @param
|
|
359
|
-
*
|
|
360
|
-
* of the function must be an array, where each item is a part of a single command.
|
|
361
|
-
* The last item of the array could be ';'. If this is not a semicolon then it is going to
|
|
362
|
-
* be added automatically.
|
|
363
|
-
* @param {string[]} args Array of argument values to create chunks for
|
|
364
|
-
* @throws {Error} If any of the chunks returns non-zero exit code after being executed
|
|
293
|
+
* @param argTransformer - Function to transform each argument into command array
|
|
294
|
+
* @param args - Array of arguments to process
|
|
295
|
+
* @throws {Error} If argument transformer returns invalid result or command execution fails
|
|
365
296
|
*/
|
|
366
|
-
export function shellChunks(this:
|
|
297
|
+
export declare function shellChunks(this: ADB, argTransformer: (x: string) => string[], args: string[]): Promise<void>;
|
|
367
298
|
/**
|
|
368
299
|
* Transforms the given language and country abbreviations
|
|
369
300
|
* to AVD arguments array
|
|
370
301
|
*
|
|
371
|
-
* @param
|
|
372
|
-
* @param
|
|
373
|
-
* @returns
|
|
374
|
-
* resulting array might be empty if both arguments are empty
|
|
375
|
-
*/
|
|
376
|
-
export function toAvdLocaleArgs(language: string | null, country: string | null): Array<string>;
|
|
377
|
-
export const getBinaryNameForOS: typeof _getBinaryNameForOS & _.MemoizedFunction;
|
|
378
|
-
/**
|
|
379
|
-
* Reset Telnet authentication token.
|
|
380
|
-
* @see {@link http://tools.android.com/recent/emulator2516releasenotes} for more details.
|
|
381
|
-
*
|
|
382
|
-
* @this {import('../adb.js').ADB}
|
|
383
|
-
* @returns {Promise<boolean>} If token reset was successful.
|
|
302
|
+
* @param language - Language code (e.g., 'en', 'fr')
|
|
303
|
+
* @param country - Country code (e.g., 'US', 'FR')
|
|
304
|
+
* @returns Array of AVD locale arguments
|
|
384
305
|
*/
|
|
385
|
-
export
|
|
386
|
-
/** @type {{STDOUT: 'stdout', FULL: 'full'}} */
|
|
387
|
-
export const EXEC_OUTPUT_FORMAT: {
|
|
388
|
-
STDOUT: "stdout";
|
|
389
|
-
FULL: "full";
|
|
390
|
-
};
|
|
391
|
-
/**
|
|
392
|
-
* Get the adb version. The result of this method is cached.
|
|
393
|
-
*
|
|
394
|
-
* @this {import('../adb.js').ADB}
|
|
395
|
-
* @return {Promise<import('./types').Version>}
|
|
396
|
-
* @throws {Error} If it is not possible to parse adb binary version.
|
|
397
|
-
*/
|
|
398
|
-
export const getVersion: (() => Promise<{
|
|
399
|
-
binary: {
|
|
400
|
-
version: semver.SemVer | null;
|
|
401
|
-
build: number;
|
|
402
|
-
};
|
|
403
|
-
bridge: {
|
|
404
|
-
version: semver.SemVer | null;
|
|
405
|
-
};
|
|
406
|
-
}>) & _.MemoizedFunction;
|
|
306
|
+
export declare function toAvdLocaleArgs(language: string | null, country: string | null): string[];
|
|
407
307
|
/**
|
|
408
308
|
* Retrieves full paths to all 'build-tools' subfolders under the particular
|
|
409
309
|
* SDK root folder
|
|
410
310
|
*
|
|
411
|
-
* @
|
|
311
|
+
* @param sdkRoot - The Android SDK root directory path
|
|
312
|
+
* @returns Array of build-tools directory paths (newest first)
|
|
412
313
|
*/
|
|
413
|
-
export const getBuildToolsDirs: (sdkRoot: string) => Promise<string[]
|
|
414
|
-
import { SubProcess } from 'teen_process';
|
|
415
|
-
/**
|
|
416
|
-
* Retrieve full binary name for the current operating system.
|
|
417
|
-
*
|
|
418
|
-
* @param {string} binaryName - simple binary name, for example 'android'.
|
|
419
|
-
* @return {string} Formatted binary name depending on the current platform,
|
|
420
|
-
* for example, 'android.bat' on Windows.
|
|
421
|
-
*/
|
|
422
|
-
declare function _getBinaryNameForOS(binaryName: string): string;
|
|
423
|
-
import _ from 'lodash';
|
|
424
|
-
import * as semver from 'semver';
|
|
314
|
+
export declare const getBuildToolsDirs: ((sdkRoot: string) => Promise<string[]>) & _.MemoizedFunction;
|
|
425
315
|
export {};
|
|
426
316
|
//# sourceMappingURL=system-calls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-calls.d.ts","sourceRoot":"","sources":["../../../lib/tools/system-calls.
|
|
1
|
+
{"version":3,"file":"system-calls.d.ts","sourceRoot":"","sources":["../../../lib/tools/system-calls.ts"],"names":[],"mappings":"AAOA,OAAO,EAAQ,UAAU,EAAkB,MAAM,cAAc,CAAC;AAEhE,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EACV,uBAAuB,EACvB,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AA0BpB;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAYxD;AA+BD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtF;AAED,eAAO,MAAM,kBAAkB,iDAAiC,CAAC;AAEjE;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8C1F;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW/E;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBvF;AAED;;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