appium-android-driver 13.1.2 → 13.2.0

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 (83) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/commands/app-management.d.ts.map +1 -1
  3. package/build/lib/commands/app-management.js +2 -3
  4. package/build/lib/commands/app-management.js.map +1 -1
  5. package/build/lib/commands/bidi/models.d.ts +7 -0
  6. package/build/lib/commands/bidi/models.d.ts.map +1 -1
  7. package/build/lib/commands/bidi/models.js +7 -0
  8. package/build/lib/commands/bidi/models.js.map +1 -1
  9. package/build/lib/commands/bidi/types.d.ts +6 -6
  10. package/build/lib/commands/bidi/types.d.ts.map +1 -1
  11. package/build/lib/commands/bluetooth.d.ts +1 -1
  12. package/build/lib/commands/bluetooth.d.ts.map +1 -1
  13. package/build/lib/commands/bluetooth.js.map +1 -1
  14. package/build/lib/commands/context/exports.d.ts.map +1 -1
  15. package/build/lib/commands/context/exports.js +14 -4
  16. package/build/lib/commands/context/exports.js.map +1 -1
  17. package/build/lib/commands/context/helpers.d.ts.map +1 -1
  18. package/build/lib/commands/context/helpers.js +1 -2
  19. package/build/lib/commands/context/helpers.js.map +1 -1
  20. package/build/lib/commands/device/common.d.ts.map +1 -1
  21. package/build/lib/commands/device/common.js +1 -2
  22. package/build/lib/commands/device/common.js.map +1 -1
  23. package/build/lib/commands/device/utils.d.ts.map +1 -1
  24. package/build/lib/commands/device/utils.js +1 -2
  25. package/build/lib/commands/device/utils.js.map +1 -1
  26. package/build/lib/commands/execute.d.ts +1 -1
  27. package/build/lib/commands/execute.d.ts.map +1 -1
  28. package/build/lib/commands/execute.js +0 -1
  29. package/build/lib/commands/execute.js.map +1 -1
  30. package/build/lib/commands/geolocation.js +3 -3
  31. package/build/lib/commands/geolocation.js.map +1 -1
  32. package/build/lib/commands/lock/exports.js +2 -2
  33. package/build/lib/commands/lock/exports.js.map +1 -1
  34. package/build/lib/commands/media-projection.d.ts.map +1 -1
  35. package/build/lib/commands/media-projection.js +0 -1
  36. package/build/lib/commands/media-projection.js.map +1 -1
  37. package/build/lib/commands/network.d.ts.map +1 -1
  38. package/build/lib/commands/network.js +21 -11
  39. package/build/lib/commands/network.js.map +1 -1
  40. package/build/lib/commands/performance.d.ts.map +1 -1
  41. package/build/lib/commands/performance.js +68 -68
  42. package/build/lib/commands/performance.js.map +1 -1
  43. package/build/lib/commands/permissions.d.ts +4 -4
  44. package/build/lib/commands/permissions.d.ts.map +1 -1
  45. package/build/lib/commands/permissions.js +2 -4
  46. package/build/lib/commands/permissions.js.map +1 -1
  47. package/build/lib/commands/recordscreen.js +1 -1
  48. package/build/lib/commands/recordscreen.js.map +1 -1
  49. package/build/lib/commands/streamscreen.d.ts.map +1 -1
  50. package/build/lib/commands/streamscreen.js +65 -45
  51. package/build/lib/commands/streamscreen.js.map +1 -1
  52. package/build/lib/commands/system-bars.d.ts +4 -4
  53. package/build/lib/commands/system-bars.d.ts.map +1 -1
  54. package/build/lib/commands/system-bars.js +0 -1
  55. package/build/lib/commands/system-bars.js.map +1 -1
  56. package/build/lib/driver.d.ts +7 -7
  57. package/build/lib/driver.d.ts.map +1 -1
  58. package/build/lib/driver.js +69 -69
  59. package/build/lib/driver.js.map +1 -1
  60. package/build/lib/utils.d.ts +6 -6
  61. package/build/lib/utils.d.ts.map +1 -1
  62. package/build/lib/utils.js.map +1 -1
  63. package/lib/commands/app-management.ts +2 -3
  64. package/lib/commands/bidi/models.ts +7 -0
  65. package/lib/commands/bidi/types.ts +10 -10
  66. package/lib/commands/bluetooth.ts +2 -2
  67. package/lib/commands/context/exports.ts +16 -4
  68. package/lib/commands/context/helpers.ts +1 -2
  69. package/lib/commands/device/common.ts +1 -2
  70. package/lib/commands/device/utils.ts +1 -2
  71. package/lib/commands/execute.ts +2 -6
  72. package/lib/commands/geolocation.ts +6 -10
  73. package/lib/commands/lock/exports.ts +2 -2
  74. package/lib/commands/media-projection.ts +10 -14
  75. package/lib/commands/network.ts +28 -22
  76. package/lib/commands/performance.ts +68 -68
  77. package/lib/commands/permissions.ts +12 -15
  78. package/lib/commands/recordscreen.ts +1 -1
  79. package/lib/commands/streamscreen.ts +77 -53
  80. package/lib/commands/system-bars.ts +5 -9
  81. package/lib/driver.ts +91 -91
  82. package/lib/utils.ts +7 -7
  83. package/package.json +1 -3
