appium-adb 12.12.0 → 12.12.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/helpers.d.ts +0 -201
  3. package/build/lib/helpers.d.ts.map +1 -1
  4. package/build/lib/helpers.js +1 -849
  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 +285 -9
  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 -7
  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 -846
  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 +304 -6
  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 +74 -4
  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.2](https://github.com/appium/appium-adb/compare/v12.12.1...v12.12.2) (2025-04-17)
2
+
3
+ ### Bug Fixes
4
+
5
+ * Update comparison logic for the activity name when there are multiple active app ([#798](https://github.com/appium/appium-adb/issues/798)) ([dbdd083](https://github.com/appium/appium-adb/commit/dbdd083d70237e623cc7ed903fecf48ddab722f2))
6
+
7
+ ## [12.12.1](https://github.com/appium/appium-adb/compare/v12.12.0...v12.12.1) (2025-01-25)
8
+
9
+ ### Miscellaneous Chores
10
+
11
+ * Only keep common functions in helpers ([#792](https://github.com/appium/appium-adb/issues/792)) ([18e7919](https://github.com/appium/appium-adb/commit/18e7919a812b4c1f9078e302ec75b5c86771314a))
12
+
1
13
  ## [12.12.0](https://github.com/appium/appium-adb/compare/v12.11.0...v12.12.0) (2025-01-24)
2
14
 
3
15
  ### Features
@@ -13,95 +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 screenState has SCREEN_STATE_OFF in dumpsys output to determine
63
- * possible lock screen.
64
- *
65
- * @param {string} dumpsys - The output of dumpsys window command.
66
- * @return {boolean} True if lock screen is showing.
67
- */
68
- export function isScreenStateOff(dumpsys: string): boolean;
69
- /**
70
- * Checks mShowingLockscreen or mDreamingLockscreen in dumpsys output to determine
71
- * if lock screen is showing
72
- *
73
- * A note: `adb shell dumpsys trust` performs better while detecting the locked screen state
74
- * in comparison to `adb dumpsys window` output parsing.
75
- * But the trust command does not work for `Swipe` unlock pattern.
76
- *
77
- * In some Android devices (Probably around Android 10+), `mShowingLockscreen` and `mDreamingLockscreen`
78
- * do not work to detect lock status. Instead, keyguard preferences helps to detect the lock condition.
79
- * Some devices such as Android TV do not have keyguard, so we should keep
80
- * screen condition as this primary method.
81
- *
82
- * @param {string} dumpsys - The output of dumpsys window command.
83
- * @return {boolean} True if lock screen is showing.
84
- */
85
- export function isShowingLockscreen(dumpsys: string): boolean;
86
- /**
87
- * Check the current device power state to determine if it is locked
88
- *
89
- * @param {string} dumpsys The `adb shell dumpsys power` output
90
- * @returns {boolean} True if lock screen is shown
91
- */
92
- export function isInDozingMode(dumpsys: string): boolean;
93
- export function isCurrentFocusOnKeyguard(dumpsys: any): boolean;
94
- export function getSurfaceOrientation(dumpsys: any): number | null;
95
- export function isScreenOnFully(dumpsys: any): boolean;
96
- /**
97
- * Builds command line representation for the given
98
- * application startup options
99
- *
100
- * @param {StartCmdOptions} startAppOptions - Application options mapping
101
- * @param {number} apiLevel - The actual OS API level
102
- * @returns {string[]} The actual command line array
103
- */
104
- export function buildStartCmd(startAppOptions: StartCmdOptions, apiLevel: number): string[];
105
21
  /**
106
22
  * Transforms given options into the list of `adb install.install-multiple` command arguments
107
23
  *
@@ -110,95 +26,6 @@ export function buildStartCmd(startAppOptions: StartCmdOptions, apiLevel: number
110
26
  * @returns {string[]} The array of arguments
111
27
  */
112
28
  export function buildInstallArgs(apiLevel: number, options?: InstallOptions): string[];
113
- /**
114
- * Parses apk strings from aapt tool output
115
- *
116
- * @param {string} rawOutput The actual tool output
117
- * @param {string} configMarker The config marker. Usually
118
- * a language abbreviation or `(default)`
119
- * @returns {Object} Strings ids to values mapping. Plural
120
- * values are represented as arrays. If no config found for the
121
- * given marker then an empty mapping is returned.
122
- */
123
- export function parseAaptStrings(rawOutput: string, configMarker: string): any;
124
- /**
125
- * Parses apk strings from aapt2 tool output
126
- *
127
- * @param {string} rawOutput The actual tool output
128
- * @param {string} configMarker The config marker. Usually
129
- * a language abbreviation or an empty string for the default one
130
- * @returns {Object} Strings ids to values mapping. Plural
131
- * values are represented as arrays. If no config found for the
132
- * given marker then an empty mapping is returned.
133
- */
134
- export function parseAapt2Strings(rawOutput: string, configMarker: string): any;
135
- /**
136
- * Formats the config marker, which is then passed to parse.. methods
137
- * to make it compatible with resource formats generated by aapt(2) tool
138
- *
139
- * @param {Function} configsGetter The function whose result is a list
140
- * of apk configs
141
- * @param {string?} desiredMarker The desired config marker value
142
- * @param {string} defaultMarker The default config marker value
143
- * @return {Promise<string>} The formatted config marker
144
- */
145
- export function formatConfigMarker(configsGetter: Function, desiredMarker: string | null, defaultMarker: string): Promise<string>;
146
- /**
147
- * Transforms the given language and country abbreviations
148
- * to AVD arguments array
149
- *
150
- * @param {?string} language Language name, for example 'fr'
151
- * @param {?string} country Country name, for example 'CA'
152
- * @returns {Array<string>} The generated arguments. The
153
- * resulting array might be empty if both arguments are empty
154
- */
155
- export function toAvdLocaleArgs(language: string | null, country: string | null): Array<string>;
156
- /**
157
- * Retrieves the full path to the Android preferences root
158
- *
159
- * @returns {Promise<string?>} The full path to the folder or `null` if the folder cannot be found
160
- */
161
- export function getAndroidPrefsRoot(): Promise<string | null>;
162
- /**
163
- * Check if a path exists on the filesystem and is a directory
164
- *
165
- * @param {string} location The full path to the directory
166
- * @returns {Promise<boolean>}
167
- */
168
- export function dirExists(location: string): Promise<boolean>;
169
- /**
170
- * Escapes special characters in command line arguments.
171
- * This is needed to avoid possible issues with how system `spawn`
172
- * call handles them.
173
- * See https://discuss.appium.io/t/how-to-modify-wd-proxy-and-uiautomator2-source-code-to-support-unicode/33466
174
- * for more details.
175
- *
176
- * @param {string} arg Non-escaped argument string
177
- * @returns The escaped argument
178
- */
179
- export function escapeShellArg(arg: string): string;
180
- /**
181
- * Parses the name of launchable package activity
182
- * from dumpsys output.
183
- *
184
- * @param {string} dumpsys the actual dumpsys output
185
- * @returns {string[]} Either the fully qualified
186
- * activity name as a single list item or an empty list if nothing could be parsed.
187
- * In Android 6 and older there is no reliable way to determine
188
- * the category name for the given activity, so this API just
189
- * returns all activity names belonging to 'android.intent.action.MAIN'
190
- * with the expectation that the app manifest could be parsed next
191
- * in order to determine category names for these.
192
- */
193
- export function parseLaunchableActivityNames(dumpsys: string): string[];
194
- /**
195
- * Check if the given string is a valid component name
196
- *
197
- * @param {string} classString The string to verify
198
- * @return {RegExpExecArray?} The result of Regexp.exec operation
199
- * or _null_ if no matches are found
200
- */
201
- export function matchComponentName(classString: string): RegExpExecArray | null;
202
29
  /**
203
30
  * Extracts various package manifest details
204
31
  * from the given application file.
@@ -211,7 +38,6 @@ export function readPackageManifest(this: import("./adb.js").ADB, apkPath: strin
211
38
  export const APKS_EXTENSION: ".apks";
212
39
  export const APK_EXTENSION: ".apk";
213
40
  export const APK_INSTALL_TIMEOUT: 60000;
214
- export const APKS_INSTALL_TIMEOUT: number;
215
41
  export const DEFAULT_ADB_EXEC_TIMEOUT: 20000;
216
42
  /**
217
43
  * Calculates the absolsute path to the given resource
@@ -225,22 +51,6 @@ export const getResourcePath: ((relPath: any) => Promise<string>) & _.MemoizedFu
225
51
  export const getJavaHome: () => Promise<string>;
226
52
  /** @type {() => Promise<string>} */
227
53
  export const getJavaForOs: () => Promise<string>;
228
- /** @type {() => Promise<string>} */
229
- export const getOpenSslForOs: () => Promise<string>;
230
- /** @type {() => Promise<{major: number, minor: number, build: number}?>} */
231
- export const getSdkToolsVersion: () => Promise<{
232
- major: number;
233
- minor: number;
234
- build: number;
235
- } | null>;
236
- /**
237
- * Retrieves full paths to all 'build-tools' subfolders under the particular
238
- * SDK root folder
239
- *
240
- * @type {(sdkRoot: string) => Promise<string[]>}
241
- */
242
- export const getBuildToolsDirs: (sdkRoot: string) => Promise<string[]>;
243
- export function extractMatchingPermissions(dumpsysOutput: string, groupNames: string[], grantedState?: boolean | null): string[];
244
54
  export type InstallOptions = {
245
55
  /**
246
56
  * - Set to true in order to allow test
@@ -271,16 +81,5 @@ export type InstallOptions = {
271
81
  */
272
82
  partialInstall?: boolean | undefined;
273
83
  };
274
- export type StartCmdOptions = {
275
- user?: string | number | undefined;
276
- waitForLaunch?: boolean | undefined;
277
- pkg?: string | undefined;
278
- activity?: string | undefined;
279
- action?: string | undefined;
280
- category?: string | undefined;
281
- stopApp?: boolean | undefined;
282
- flags?: string | undefined;
283
- optionalIntentArguments?: string | undefined;
284
- };
285
84
  import _ from 'lodash';
286
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;;;;;;GAMG;AACH,0CAHW,MAAM,GACL,OAAO,CAIlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,6CAHW,MAAM,GACL,OAAO,CAMlB;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,OAAO,CAMnB;AAKD,gEAGC;AAKD,mEA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