appium-adb 12.11.0 → 12.12.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/helpers.d.ts +0 -193
  3. package/build/lib/helpers.d.ts.map +1 -1
  4. package/build/lib/helpers.js +1 -837
  5. package/build/lib/helpers.js.map +1 -1
  6. package/build/lib/tools/android-manifest.d.ts +7 -0
  7. package/build/lib/tools/android-manifest.d.ts.map +1 -1
  8. package/build/lib/tools/android-manifest.js +45 -1
  9. package/build/lib/tools/android-manifest.js.map +1 -1
  10. package/build/lib/tools/apk-signing.d.ts +19 -0
  11. package/build/lib/tools/apk-signing.d.ts.map +1 -1
  12. package/build/lib/tools/apk-signing.js +55 -3
  13. package/build/lib/tools/apk-signing.js.map +1 -1
  14. package/build/lib/tools/apk-utils.d.ts +22 -0
  15. package/build/lib/tools/apk-utils.d.ts.map +1 -1
  16. package/build/lib/tools/apk-utils.js +223 -4
  17. package/build/lib/tools/apk-utils.js.map +1 -1
  18. package/build/lib/tools/apks-utils.d.ts.map +1 -1
  19. package/build/lib/tools/apks-utils.js +2 -1
  20. package/build/lib/tools/apks-utils.js.map +1 -1
  21. package/build/lib/tools/app-commands.d.ts +52 -0
  22. package/build/lib/tools/app-commands.d.ts.map +1 -1
  23. package/build/lib/tools/app-commands.js +276 -8
  24. package/build/lib/tools/app-commands.js.map +1 -1
  25. package/build/lib/tools/device-settings.d.ts.map +1 -1
  26. package/build/lib/tools/device-settings.js +13 -2
  27. package/build/lib/tools/device-settings.js.map +1 -1
  28. package/build/lib/tools/emulator-commands.d.ts.map +1 -1
  29. package/build/lib/tools/emulator-commands.js +37 -4
  30. package/build/lib/tools/emulator-commands.js.map +1 -1
  31. package/build/lib/tools/keyboard-commands.d.ts.map +1 -1
  32. package/build/lib/tools/keyboard-commands.js +19 -3
  33. package/build/lib/tools/keyboard-commands.js.map +1 -1
  34. package/build/lib/tools/lockmgmt.d.ts +25 -0
  35. package/build/lib/tools/lockmgmt.d.ts.map +1 -1
  36. package/build/lib/tools/lockmgmt.js +75 -6
  37. package/build/lib/tools/lockmgmt.js.map +1 -1
  38. package/build/lib/tools/system-calls.d.ts +17 -0
  39. package/build/lib/tools/system-calls.d.ts.map +1 -1
  40. package/build/lib/tools/system-calls.js +87 -5
  41. package/build/lib/tools/system-calls.js.map +1 -1
  42. package/lib/helpers.js +1 -834
  43. package/lib/tools/android-manifest.js +50 -2
  44. package/lib/tools/apk-signing.js +60 -4
  45. package/lib/tools/apk-utils.js +229 -1
  46. package/lib/tools/apks-utils.js +2 -1
  47. package/lib/tools/app-commands.js +295 -5
  48. package/lib/tools/device-settings.js +15 -1
  49. package/lib/tools/emulator-commands.js +43 -1
  50. package/lib/tools/keyboard-commands.js +20 -1
  51. package/lib/tools/lockmgmt.js +76 -5
  52. package/lib/tools/system-calls.js +84 -2
  53. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [12.12.1](https://github.com/appium/appium-adb/compare/v12.12.0...v12.12.1) (2025-01-25)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * Only keep common functions in helpers ([#792](https://github.com/appium/appium-adb/issues/792)) ([18e7919](https://github.com/appium/appium-adb/commit/18e7919a812b4c1f9078e302ec75b5c86771314a))
6
+
7
+ ## [12.12.0](https://github.com/appium/appium-adb/compare/v12.11.0...v12.12.0) (2025-01-24)
8
+
9
+ ### Features
10
+
11
+ * add screenState=SCREEN_STATE_OFF as the screen locked ([#791](https://github.com/appium/appium-adb/issues/791)) ([6f6f45a](https://github.com/appium/appium-adb/commit/6f6f45adcd520e8ae369e0735bafd4613c5cc6a1))
12
+
1
13
  ## [12.11.0](https://github.com/appium/appium-adb/compare/v12.10.3...v12.11.0) (2025-01-11)
2
14
 
3
15
  ### Features
@@ -13,87 +13,11 @@ export function getSdkRootFromEnv(): string | undefined;
13
13
  * pointing to an invalid file system entry
14
14
  */
15
15
  export function requireSdkRoot(customRoot?: string | null): Promise<string>;
16
- /**
17
- * Retrieve the path to the recent installed Android platform.
18
- *
19
- * @param {string} sdkRoot
20
- * @return {Promise<import('./tools/types').PlatformInfo>} The resulting path to the newest installed platform.
21
- */
22
- export function getAndroidPlatformAndPath(sdkRoot: string): Promise<import("./tools/types").PlatformInfo>;
23
16
  /**
24
17
  * @param {string} zipPath
25
18
  * @param {string} dstRoot
26
19
  */
27
20
  export function unzipFile(zipPath: string, dstRoot?: string): Promise<void>;
28
- /**
29
- * Unsigns the given apk by removing the
30
- * META-INF folder recursively from the archive.
31
- * !!! The function overwrites the given apk after successful unsigning !!!
32
- *
33
- * @param {string} apkPath The path to the apk
34
- * @returns {Promise<boolean>} `true` if the apk has been successfully
35
- * unsigned and overwritten
36
- * @throws {Error} if there was an error during the unsign operation
37
- */
38
- export function unsignApk(apkPath: string): Promise<boolean>;
39
- /**
40
- * @param {string} stdout
41
- * @returns {string[]}
42
- */
43
- export function getIMEListFromOutput(stdout: string): string[];
44
- /**
45
- * Get the absolute path to apksigner tool
46
- *
47
- * @param {Object} sysHelpers - An instance containing systemCallMethods helper methods
48
- * @returns {Promise<string>} An absolute path to apksigner tool.
49
- * @throws {Error} If the tool is not present on the local file system.
50
- */
51
- export function getApksignerForOs(sysHelpers: any): Promise<string>;
52
- /**
53
- * Get the absolute path to apkanalyzer tool.
54
- * https://developer.android.com/studio/command-line/apkanalyzer.html
55
- *
56
- * @param {Object} sysHelpers - An instance containing systemCallMethods helper methods
57
- * @returns {Promise<string>} An absolute path to apkanalyzer tool.
58
- * @throws {Error} If the tool is not present on the local file system.
59
- */
60
- export function getApkanalyzerForOs(sysHelpers: any): Promise<string>;
61
- /**
62
- * Checks mShowingLockscreen or mDreamingLockscreen in dumpsys output to determine
63
- * if lock screen is showing
64
- *
65
- * A note: `adb shell dumpsys trust` performs better while detecting the locked screen state
66
- * in comparison to `adb dumpsys window` output parsing.
67
- * But the trust command does not work for `Swipe` unlock pattern.
68
- *
69
- * In some Android devices (Probably around Android 10+), `mShowingLockscreen` and `mDreamingLockscreen`
70
- * do not work to detect lock status. Instead, keyguard preferences helps to detect the lock condition.
71
- * Some devices such as Android TV do not have keyguard, so we should keep
72
- * screen condition as this primary method.
73
- *
74
- * @param {string} dumpsys - The output of dumpsys window command.
75
- * @return {boolean} True if lock screen is showing.
76
- */
77
- export function isShowingLockscreen(dumpsys: string): boolean;
78
- /**
79
- * Check the current device power state to determine if it is locked
80
- *
81
- * @param {string} dumpsys The `adb shell dumpsys power` output
82
- * @returns {boolean} True if lock screen is shown
83
- */
84
- export function isInDozingMode(dumpsys: string): boolean;
85
- export function isCurrentFocusOnKeyguard(dumpsys: any): boolean;
86
- export function getSurfaceOrientation(dumpsys: any): number | null;
87
- export function isScreenOnFully(dumpsys: any): boolean;
88
- /**
89
- * Builds command line representation for the given
90
- * application startup options
91
- *
92
- * @param {StartCmdOptions} startAppOptions - Application options mapping
93
- * @param {number} apiLevel - The actual OS API level
94
- * @returns {string[]} The actual command line array
95
- */
96
- export function buildStartCmd(startAppOptions: StartCmdOptions, apiLevel: number): string[];
97
21
  /**
98
22
  * Transforms given options into the list of `adb install.install-multiple` command arguments
99
23
  *
@@ -102,95 +26,6 @@ export function buildStartCmd(startAppOptions: StartCmdOptions, apiLevel: number
102
26
  * @returns {string[]} The array of arguments
103
27
  */
104
28
  export function buildInstallArgs(apiLevel: number, options?: InstallOptions): string[];
105
- /**
106
- * Parses apk strings from aapt tool output
107
- *
108
- * @param {string} rawOutput The actual tool output
109
- * @param {string} configMarker The config marker. Usually
110
- * a language abbreviation or `(default)`
111
- * @returns {Object} Strings ids to values mapping. Plural
112
- * values are represented as arrays. If no config found for the
113
- * given marker then an empty mapping is returned.
114
- */
115
- export function parseAaptStrings(rawOutput: string, configMarker: string): any;
116
- /**
117
- * Parses apk strings from aapt2 tool output
118
- *
119
- * @param {string} rawOutput The actual tool output
120
- * @param {string} configMarker The config marker. Usually
121
- * a language abbreviation or an empty string for the default one
122
- * @returns {Object} Strings ids to values mapping. Plural
123
- * values are represented as arrays. If no config found for the
124
- * given marker then an empty mapping is returned.
125
- */
126
- export function parseAapt2Strings(rawOutput: string, configMarker: string): any;
127
- /**
128
- * Formats the config marker, which is then passed to parse.. methods
129
- * to make it compatible with resource formats generated by aapt(2) tool
130
- *
131
- * @param {Function} configsGetter The function whose result is a list
132
- * of apk configs
133
- * @param {string?} desiredMarker The desired config marker value
134
- * @param {string} defaultMarker The default config marker value
135
- * @return {Promise<string>} The formatted config marker
136
- */
137
- export function formatConfigMarker(configsGetter: Function, desiredMarker: string | null, defaultMarker: string): Promise<string>;
138
- /**
139
- * Transforms the given language and country abbreviations
140
- * to AVD arguments array
141
- *
142
- * @param {?string} language Language name, for example 'fr'
143
- * @param {?string} country Country name, for example 'CA'
144
- * @returns {Array<string>} The generated arguments. The
145
- * resulting array might be empty if both arguments are empty
146
- */
147
- export function toAvdLocaleArgs(language: string | null, country: string | null): Array<string>;
148
- /**
149
- * Retrieves the full path to the Android preferences root
150
- *
151
- * @returns {Promise<string?>} The full path to the folder or `null` if the folder cannot be found
152
- */
153
- export function getAndroidPrefsRoot(): Promise<string | null>;
154
- /**
155
- * Check if a path exists on the filesystem and is a directory
156
- *
157
- * @param {string} location The full path to the directory
158
- * @returns {Promise<boolean>}
159
- */
160
- export function dirExists(location: string): Promise<boolean>;
161
- /**
162
- * Escapes special characters in command line arguments.
163
- * This is needed to avoid possible issues with how system `spawn`
164
- * call handles them.
165
- * See https://discuss.appium.io/t/how-to-modify-wd-proxy-and-uiautomator2-source-code-to-support-unicode/33466
166
- * for more details.
167
- *
168
- * @param {string} arg Non-escaped argument string
169
- * @returns The escaped argument
170
- */
171
- export function escapeShellArg(arg: string): string;
172
- /**
173
- * Parses the name of launchable package activity
174
- * from dumpsys output.
175
- *
176
- * @param {string} dumpsys the actual dumpsys output
177
- * @returns {string[]} Either the fully qualified
178
- * activity name as a single list item or an empty list if nothing could be parsed.
179
- * In Android 6 and older there is no reliable way to determine
180
- * the category name for the given activity, so this API just
181
- * returns all activity names belonging to 'android.intent.action.MAIN'
182
- * with the expectation that the app manifest could be parsed next
183
- * in order to determine category names for these.
184
- */
185
- export function parseLaunchableActivityNames(dumpsys: string): string[];
186
- /**
187
- * Check if the given string is a valid component name
188
- *
189
- * @param {string} classString The string to verify
190
- * @return {RegExpExecArray?} The result of Regexp.exec operation
191
- * or _null_ if no matches are found
192
- */
193
- export function matchComponentName(classString: string): RegExpExecArray | null;
194
29
  /**
195
30
  * Extracts various package manifest details
196
31
  * from the given application file.
@@ -203,7 +38,6 @@ export function readPackageManifest(this: import("./adb.js").ADB, apkPath: strin
203
38
  export const APKS_EXTENSION: ".apks";
204
39
  export const APK_EXTENSION: ".apk";
205
40
  export const APK_INSTALL_TIMEOUT: 60000;
206
- export const APKS_INSTALL_TIMEOUT: number;
207
41
  export const DEFAULT_ADB_EXEC_TIMEOUT: 20000;
208
42
  /**
209
43
  * Calculates the absolsute path to the given resource
@@ -217,22 +51,6 @@ export const getResourcePath: ((relPath: any) => Promise<string>) & _.MemoizedFu
217
51
  export const getJavaHome: () => Promise<string>;
218
52
  /** @type {() => Promise<string>} */
219
53
  export const getJavaForOs: () => Promise<string>;
220
- /** @type {() => Promise<string>} */
221
- export const getOpenSslForOs: () => Promise<string>;
222
- /** @type {() => Promise<{major: number, minor: number, build: number}?>} */
223
- export const getSdkToolsVersion: () => Promise<{
224
- major: number;
225
- minor: number;
226
- build: number;
227
- } | null>;
228
- /**
229
- * Retrieves full paths to all 'build-tools' subfolders under the particular
230
- * SDK root folder
231
- *
232
- * @type {(sdkRoot: string) => Promise<string[]>}
233
- */
234
- export const getBuildToolsDirs: (sdkRoot: string) => Promise<string[]>;
235
- export function extractMatchingPermissions(dumpsysOutput: string, groupNames: string[], grantedState?: boolean | null): string[];
236
54
  export type InstallOptions = {
237
55
  /**
238
56
  * - Set to true in order to allow test
@@ -263,16 +81,5 @@ export type InstallOptions = {
263
81
  */
264
82
  partialInstall?: boolean | undefined;
265
83
  };
266
- export type StartCmdOptions = {
267
- user?: string | number | undefined;
268
- waitForLaunch?: boolean | undefined;
269
- pkg?: string | undefined;
270
- activity?: string | undefined;
271
- action?: string | undefined;
272
- category?: string | undefined;
273
- stopApp?: boolean | undefined;
274
- flags?: string | undefined;
275
- optionalIntentArguments?: string | undefined;
276
- };
277
84
  import _ from 'lodash';
278
85
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.js"],"names":[],"mappings":"AA6DA;;;;GAIG;AACH,qCAFY,MAAM,GAAC,SAAS,CAI3B;AAED;;;;;;;GAOG;AACH,4CALW,MAAM,OAAC,GACN,OAAO,CAAC,MAAM,CAAC,CAmB1B;AAED;;;;;GAKG;AACH,mDAHW,MAAM,GACL,OAAO,CAAC,OAAO,eAAe,EAAE,YAAY,CAAC,CAoCxD;AAED;;;GAGG;AACH,mCAHW,MAAM,YACN,MAAM,iBAOhB;AAED;;;;;;;;;GASG;AACH,mCALW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CA8B5B;AAED;;;GAGG;AACH,6CAHW,MAAM,GACJ,MAAM,EAAE,CAWpB;AAmDD;;;;;;GAMG;AACH,oDAHa,OAAO,CAAC,MAAM,CAAC,CAK3B;AAED;;;;;;;GAOG;AACH,sDAHa,OAAO,CAAC,MAAM,CAAC,CAK3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,6CAHW,MAAM,GACL,OAAO,CAMlB;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,OAAO,CAMnB;AAKD,gEAGC;AAKD,mEAGC;AAMD,uDAIC;AAED;;;;;;;GAOG;AACH,+CAJW,eAAe,YACf,MAAM,GACJ,MAAM,EAAE,CAwCpB;AAqHD;;;;;;GAMG;AACH,2CAJW,MAAM,YACN,cAAc,GACZ,MAAM,EAAE,CA6BpB;AACD;;;;;;;;;GASG;AACH,4CAPW,MAAM,gBACN,MAAM,OA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