@@ -5,6 +5,12 @@ export declare const ADB_SHELL_FEATURE = "adb_shell";
5
5
  export declare const ADB_LISTEN_ALL_NETWORK_FEATURE = "adb_listen_all_network";
6
6
  export declare const GET_SERVER_LOGS_FEATURE = "get_server_logs";
7
7
  export declare const SET_STYLUS_HANDWRITING_FEATURE = "set_stylus_handwriting";
8
+ interface LogEntryWithPrefix {
9
+ message: string;
10
+ prefix?: string;
11
+ timestamp?: number;
12
+ level?: string;
13
+ }
8
14
  /**
9
15
  * Assert the presence of particular keys in the given object
10
16
  *
@@ -24,12 +30,6 @@ export declare function parseArray(cap: string | string[]): string[];
24
30
  * @returns
25
31
  */
26
32
  export declare function removeAllSessionWebSocketHandlers(this: AndroidDriver): Promise<void>;
27
- interface LogEntryWithPrefix {
28
- message: string;
29
- prefix?: string;
30
- timestamp?: number;
31
- level?: string;
32
- }
33
33
  /**
34
34
  *
35
35
  * @param x
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAE5C,YAAY,EAAC,QAAQ,EAAC,CAAC;AAEvB,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,8BAA8B,2BAA2B,CAAC;AACvE,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AACzD,eAAO,MAAM,8BAA8B,2BAA2B,CAAC;AAGvE;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,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,WAAW,CAAC,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,gBAAC,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,SAAiB,EAAE,OAAe,EAAE,QAAgB,KAAK;IACnF,OAAO;QACL,SAAS;QACT,KAAK,EAAE,KAAY;QACnB,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -2,7 +2,6 @@ import {util} from '@appium/support';
2
2
  import {waitForCondition, longSleep} from 'asyncbox';
3
3
  import _ from 'lodash';
4
4
  import {EOL} from 'node:os';
5
- import B from 'bluebird';
6
5
  import type {AndroidDriver, AndroidDriverOpts} from '../driver';
7
6
  import type {AppInfoMap, AppState, IsAppInstalledOptions, TerminateAppOpts} from './types';
8
7
  import type {
@@ -599,7 +598,7 @@ export async function installOtherApks(
599
598
  } = opts ?? this.opts;
600
599
 
601
600
  // Install all of the APK's asynchronously
602
- await B.all(
601
+ await Promise.all(
603
602
  otherApps.map((otherApp) => {
604
603
  this.log.debug(`Installing app: ${otherApp}`);
605
604
  return this.adb.installOrUpgrade(otherApp, undefined, {
@@ -632,7 +631,7 @@ export async function uninstallOtherPackages(
632
631
  }
633
632
 
634
633
  this.log.debug(`Uninstalling packages: ${appPackages}`);
635
- await B.all(appPackages.map((appPackage) => this.adb.uninstallApk(appPackage)));
634
+ await Promise.all(appPackages.map((appPackage) => this.adb.uninstallApk(appPackage)));
636
635
  }
637
636
 
638
637
  /**
@@ -27,6 +27,13 @@ export const makeContextUpdatedEvent = (contextName: string, domain: string) =>
27
27
  export const makeObsoleteContextUpdatedEvent = (contextName: string) =>
28
28
  toContextUpdatedEvent(CONTEXT_UPDATED_EVENT_OBSOLETE, contextName);
29
29
 
30
+ /**
31
+ * Builds a BiDi `log.entryAdded` event from a logcat entry.
32
+ *
33
+ * @param entry - Raw log line from the device
34
+ * @param context - Active session context name
35
+ * @param type - Log entry classification passed through to the event
36
+ */
30
37
  export function makeLogEntryAddedEvent(
31
38
  entry: LogEntry,
32
39
  context: string,
@@ -1,3 +1,13 @@
1
+ export type BiDiLogLevel = 'debug' | 'info' | 'warn' | 'error';
2
+
3
+ // https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
4
+ export interface LogEntryAddedEvent extends BiDiEvent<LogEntryAddedEventParams> {
5
+ context: string;
6
+ }
7
+
8
+ // https://github.com/appium/appium/issues/20741
9
+ export interface ContextUpdatedEvent extends BiDiEvent<ContentUpdatedParams> {}
10
+
1
11
  interface BiDiEvent<TParams> {
2
12
  method: string;
3
13
  params: TParams;
@@ -8,8 +18,6 @@ interface LogEntrySource {
8
18
  context?: string;
9
19
  }
10
20
 
11
- export type BiDiLogLevel = 'debug' | 'info' | 'warn' | 'error';
12
-
13
21
  interface LogEntryAddedEventParams {
14
22
  type: string;
15
23
  level: BiDiLogLevel;
@@ -18,15 +26,7 @@ interface LogEntryAddedEventParams {
18
26
  timestamp: number;
19
27
  }
20
28
 
21
- // https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
22
- export interface LogEntryAddedEvent extends BiDiEvent<LogEntryAddedEventParams> {
23
- context: string;
24
- }
25
-
26
29
  interface ContentUpdatedParams {
27
30
  name: string;
28
31
  type: 'NATIVE' | 'WEB';
29
32
  }
30
-
31
- // https://github.com/appium/appium/issues/20741
32
- export interface ContextUpdatedEvent extends BiDiEvent<ContentUpdatedParams> {}
@@ -8,6 +8,8 @@ const SUPPORTED_ACTIONS = {
8
8
  UNPAIR_ALL: 'unpairAll',
9
9
  } as const;
10
10
 
11
+ type BluetoothAction = (typeof SUPPORTED_ACTIONS)[keyof typeof SUPPORTED_ACTIONS];
12
+
11
13
  /**
12
14
  * Performs the requested action on the default bluetooth adapter
13
15
  *
@@ -34,5 +36,3 @@ export async function mobileBluetooth(this: AndroidDriver, action: BluetoothActi
34
36
  );
35
37
  }
36
38
  }
37
-
38
- type BluetoothAction = (typeof SUPPORTED_ACTIONS)[keyof typeof SUPPORTED_ACTIONS];
@@ -305,9 +305,15 @@ export async function startChromedriverProxy(
305
305
  cd = await setupNewChromedriver.bind(this)(opts, this.adb.curDeviceId as string, context);
306
306
  // bind our stop/exit handler, passing in context so we know which
307
307
  // one stopped unexpectedly
308
- cd.on(Chromedriver.EVENT_CHANGED, (msg) => {
308
+ cd.on(Chromedriver.EVENT_CHANGED, async (msg) => {
309
309
  if (msg.state === Chromedriver.STATE_STOPPED) {
310
- this.onChromedriverStop(context);
310
+ try {
311
+ await this.onChromedriverStop(context);
312
+ } catch (err) {
313
+ this.log.warn(
314
+ `Error handling chromedriver stop event for context ${context}: ${(err as Error).message}`,
315
+ );
316
+ }
311
317
  }
312
318
  });
313
319
  // save the chromedriver object under the context
@@ -446,9 +452,15 @@ export async function startChromeSession(this: AndroidDriver): Promise<void> {
446
452
  }
447
453
  const chromedriver = await setupNewChromedriver.bind(this)(opts, this.adb.curDeviceId as string);
448
454
  this.chromedriver = chromedriver;
449
- chromedriver.on(Chromedriver.EVENT_CHANGED, (msg) => {
455
+ chromedriver.on(Chromedriver.EVENT_CHANGED, async (msg) => {
450
456
  if (msg.state === Chromedriver.STATE_STOPPED) {
451
- this.onChromedriverStop(CHROMIUM_WIN);
457
+ try {
458
+ await this.onChromedriverStop(CHROMIUM_WIN);
459
+ } catch (err) {
460
+ this.log.warn(
461
+ `Error handling chromedriver stop event for context ${CHROMIUM_WIN}: ${(err as Error).message}`,
462
+ );
463
+ }
452
464
  }
453
465
  });
454
466
 
@@ -4,7 +4,6 @@ import axios from 'axios';
4
4
  import net from 'node:net';
5
5
  import {findAPortNotInUse} from 'portscanner';
6
6
  import {sleep} from 'asyncbox';
7
- import B from 'bluebird';
8
7
  import os from 'node:os';
9
8
  import path from 'node:path';
10
9
  import http from 'node:http';
@@ -668,7 +667,7 @@ async function collectWebviewsDetails(
668
667
  })(),
669
668
  );
670
669
  }
671
- await B.all(detailCollectors);
670
+ await Promise.all(detailCollectors);
672
671
  this.log.debug(`CDP data collection completed`);
673
672
  }
674
673
 
@@ -1,6 +1,5 @@
1
1
  import * as semver from 'semver';
2
2
  import _ from 'lodash';
3
- import B from 'bluebird';
4
3
  import path from 'node:path';
5
4
  import {setMockLocationApp} from '../geolocation';
6
5
  import {SETTINGS_HELPER_ID} from 'io.appium.settings';
@@ -304,5 +303,5 @@ export async function initDevice(this: AndroidDriver): Promise<void> {
304
303
  });
305
304
  }
306
305
 
307
- await B.all(setupPromises);
306
+ await Promise.all(setupPromises);
308
307
  }
@@ -8,7 +8,6 @@ import {
8
8
  UNICODE_IME,
9
9
  EMPTY_IME,
10
10
  } from 'io.appium.settings';
11
- import B from 'bluebird';
12
11
  import {prepareEmulatorForImageInjection} from '../image-injection';
13
12
  import {ADB_LISTEN_ALL_NETWORK_FEATURE} from '../../utils';
14
13
  import type {AndroidDriver} from '../../driver';
@@ -212,7 +211,7 @@ export async function pushSettingsApp(this: AndroidDriver, throwIfError: boolean
212
211
  }
213
212
 
214
213
  try {
215
- await B.all([
214
+ await Promise.all([
216
215
  this.settingsApp.adjustNotificationsPermissions(),
217
216
  this.settingsApp.adjustMediaProjectionServicePermissions(),
218
217
  ]);
@@ -7,6 +7,8 @@ import type {Chromedriver} from 'appium-chromedriver';
7
7
 
8
8
  const EXECUTE_SCRIPT_PREFIX = 'mobile:';
9
9
 
10
+ type ExecuteMethodArgs = readonly any[] | readonly [StringRecord] | Readonly<StringRecord>;
11
+
10
12
  /**
11
13
  * Executes a script on the device or in a web context.
12
14
  *
@@ -39,8 +41,6 @@ export async function execute(
39
41
  });
40
42
  }
41
43
 
42
- // #region Internal Helpers
43
-
44
44
  /**
45
45
  * Massages the arguments going into an execute method.
46
46
  *
@@ -70,7 +70,3 @@ function preprocessExecuteMethodArgs(args?: ExecuteMethodArgs): StringRecord {
70
70
 
71
71
  return executeMethodArgs;
72
72
  }
73
-
74
- // #endregion
75
-
76
- type ExecuteMethodArgs = readonly any[] | readonly [StringRecord] | Readonly<StringRecord>;
@@ -1,7 +1,7 @@
1
1
  import _ from 'lodash';
2
+ import {asyncmap} from 'asyncbox';
2
3
  import {fs, tempDir} from '@appium/support';
3
4
  import path from 'node:path';
4
- import B from 'bluebird';
5
5
  import type {Location} from '@appium/types';
6
6
  import {SETTINGS_HELPER_ID} from 'io.appium.settings';
7
7
  import {getThirdPartyPackages} from './app-management';
@@ -223,15 +223,11 @@ async function resetMockLocation(this: AndroidDriver): Promise<void> {
223
223
  }
224
224
 
225
225
  this.log.debug(`Resetting mock_location permission for the following apps: ${resultPkgs}`);
226
- await B.all(
227
- resultPkgs.map((pkgId) =>
228
- (async () => {
229
- try {
230
- await this.adb.shell(['appops', 'set', pkgId, 'android:mock_location', 'deny']);
231
- } catch {}
232
- })(),
233
- ),
234
- );
226
+ await asyncmap(resultPkgs, async (pkgId) => {
227
+ try {
228
+ await this.adb.shell(['appops', 'set', pkgId, 'android:mock_location', 'deny']);
229
+ } catch {}
230
+ });
235
231
  } catch (err) {
236
232
  this.log.warn(`Unable to reset mock location: ${(err as Error).message}`);
237
233
  }
@@ -1,4 +1,4 @@
1
- import B from 'bluebird';
1
+ import {sleep} from 'asyncbox';
2
2
  import {
3
3
  validateUnlockCapabilities,
4
4
  FINGERPRINT_UNLOCK,
@@ -34,7 +34,7 @@ export async function lock(this: AndroidDriver, seconds?: number): Promise<void>
34
34
  if (floatSeconds <= 0) {
35
35
  return;
36
36
  }
37
- await B.delay(1000 * floatSeconds);
37
+ await sleep(1000 * floatSeconds);
38
38
  await this.unlock();
39
39
  }
40
40
 
@@ -13,6 +13,16 @@ const DEFAULT_EXT = '.mp4';
13
13
  const MIN_API_LEVEL = 29;
14
14
  const DEFAULT_FILENAME_FORMAT = 'YYYY-MM-DDTHH-mm-ss';
15
15
 
16
+ interface UploadOptions {
17
+ user?: string;
18
+ pass?: string;
19
+ method?: HTTPMethod;
20
+ headers?: StringRecord;
21
+ fileFieldName?: string;
22
+ formFields?: FormFields;
23
+ uploadTimeout?: number;
24
+ }
25
+
16
26
  /**
17
27
  * Starts media projection-based screen recording on the Android device.
18
28
  *
@@ -139,8 +149,6 @@ export async function mobileStopMediaProjectionRecording(
139
149
  }
140
150
  }
141
151
 
142
- // #region Internal helpers
143
-
144
152
  async function uploadRecordedMedia(
145
153
  localFile: string,
146
154
  remotePath?: string,
@@ -186,15 +194,3 @@ async function verifyMediaProjectionRecordingIsSupported(adb: ADB): Promise<void
186
194
  );
187
195
  }
188
196
  }
189
-
190
- // #endregion
191
-
192
- interface UploadOptions {
193
- user?: string;
194
- pass?: string;
195
- method?: HTTPMethod;
196
- headers?: StringRecord;
197
- fileFieldName?: string;
198
- formFields?: FormFields;
199
- uploadTimeout?: number;
200
- }
@@ -1,7 +1,6 @@
1
1
  import _ from 'lodash';
2
2
  import {errors} from 'appium/driver';
3
3
  import {util} from '@appium/support';
4
- import B from 'bluebird';
5
4
  import type {AndroidDriver} from '../driver';
6
5
  import type {ServiceType, GetConnectivityResult} from './types';
7
6
 
@@ -87,7 +86,7 @@ export async function mobileSetConnectivity(
87
86
  return acc;
88
87
  }, []);
89
88
  const currentState = await this.mobileGetConnectivity(services);
90
- const setters: Array<Promise<any> | (() => Promise<any>)> = [];
89
+ const setters: Promise<any>[] = [];
91
90
  if (!_.isUndefined(wifi) && currentState.wifi !== Boolean(wifi)) {
92
91
  setters.push(this.setWifiState(wifi));
93
92
  }
@@ -95,15 +94,17 @@ export async function mobileSetConnectivity(
95
94
  setters.push(this.setDataState(data));
96
95
  }
97
96
  if (!_.isUndefined(airplaneMode) && currentState.airplaneMode !== Boolean(airplaneMode)) {
98
- setters.push(async () => {
99
- await this.adb.setAirplaneMode(airplaneMode);
100
- if ((await this.adb.getApiLevel()) < 30) {
101
- await this.adb.broadcastAirplaneMode(airplaneMode);
102
- }
103
- });
97
+ setters.push(
98
+ (async () => {
99
+ await this.adb.setAirplaneMode(airplaneMode);
100
+ if ((await this.adb.getApiLevel()) < 30) {
101
+ await this.adb.broadcastAirplaneMode(airplaneMode);
102
+ }
103
+ })(),
104
+ );
104
105
  }
105
106
  if (!_.isEmpty(setters)) {
106
- await B.all(setters);
107
+ await Promise.all(setters);
107
108
  }
108
109
  }
109
110
 
@@ -134,19 +135,24 @@ export async function mobileGetConnectivity(
134
135
  );
135
136
  }
136
137
 
137
- const statePromises = {
138
- wifi: B.resolve(svcs.includes(WIFI_KEY_NAME) ? this.adb.isWifiOn() : undefined),
139
- data: B.resolve(svcs.includes(DATA_KEY_NAME) ? this.adb.isDataOn() : undefined),
140
- airplaneMode: B.resolve(
141
- svcs.includes(AIRPLANE_MODE_KEY_NAME) ? this.adb.isAirplaneModeOn() : undefined,
142
- ),
143
- };
144
- await B.all(_.values(statePromises));
145
- return _.reduce(
146
- statePromises,
147
- (state, v, k) => (_.isUndefined(v.value()) ? state : {...state, [k]: Boolean(v.value())}),
148
- {} as GetConnectivityResult,
149
- );
138
+ const [wifi, data, airplaneMode] = await Promise.all([
139
+ svcs.includes(WIFI_KEY_NAME) ? this.adb.isWifiOn() : Promise.resolve(undefined),
140
+ svcs.includes(DATA_KEY_NAME) ? this.adb.isDataOn() : Promise.resolve(undefined),
141
+ svcs.includes(AIRPLANE_MODE_KEY_NAME)
142
+ ? this.adb.isAirplaneModeOn()
143
+ : Promise.resolve(undefined),
144
+ ]);
145
+ const result: GetConnectivityResult = {};
146
+ if (!_.isUndefined(wifi)) {
147
+ result.wifi = Boolean(wifi);
148
+ }
149
+ if (!_.isUndefined(data)) {
150
+ result.data = Boolean(data);
151
+ }
152
+ if (!_.isUndefined(airplaneMode)) {
153
+ result.airplaneMode = Boolean(airplaneMode);
154
+ }
155
+ return result;
150
156
  }
151
157
 
152
158
  /**
@@ -139,74 +139,6 @@ export async function mobileGetPerformanceData(
139
139
 
140
140
  // #region Internal helpers
141
141
 
142
- /**
143
- * API level between 18 and 30
144
- * ['<System Type>', '<Memory Type>', <pss total>, <private dirty>, <private clean>, <swapPss dirty>, <heap size>, <heap alloc>, <heap free>]
145
- * except 'TOTAL', which skips the second type name
146
- * !!! valDict gets mutated
147
- */
148
- function parseMeminfoForApi19To29(
149
- entries: string[],
150
- valDict: Record<string, string | number>,
151
- ): void {
152
- const [type, subType] = entries;
153
- if (type === MEMINFO_TITLES.NATIVE && subType === MEMINFO_TITLES.HEAP) {
154
- [
155
- ,
156
- ,
157
- valDict.nativePss,
158
- valDict.nativePrivateDirty,
159
- ,
160
- ,
161
- valDict.nativeHeapSize,
162
- valDict.nativeHeapAllocatedSize,
163
- ] = entries;
164
- } else if (type === MEMINFO_TITLES.DALVIK && subType === MEMINFO_TITLES.HEAP) {
165
- [, , valDict.dalvikPss, valDict.dalvikPrivateDirty] = entries;
166
- } else if (type === MEMINFO_TITLES.EGL && subType === MEMINFO_TITLES.MTRACK) {
167
- [, , valDict.eglPss, valDict.eglPrivateDirty] = entries;
168
- } else if (type === MEMINFO_TITLES.GL && subType === MEMINFO_TITLES.MTRACK) {
169
- [, , valDict.glPss, valDict.glPrivateDirty] = entries;
170
- } else if (type === MEMINFO_TITLES.TOTAL && entries.length === 8) {
171
- // there are two totals, and we only want the full listing, which has 8 entries
172
- [, valDict.totalPss, valDict.totalPrivateDirty] = entries;
173
- }
174
- }
175
-
176
- /**
177
- * API level 30 and above
178
- * ['<System Type>', '<Memory Type>', <pss total>, <private dirty>, <private clean>, <swapPss dirty>, <rss total>, <heap size>, <heap alloc>, <heap free>]
179
- * !!! valDict gets mutated
180
- */
181
- function parseMeminfoForApiAbove29(
182
- entries: string[],
183
- valDict: Record<string, string | number>,
184
- ): void {
185
- const [type, subType] = entries;
186
- if (type === MEMINFO_TITLES.NATIVE && subType === MEMINFO_TITLES.HEAP) {
187
- [
188
- ,
189
- ,
190
- valDict.nativePss,
191
- valDict.nativePrivateDirty,
192
- ,
193
- ,
194
- valDict.nativeRss,
195
- valDict.nativeHeapSize,
196
- valDict.nativeHeapAllocatedSize,
197
- ] = entries;
198
- } else if (type === MEMINFO_TITLES.DALVIK && subType === MEMINFO_TITLES.HEAP) {
199
- [, , valDict.dalvikPss, valDict.dalvikPrivateDirty, , , valDict.dalvikRss] = entries;
200
- } else if (type === MEMINFO_TITLES.EGL && subType === MEMINFO_TITLES.MTRACK) {
201
- [, , valDict.eglPss, valDict.eglPrivateDirty] = entries;
202
- } else if (type === MEMINFO_TITLES.GL && subType === MEMINFO_TITLES.MTRACK) {
203
- [, , valDict.glPss, valDict.glPrivateDirty] = entries;
204
- } else if (type === MEMINFO_TITLES.TOTAL && entries.length === 9) {
205
- // has 9 entries
206
- [, valDict.totalPss, valDict.totalPrivateDirty, , , valDict.totalRss] = entries;
207
- }
208
- }
209
-
210
142
  /**
211
143
  * Retrieves memory information for the specified application package.
212
144
  *
@@ -539,4 +471,72 @@ export async function getBatteryInfo(this: AndroidDriver, retries: number = 2):
539
471
  })) as any[][];
540
472
  }
541
473
 
474
+ /**
475
+ * API level between 18 and 30
476
+ * ['<System Type>', '<Memory Type>', <pss total>, <private dirty>, <private clean>, <swapPss dirty>, <heap size>, <heap alloc>, <heap free>]
477
+ * except 'TOTAL', which skips the second type name
478
+ * !!! valDict gets mutated
479
+ */
480
+ function parseMeminfoForApi19To29(
481
+ entries: string[],
482
+ valDict: Record<string, string | number>,
483
+ ): void {
484
+ const [type, subType] = entries;
485
+ if (type === MEMINFO_TITLES.NATIVE && subType === MEMINFO_TITLES.HEAP) {
486
+ [
487
+ ,
488
+ ,
489
+ valDict.nativePss,
490
+ valDict.nativePrivateDirty,
491
+ ,
492
+ ,
493
+ valDict.nativeHeapSize,
494
+ valDict.nativeHeapAllocatedSize,
495
+ ] = entries;
496
+ } else if (type === MEMINFO_TITLES.DALVIK && subType === MEMINFO_TITLES.HEAP) {
497
+ [, , valDict.dalvikPss, valDict.dalvikPrivateDirty] = entries;
498
+ } else if (type === MEMINFO_TITLES.EGL && subType === MEMINFO_TITLES.MTRACK) {
499
+ [, , valDict.eglPss, valDict.eglPrivateDirty] = entries;
500
+ } else if (type === MEMINFO_TITLES.GL && subType === MEMINFO_TITLES.MTRACK) {
501
+ [, , valDict.glPss, valDict.glPrivateDirty] = entries;
502
+ } else if (type === MEMINFO_TITLES.TOTAL && entries.length === 8) {
503
+ // there are two totals, and we only want the full listing, which has 8 entries
504
+ [, valDict.totalPss, valDict.totalPrivateDirty] = entries;
505
+ }
506
+ }
507
+
508
+ /**
509
+ * API level 30 and above
510
+ * ['<System Type>', '<Memory Type>', <pss total>, <private dirty>, <private clean>, <swapPss dirty>, <rss total>, <heap size>, <heap alloc>, <heap free>]
511
+ * !!! valDict gets mutated
512
+ */
513
+ function parseMeminfoForApiAbove29(
514
+ entries: string[],
515
+ valDict: Record<string, string | number>,
516
+ ): void {
517
+ const [type, subType] = entries;
518
+ if (type === MEMINFO_TITLES.NATIVE && subType === MEMINFO_TITLES.HEAP) {
519
+ [
520
+ ,
521
+ ,
522
+ valDict.nativePss,
523
+ valDict.nativePrivateDirty,
524
+ ,
525
+ ,
526
+ valDict.nativeRss,
527
+ valDict.nativeHeapSize,
528
+ valDict.nativeHeapAllocatedSize,
529
+ ] = entries;
530
+ } else if (type === MEMINFO_TITLES.DALVIK && subType === MEMINFO_TITLES.HEAP) {
531
+ [, , valDict.dalvikPss, valDict.dalvikPrivateDirty, , , valDict.dalvikRss] = entries;
532
+ } else if (type === MEMINFO_TITLES.EGL && subType === MEMINFO_TITLES.MTRACK) {
533
+ [, , valDict.eglPss, valDict.eglPrivateDirty] = entries;
534
+ } else if (type === MEMINFO_TITLES.GL && subType === MEMINFO_TITLES.MTRACK) {
535
+ [, , valDict.glPss, valDict.glPrivateDirty] = entries;
536
+ } else if (type === MEMINFO_TITLES.TOTAL && entries.length === 9) {
537
+ // has 9 entries
538
+ [, valDict.totalPss, valDict.totalPrivateDirty, , , valDict.totalRss] = entries;
539
+ }
540
+ }
541
+
542
542
  // #endregion
@@ -1,5 +1,4 @@
1
1
  import {errors} from 'appium/driver';
2
- import B from 'bluebird';
3
2
  import _ from 'lodash';
4
3
  import {ADB_SHELL_FEATURE} from '../utils';
5
4
  import type {AndroidDriver} from '../driver';
@@ -25,6 +24,14 @@ const PERMISSIONS_TYPE = Object.freeze({
25
24
  REQUESTED: 'requested',
26
25
  } as const);
27
26
 
27
+ type PMAction = (typeof PM_ACTION)[keyof typeof PM_ACTION];
28
+
29
+ type AppOpsAction = (typeof APPOPS_ACTION)[keyof typeof APPOPS_ACTION];
30
+
31
+ type PermissionTarget = (typeof PERMISSION_TARGET)[keyof typeof PERMISSION_TARGET];
32
+
33
+ type PermissionsType = (typeof PERMISSIONS_TYPE)[keyof typeof PERMISSIONS_TYPE];
34
+
28
35
  /**
29
36
  * Changes permissions for an Android application.
30
37
  *
@@ -85,7 +92,6 @@ export async function mobileChangePermissions(
85
92
  );
86
93
  }
87
94
  }
88
-
89
95
  /**
90
96
  * Gets permissions for an Android application.
91
97
  *
@@ -120,9 +126,6 @@ export async function mobileGetPermissions(
120
126
  }
121
127
  return await actionFunc(appPackage as string);
122
128
  }
123
-
124
- // #region Internal helpers
125
-
126
129
  async function changePermissionsViaPm(
127
130
  this: AndroidDriver,
128
131
  permissions: string | string[],
@@ -155,10 +158,11 @@ async function changePermissionsViaPm(
155
158
  if (action === PM_ACTION.GRANT) {
156
159
  await this.adb.grantPermissions(appPackage, affectedPermissions);
157
160
  } else {
158
- await B.all(affectedPermissions.map((name) => this.adb.revokePermission(appPackage, name)));
161
+ await Promise.all(
162
+ affectedPermissions.map((name) => this.adb.revokePermission(appPackage, name)),
163
+ );
159
164
  }
160
165
  }
161
-
162
166
  async function changePermissionsViaAppops(
163
167
  this: AndroidDriver,
164
168
  permissions: string | string[],
@@ -182,12 +186,5 @@ async function changePermissionsViaAppops(
182
186
  const promises = (_.isArray(permissions) ? permissions : [permissions]).map((permission) =>
183
187
  this.adb.shell(['appops', 'set', appPackage, permission, action]),
184
188
  );
185
- await B.all(promises);
189
+ await Promise.all(promises);
186
190
  }
187
-
188
- // #endregion
189
-
190
- type PMAction = (typeof PM_ACTION)[keyof typeof PM_ACTION];
191
- type AppOpsAction = (typeof APPOPS_ACTION)[keyof typeof APPOPS_ACTION];
192
- type PermissionTarget = (typeof PERMISSION_TARGET)[keyof typeof PERMISSION_TARGET];
193
- type PermissionsType = (typeof PERMISSIONS_TYPE)[keyof typeof PERMISSIONS_TYPE];
@@ -269,7 +269,7 @@ async function scheduleScreenRecord(
269
269
  `Starting the next ${chunkDuration}s-chunk ` +
270
270
  `of screen recording in order to achieve ${timeLimitInt}s total duration`,
271
271
  );
272
- (async () => {
272
+ void (async () => {
273
273
  try {
274
274
  await scheduleScreenRecord.bind(this)(recordingProperties);
275
275
  } catch (e) {