appium-android-driver 7.8.2 → 8.0.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 (261) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/lib/commands/app-management.d.ts +129 -5
  3. package/build/lib/commands/app-management.d.ts.map +1 -1
  4. package/build/lib/commands/app-management.js +433 -128
  5. package/build/lib/commands/app-management.js.map +1 -1
  6. package/build/lib/commands/appearance.d.ts +17 -4
  7. package/build/lib/commands/appearance.d.ts.map +1 -1
  8. package/build/lib/commands/appearance.js +32 -33
  9. package/build/lib/commands/appearance.js.map +1 -1
  10. package/build/lib/commands/context/cache.d.ts +19 -0
  11. package/build/lib/commands/context/cache.d.ts.map +1 -0
  12. package/build/lib/commands/context/cache.js +32 -0
  13. package/build/lib/commands/context/cache.js.map +1 -0
  14. package/build/lib/commands/context/exports.d.ts +141 -0
  15. package/build/lib/commands/context/exports.d.ts.map +1 -0
  16. package/build/lib/commands/context/exports.js +351 -0
  17. package/build/lib/commands/context/exports.js.map +1 -0
  18. package/build/lib/commands/context/helpers.d.ts +98 -0
  19. package/build/lib/commands/context/helpers.d.ts.map +1 -0
  20. package/build/lib/commands/context/helpers.js +715 -0
  21. package/build/lib/commands/context/helpers.js.map +1 -0
  22. package/build/lib/commands/device/common.d.ts +23 -0
  23. package/build/lib/commands/device/common.d.ts.map +1 -0
  24. package/build/lib/commands/device/common.js +230 -0
  25. package/build/lib/commands/device/common.js.map +1 -0
  26. package/build/lib/commands/device/emulator-actions.d.ts +114 -0
  27. package/build/lib/commands/device/emulator-actions.d.ts.map +1 -0
  28. package/build/lib/commands/device/emulator-actions.js +197 -0
  29. package/build/lib/commands/device/emulator-actions.js.map +1 -0
  30. package/build/lib/commands/device/emulator-console.d.ts +7 -0
  31. package/build/lib/commands/device/emulator-console.d.ts.map +1 -0
  32. package/build/lib/commands/device/emulator-console.js +24 -0
  33. package/build/lib/commands/device/emulator-console.js.map +1 -0
  34. package/build/lib/commands/device/utils.d.ts +50 -0
  35. package/build/lib/commands/device/utils.d.ts.map +1 -0
  36. package/build/lib/commands/device/utils.js +238 -0
  37. package/build/lib/commands/device/utils.js.map +1 -0
  38. package/build/lib/commands/deviceidle.d.ts +8 -5
  39. package/build/lib/commands/deviceidle.d.ts.map +1 -1
  40. package/build/lib/commands/deviceidle.js +31 -37
  41. package/build/lib/commands/deviceidle.js.map +1 -1
  42. package/build/lib/commands/element.d.ts +99 -5
  43. package/build/lib/commands/element.d.ts.map +1 -1
  44. package/build/lib/commands/element.js +152 -116
  45. package/build/lib/commands/element.js.map +1 -1
  46. package/build/lib/commands/execute.d.ts +12 -4
  47. package/build/lib/commands/execute.d.ts.map +1 -1
  48. package/build/lib/commands/execute.js +83 -78
  49. package/build/lib/commands/execute.js.map +1 -1
  50. package/build/lib/commands/file-actions.d.ts +42 -5
  51. package/build/lib/commands/file-actions.d.ts.map +1 -1
  52. package/build/lib/commands/file-actions.js +230 -194
  53. package/build/lib/commands/file-actions.js.map +1 -1
  54. package/build/lib/commands/find.d.ts +5 -4
  55. package/build/lib/commands/find.d.ts.map +1 -1
  56. package/build/lib/commands/find.js +7 -10
  57. package/build/lib/commands/find.js.map +1 -1
  58. package/build/lib/commands/geolocation.d.ts +45 -0
  59. package/build/lib/commands/geolocation.d.ts.map +1 -0
  60. package/build/lib/commands/geolocation.js +182 -0
  61. package/build/lib/commands/geolocation.js.map +1 -0
  62. package/build/lib/commands/ime.d.ts +25 -5
  63. package/build/lib/commands/ime.d.ts.map +1 -1
  64. package/build/lib/commands/ime.js +59 -42
  65. package/build/lib/commands/ime.js.map +1 -1
  66. package/build/lib/commands/intent.d.ts +56 -5
  67. package/build/lib/commands/intent.d.ts.map +1 -1
  68. package/build/lib/commands/intent.js +135 -83
  69. package/build/lib/commands/intent.js.map +1 -1
  70. package/build/lib/commands/keyboard.d.ts +58 -4
  71. package/build/lib/commands/keyboard.d.ts.map +1 -1
  72. package/build/lib/commands/keyboard.js +119 -17
  73. package/build/lib/commands/keyboard.js.map +1 -1
  74. package/build/lib/commands/lock/exports.d.ts +301 -0
  75. package/build/lib/commands/lock/exports.d.ts.map +1 -0
  76. package/build/lib/commands/lock/exports.js +121 -0
  77. package/build/lib/commands/lock/exports.js.map +1 -0
  78. package/build/lib/commands/lock/helpers.d.ts +349 -0
  79. package/build/lib/commands/lock/helpers.d.ts.map +1 -0
  80. package/build/lib/commands/lock/helpers.js +375 -0
  81. package/build/lib/commands/lock/helpers.js.map +1 -0
  82. package/build/lib/commands/log.d.ts +59 -5
  83. package/build/lib/commands/log.d.ts.map +1 -1
  84. package/build/lib/commands/log.js +150 -140
  85. package/build/lib/commands/log.js.map +1 -1
  86. package/build/lib/commands/media-projection.d.ts +16 -5
  87. package/build/lib/commands/media-projection.d.ts.map +1 -1
  88. package/build/lib/commands/media-projection.js +69 -58
  89. package/build/lib/commands/media-projection.js.map +1 -1
  90. package/build/lib/commands/memory.d.ts +9 -5
  91. package/build/lib/commands/memory.d.ts.map +1 -1
  92. package/build/lib/commands/memory.js +19 -24
  93. package/build/lib/commands/memory.js.map +1 -1
  94. package/build/lib/commands/misc.d.ts +42 -0
  95. package/build/lib/commands/misc.d.ts.map +1 -0
  96. package/build/lib/commands/misc.js +100 -0
  97. package/build/lib/commands/misc.js.map +1 -0
  98. package/build/lib/commands/network.d.ts +61 -5
  99. package/build/lib/commands/network.d.ts.map +1 -1
  100. package/build/lib/commands/network.js +196 -189
  101. package/build/lib/commands/network.js.map +1 -1
  102. package/build/lib/commands/performance.d.ts +67 -27
  103. package/build/lib/commands/performance.d.ts.map +1 -1
  104. package/build/lib/commands/performance.js +105 -80
  105. package/build/lib/commands/performance.js.map +1 -1
  106. package/build/lib/commands/permissions.d.ts +12 -6
  107. package/build/lib/commands/permissions.d.ts.map +1 -1
  108. package/build/lib/commands/permissions.js +65 -62
  109. package/build/lib/commands/permissions.js.map +1 -1
  110. package/build/lib/commands/recordscreen.d.ts +44 -5
  111. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  112. package/build/lib/commands/recordscreen.js +131 -126
  113. package/build/lib/commands/recordscreen.js.map +1 -1
  114. package/build/lib/commands/resources.d.ts +16 -0
  115. package/build/lib/commands/resources.d.ts.map +1 -0
  116. package/build/lib/commands/resources.js +91 -0
  117. package/build/lib/commands/resources.js.map +1 -0
  118. package/build/lib/commands/shell.d.ts +8 -5
  119. package/build/lib/commands/shell.d.ts.map +1 -1
  120. package/build/lib/commands/shell.js +29 -33
  121. package/build/lib/commands/shell.js.map +1 -1
  122. package/build/lib/commands/streamscreen.d.ts +34 -6
  123. package/build/lib/commands/streamscreen.d.ts.map +1 -1
  124. package/build/lib/commands/streamscreen.js +166 -162
  125. package/build/lib/commands/streamscreen.js.map +1 -1
  126. package/build/lib/commands/system-bars.d.ts +18 -13
  127. package/build/lib/commands/system-bars.d.ts.map +1 -1
  128. package/build/lib/commands/system-bars.js +68 -64
  129. package/build/lib/commands/system-bars.js.map +1 -1
  130. package/build/lib/commands/time.d.ts +14 -0
  131. package/build/lib/commands/time.d.ts.map +1 -0
  132. package/build/lib/commands/time.js +39 -0
  133. package/build/lib/commands/time.js.map +1 -0
  134. package/build/lib/commands/touch.d.ts +99 -6
  135. package/build/lib/commands/touch.d.ts.map +1 -1
  136. package/build/lib/commands/touch.js +399 -280
  137. package/build/lib/commands/touch.js.map +1 -1
  138. package/build/lib/commands/types.d.ts +115 -3
  139. package/build/lib/commands/types.d.ts.map +1 -1
  140. package/build/lib/doctor/checks.d.ts.map +1 -1
  141. package/build/lib/doctor/checks.js +4 -4
  142. package/build/lib/doctor/checks.js.map +1 -1
  143. package/build/lib/driver.d.ts +224 -27
  144. package/build/lib/driver.d.ts.map +1 -1
  145. package/build/lib/driver.js +232 -7
  146. package/build/lib/driver.js.map +1 -1
  147. package/build/lib/index.d.ts +1 -4
  148. package/build/lib/index.d.ts.map +1 -1
  149. package/build/lib/index.js +1 -13
  150. package/build/lib/index.js.map +1 -1
  151. package/build/lib/logger.js.map +1 -1
  152. package/build/lib/method-map.d.ts +0 -23
  153. package/build/lib/method-map.d.ts.map +1 -1
  154. package/build/lib/method-map.js +0 -11
  155. package/build/lib/method-map.js.map +1 -1
  156. package/build/lib/utils.d.ts +12 -0
  157. package/build/lib/utils.d.ts.map +1 -1
  158. package/build/lib/utils.js +38 -2
  159. package/build/lib/utils.js.map +1 -1
  160. package/lib/commands/app-management.js +470 -145
  161. package/lib/commands/appearance.js +29 -36
  162. package/lib/commands/context/cache.js +29 -0
  163. package/lib/commands/context/exports.js +379 -0
  164. package/lib/commands/context/helpers.js +802 -0
  165. package/lib/commands/device/common.js +264 -0
  166. package/lib/commands/device/emulator-actions.js +194 -0
  167. package/lib/commands/device/emulator-console.js +24 -0
  168. package/lib/commands/device/utils.js +285 -0
  169. package/lib/commands/deviceidle.js +31 -44
  170. package/lib/commands/element.js +149 -142
  171. package/lib/commands/execute.js +86 -87
  172. package/lib/commands/file-actions.js +249 -222
  173. package/lib/commands/find.ts +13 -19
  174. package/lib/commands/geolocation.js +179 -0
  175. package/lib/commands/ime.js +53 -45
  176. package/lib/commands/intent.js +149 -91
  177. package/lib/commands/keyboard.js +114 -17
  178. package/lib/commands/lock/exports.js +139 -0
  179. package/lib/commands/lock/helpers.js +379 -0
  180. package/lib/commands/log.js +170 -166
  181. package/lib/commands/media-projection.js +75 -70
  182. package/lib/commands/memory.js +17 -29
  183. package/lib/commands/misc.js +94 -0
  184. package/lib/commands/network.js +209 -223
  185. package/lib/commands/performance.js +88 -73
  186. package/lib/commands/permissions.js +83 -84
  187. package/lib/commands/recordscreen.js +171 -170
  188. package/lib/commands/resources.js +96 -0
  189. package/lib/commands/shell.js +28 -42
  190. package/lib/commands/streamscreen.js +207 -206
  191. package/lib/commands/system-bars.js +76 -77
  192. package/lib/commands/time.js +36 -0
  193. package/lib/commands/touch.js +442 -346
  194. package/lib/commands/types.ts +142 -10
  195. package/lib/doctor/checks.js +24 -16
  196. package/lib/driver.ts +454 -12
  197. package/lib/index.ts +1 -13
  198. package/lib/logger.js +1 -1
  199. package/lib/method-map.js +0 -11
  200. package/lib/utils.js +40 -3
  201. package/package.json +1 -1
  202. package/build/lib/commands/actions.d.ts +0 -8
  203. package/build/lib/commands/actions.d.ts.map +0 -1
  204. package/build/lib/commands/actions.js +0 -207
  205. package/build/lib/commands/actions.js.map +0 -1
  206. package/build/lib/commands/alert.d.ts +0 -8
  207. package/build/lib/commands/alert.d.ts.map +0 -1
  208. package/build/lib/commands/alert.js +0 -29
  209. package/build/lib/commands/alert.js.map +0 -1
  210. package/build/lib/commands/context.d.ts +0 -10
  211. package/build/lib/commands/context.d.ts.map +0 -1
  212. package/build/lib/commands/context.js +0 -431
  213. package/build/lib/commands/context.js.map +0 -1
  214. package/build/lib/commands/emu-console.d.ts +0 -7
  215. package/build/lib/commands/emu-console.d.ts.map +0 -1
  216. package/build/lib/commands/emu-console.js +0 -27
  217. package/build/lib/commands/emu-console.js.map +0 -1
  218. package/build/lib/commands/general.d.ts +0 -9
  219. package/build/lib/commands/general.d.ts.map +0 -1
  220. package/build/lib/commands/general.js +0 -293
  221. package/build/lib/commands/general.js.map +0 -1
  222. package/build/lib/commands/index.d.ts +0 -28
  223. package/build/lib/commands/index.d.ts.map +0 -1
  224. package/build/lib/commands/index.js +0 -57
  225. package/build/lib/commands/index.js.map +0 -1
  226. package/build/lib/commands/mixins.d.ts +0 -747
  227. package/build/lib/commands/mixins.d.ts.map +0 -1
  228. package/build/lib/commands/mixins.js +0 -19
  229. package/build/lib/commands/mixins.js.map +0 -1
  230. package/build/lib/helpers/android.d.ts +0 -163
  231. package/build/lib/helpers/android.d.ts.map +0 -1
  232. package/build/lib/helpers/android.js +0 -818
  233. package/build/lib/helpers/android.js.map +0 -1
  234. package/build/lib/helpers/index.d.ts +0 -7
  235. package/build/lib/helpers/index.d.ts.map +0 -1
  236. package/build/lib/helpers/index.js +0 -29
  237. package/build/lib/helpers/index.js.map +0 -1
  238. package/build/lib/helpers/types.d.ts +0 -122
  239. package/build/lib/helpers/types.d.ts.map +0 -1
  240. package/build/lib/helpers/types.js +0 -3
  241. package/build/lib/helpers/types.js.map +0 -1
  242. package/build/lib/helpers/unlock.d.ts +0 -32
  243. package/build/lib/helpers/unlock.d.ts.map +0 -1
  244. package/build/lib/helpers/unlock.js +0 -273
  245. package/build/lib/helpers/unlock.js.map +0 -1
  246. package/build/lib/helpers/webview.d.ts +0 -74
  247. package/build/lib/helpers/webview.d.ts.map +0 -1
  248. package/build/lib/helpers/webview.js +0 -442
  249. package/build/lib/helpers/webview.js.map +0 -1
  250. package/lib/commands/actions.js +0 -244
  251. package/lib/commands/alert.js +0 -34
  252. package/lib/commands/context.js +0 -507
  253. package/lib/commands/emu-console.js +0 -31
  254. package/lib/commands/general.js +0 -343
  255. package/lib/commands/index.ts +0 -54
  256. package/lib/commands/mixins.ts +0 -976
  257. package/lib/helpers/android.ts +0 -1153
  258. package/lib/helpers/index.ts +0 -6
  259. package/lib/helpers/types.ts +0 -136
  260. package/lib/helpers/unlock.ts +0 -329
  261. package/lib/helpers/webview.ts +0 -604
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resetMockLocation = exports.setMockLocationApp = exports.toggleLocationServices = exports.isLocationServicesEnabled = exports.getGeoLocation = exports.mobileRefreshGpsCache = exports.setGeoLocation = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const support_1 = require("@appium/support");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const bluebird_1 = __importDefault(require("bluebird"));
11
+ const io_appium_settings_1 = require("io.appium.settings");
12
+ const app_management_1 = require("./app-management");
13
+ // The value close to zero, but not zero, is needed
14
+ // to trick JSON generation and send a float value instead of an integer,
15
+ // This allows strictly-typed clients, like Java, to properly
16
+ // parse it. Otherwise float 0.0 is always represented as integer 0 in JS.
17
+ // The value must not be greater than DBL_EPSILON (https://opensource.apple.com/source/Libc/Libc-498/include/float.h)
18
+ const GEO_EPSILON = Number.MIN_VALUE;
19
+ const MOCK_APP_IDS_STORE = '/data/local/tmp/mock_apps.json';
20
+ /**
21
+ * @this {import('../driver').AndroidDriver}
22
+ * @param {import('@appium/types').Location} location
23
+ * @returns {Promise<import('@appium/types').Location>}
24
+ */
25
+ async function setGeoLocation(location) {
26
+ await this.settingsApp.setGeoLocation(location, this.isEmulator());
27
+ try {
28
+ return await this.getGeoLocation();
29
+ }
30
+ catch (e) {
31
+ this.log.warn(`Could not get the current geolocation info: ${ /** @type {Error} */(e).message}`);
32
+ this.log.warn(`Returning the default zero'ed values`);
33
+ return {
34
+ latitude: GEO_EPSILON,
35
+ longitude: GEO_EPSILON,
36
+ altitude: GEO_EPSILON,
37
+ };
38
+ }
39
+ }
40
+ exports.setGeoLocation = setGeoLocation;
41
+ /**
42
+ * Sends an async request to refresh the GPS cache.
43
+ *
44
+ * This feature only works if the device under test has Google Play Services
45
+ * installed. In case the vanilla LocationManager is used the device API level
46
+ * must be at version 30 (Android R) or higher.
47
+ *
48
+ * @this {import('../driver').AndroidDriver}
49
+ * @param {import('./types').GpsCacheRefreshOpts} [opts={}]
50
+ * @returns {Promise<void>}
51
+ */
52
+ async function mobileRefreshGpsCache(opts = {}) {
53
+ const { timeoutMs } = opts;
54
+ await this.settingsApp.refreshGeoLocationCache(timeoutMs);
55
+ }
56
+ exports.mobileRefreshGpsCache = mobileRefreshGpsCache;
57
+ /**
58
+ * @this {import('../driver').AndroidDriver}
59
+ * @returns {Promise<import('@appium/types').Location>}
60
+ */
61
+ async function getGeoLocation() {
62
+ const { latitude, longitude, altitude } = await this.settingsApp.getGeoLocation();
63
+ return {
64
+ latitude: parseFloat(String(latitude)) || GEO_EPSILON,
65
+ longitude: parseFloat(String(longitude)) || GEO_EPSILON,
66
+ altitude: parseFloat(String(altitude)) || GEO_EPSILON,
67
+ };
68
+ }
69
+ exports.getGeoLocation = getGeoLocation;
70
+ /**
71
+ * @this {import('../driver').AndroidDriver}
72
+ * @returns {Promise<boolean>}
73
+ */
74
+ async function isLocationServicesEnabled() {
75
+ return (await this.adb.getLocationProviders()).includes('gps');
76
+ }
77
+ exports.isLocationServicesEnabled = isLocationServicesEnabled;
78
+ /**
79
+ * @this {import('../driver').AndroidDriver}
80
+ * @returns {Promise<void>}
81
+ */
82
+ async function toggleLocationServices() {
83
+ this.log.info('Toggling location services');
84
+ const isGpsEnabled = await this.isLocationServicesEnabled();
85
+ this.log.debug(`Current GPS state: ${isGpsEnabled}. ` +
86
+ `The service is going to be ${isGpsEnabled ? 'disabled' : 'enabled'}`);
87
+ await this.adb.toggleGPSLocationProvider(!isGpsEnabled);
88
+ }
89
+ exports.toggleLocationServices = toggleLocationServices;
90
+ // #region Internal helpers
91
+ /**
92
+ * @this {import('../driver').AndroidDriver}
93
+ * @param {string} appId
94
+ * @returns {Promise<void>}
95
+ */
96
+ async function setMockLocationApp(appId) {
97
+ try {
98
+ if ((await this.adb.getApiLevel()) < 23) {
99
+ await this.adb.shell(['settings', 'put', 'secure', 'mock_location', '1']);
100
+ }
101
+ else {
102
+ await this.adb.shell(['appops', 'set', appId, 'android:mock_location', 'allow']);
103
+ }
104
+ }
105
+ catch (err) {
106
+ this.log.warn(`Unable to set mock location for app '${appId}': ${err.message}`);
107
+ return;
108
+ }
109
+ try {
110
+ /** @type {string[]} */
111
+ let pkgIds = [];
112
+ if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
113
+ try {
114
+ pkgIds = JSON.parse(await this.adb.shell(['cat', MOCK_APP_IDS_STORE]));
115
+ }
116
+ catch (ign) { }
117
+ }
118
+ if (pkgIds.includes(appId)) {
119
+ return;
120
+ }
121
+ pkgIds.push(appId);
122
+ const tmpRoot = await support_1.tempDir.openDir();
123
+ const srcPath = node_path_1.default.posix.join(tmpRoot, node_path_1.default.posix.basename(MOCK_APP_IDS_STORE));
124
+ try {
125
+ await support_1.fs.writeFile(srcPath, JSON.stringify(pkgIds), 'utf8');
126
+ await this.adb.push(srcPath, MOCK_APP_IDS_STORE);
127
+ }
128
+ finally {
129
+ await support_1.fs.rimraf(tmpRoot);
130
+ }
131
+ }
132
+ catch (e) {
133
+ this.log.warn(`Unable to persist mock location app id '${appId}': ${e.message}`);
134
+ }
135
+ }
136
+ exports.setMockLocationApp = setMockLocationApp;
137
+ /**
138
+ * @this {import('../driver').AndroidDriver}
139
+ * @returns {Promise<void>}
140
+ */
141
+ async function resetMockLocation() {
142
+ try {
143
+ if ((await this.adb.getApiLevel()) < 23) {
144
+ await this.adb.shell(['settings', 'put', 'secure', 'mock_location', '0']);
145
+ return;
146
+ }
147
+ const thirdPartyPkgIdsPromise = app_management_1.getThirdPartyPackages.bind(this)();
148
+ let pkgIds = [];
149
+ if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
150
+ try {
151
+ pkgIds = JSON.parse(await this.adb.shell(['cat', MOCK_APP_IDS_STORE]));
152
+ }
153
+ catch (ign) { }
154
+ }
155
+ const thirdPartyPkgIds = await thirdPartyPkgIdsPromise;
156
+ // Only include currently installed packages
157
+ const resultPkgs = lodash_1.default.intersection(pkgIds, thirdPartyPkgIds);
158
+ if (lodash_1.default.size(resultPkgs) <= 1) {
159
+ await this.adb.shell([
160
+ 'appops',
161
+ 'set',
162
+ resultPkgs[0] ?? io_appium_settings_1.SETTINGS_HELPER_ID,
163
+ 'android:mock_location',
164
+ 'deny',
165
+ ]);
166
+ return;
167
+ }
168
+ this.log.debug(`Resetting mock_location permission for the following apps: ${resultPkgs}`);
169
+ await bluebird_1.default.all(resultPkgs.map((pkgId) => (async () => {
170
+ try {
171
+ await this.adb.shell(['appops', 'set', pkgId, 'android:mock_location', 'deny']);
172
+ }
173
+ catch (ign) { }
174
+ })()));
175
+ }
176
+ catch (err) {
177
+ this.log.warn(`Unable to reset mock location: ${err.message}`);
178
+ }
179
+ }
180
+ exports.resetMockLocation = resetMockLocation;
181
+ // #endregion Internal helpers
182
+ //# sourceMappingURL=geolocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,6CAA4C;AAC5C,0DAA6B;AAC7B,wDAAyB;AACzB,2DAAsD;AACtD,qDAAuD;AAEvD,mDAAmD;AACnD,yEAAyE;AACzE,6DAA6D;AAC7D,0EAA0E;AAC1E,qHAAqH;AACrH,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC;AACrC,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AAE5D;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAAC,QAAQ;IAC3C,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACnE,IAAI;QACF,OAAO,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;KACpC;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,+CAA+C,CAAA,oBAAqB,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAClF,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACtD,OAAO;YACL,QAAQ,EAAE,WAAW;YACrB,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,WAAW;SACtB,CAAC;KACH;AACH,CAAC;AAfD,wCAeC;AAED;;;;;;;;;;GAUG;AACI,KAAK,UAAU,qBAAqB,CAAC,IAAI,GAAG,EAAE;IACnD,MAAM,EAAC,SAAS,EAAC,GAAG,IAAI,CAAC;IACzB,MAAM,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5D,CAAC;AAHD,sDAGC;AAED;;;GAGG;AACI,KAAK,UAAU,cAAc;IAClC,MAAM,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,GAAG,MAAM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AC,CAAC,GAAG,CACT,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACvB,CAAC,KAAK,IAAI,EAAE;YACV,IAAI;gBACF,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAAC;aACjF;YAAC,OAAO,GAAG,EAAE,GAAE;QAClB,CAAC,CAAC,EAAE,CACL,CACF,CAAC;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;KAChE;AACH,CAAC;AAzCD,8CAyCC;AAED,8BAA8B"}
@@ -1,8 +1,28 @@
1
- export default IMEMixin;
2
- export type ADB = import('appium-adb').ADB;
3
1
  /**
4
- * @type {import('./mixins').IMEMixin & ThisType<import('../driver').AndroidDriver>}
5
- * @satisfies {import('@appium/types').ExternalDriver}
2
+ * @this {import('../driver').AndroidDriver}
3
+ * @returns {Promise<boolean>}
4
+ */
5
+ export function isIMEActivated(this: import("../driver").AndroidDriver): Promise<boolean>;
6
+ /**
7
+ * @this {import('../driver').AndroidDriver}
8
+ * @returns {Promise<string[]>}
9
+ */
10
+ export function availableIMEEngines(this: import("../driver").AndroidDriver): Promise<string[]>;
11
+ /**
12
+ * @this {import('../driver').AndroidDriver}
13
+ * @returns {Promise<string>}
6
14
  */
7
- declare const IMEMixin: import('./mixins').IMEMixin & ThisType<import('../driver').AndroidDriver>;
15
+ export function getActiveIMEEngine(this: import("../driver").AndroidDriver): Promise<string>;
16
+ /**
17
+ * @this {import('../driver').AndroidDriver}
18
+ * @param {string} imeId
19
+ * @returns {Promise<void>}
20
+ */
21
+ export function activateIMEEngine(this: import("../driver").AndroidDriver, imeId: string): Promise<void>;
22
+ /**
23
+ * @this {import('../driver').AndroidDriver}
24
+ * @returns {Promise<void>}
25
+ */
26
+ export function deactivateIMEEngine(this: import("../driver").AndroidDriver): Promise<void>;
27
+ export type ADB = import('appium-adb').ADB;
8
28
  //# sourceMappingURL=ime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ime.d.ts","sourceRoot":"","sources":["../../../lib/commands/ime.js"],"names":[],"mappings":";kBAuDa,OAAO,YAAY,EAAE,GAAG;AAlDrC;;;GAGG;AACH,wBAHU,OAAO,UAAU,EAAE,QAAQ,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CA0CjF"}
1
+ {"version":3,"file":"ime.d.ts","sourceRoot":"","sources":["../../../lib/commands/ime.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,yEAFa,QAAQ,OAAO,CAAC,CAM5B;AAED;;;GAGG;AACH,8EAFa,QAAQ,MAAM,EAAE,CAAC,CAO7B;AAED;;;GAGG;AACH,6EAFa,QAAQ,MAAM,CAAC,CAK3B;AAED;;;;GAIG;AACH,kFAHW,MAAM,GACJ,QAAQ,IAAI,CAAC,CAYzB;AAED;;;GAGG;AACH,8EAFa,QAAQ,IAAI,CAAC,CASzB;kBAGY,OAAO,YAAY,EAAE,GAAG"}
@@ -1,50 +1,67 @@
1
1
  "use strict";
2
- // @ts-check
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const mixins_1 = require("./mixins");
3
+ exports.deactivateIMEEngine = exports.activateIMEEngine = exports.getActiveIMEEngine = exports.availableIMEEngines = exports.isIMEActivated = void 0;
5
4
  const driver_1 = require("appium/driver");
6
5
  /**
7
- * @type {import('./mixins').IMEMixin & ThisType<import('../driver').AndroidDriver>}
8
- * @satisfies {import('@appium/types').ExternalDriver}
6
+ * @this {import('../driver').AndroidDriver}
7
+ * @returns {Promise<boolean>}
9
8
  */
10
- const IMEMixin = {
11
- async isIMEActivated() {
12
- // eslint-disable-line require-await
13
- // IME is always activated on Android devices
14
- return true;
15
- },
16
- async availableIMEEngines() {
17
- this.log.debug('Retrieving available IMEs');
18
- let engines = await this.adb.availableIMEs();
19
- this.log.debug(`Engines: ${JSON.stringify(engines)}`);
20
- return engines;
21
- },
22
- async getActiveIMEEngine() {
23
- this.log.debug('Retrieving current default IME');
24
- return String(await this.adb.defaultIME());
25
- },
26
- async activateIMEEngine(imeId) {
27
- this.log.debug(`Attempting to activate IME ${imeId}`);
28
- let availableEngines = await this.adb.availableIMEs();
29
- if (availableEngines.indexOf(imeId) === -1) {
30
- this.log.debug('IME not found, failing');
31
- throw new driver_1.errors.IMENotAvailableError();
32
- }
33
- this.log.debug('Found installed IME, attempting to activate');
34
- await this.adb.enableIME(imeId);
35
- await this.adb.setIME(imeId);
36
- },
37
- async deactivateIMEEngine() {
38
- let currentEngine = await this.getActiveIMEEngine();
39
- // XXX: this allowed 'null' to be passed into `adb.shell`
40
- if (currentEngine) {
41
- this.log.debug(`Attempting to deactivate ${currentEngine}`);
42
- await this.adb.disableIME(currentEngine);
43
- }
44
- },
45
- };
46
- exports.default = IMEMixin;
47
- (0, mixins_1.mixin)(IMEMixin);
9
+ async function isIMEActivated() {
10
+ // eslint-disable-line require-await
11
+ // IME is always activated on Android devices
12
+ return true;
13
+ }
14
+ exports.isIMEActivated = isIMEActivated;
15
+ /**
16
+ * @this {import('../driver').AndroidDriver}
17
+ * @returns {Promise<string[]>}
18
+ */
19
+ async function availableIMEEngines() {
20
+ this.log.debug('Retrieving available IMEs');
21
+ let engines = await this.adb.availableIMEs();
22
+ this.log.debug(`Engines: ${JSON.stringify(engines)}`);
23
+ return engines;
24
+ }
25
+ exports.availableIMEEngines = availableIMEEngines;
26
+ /**
27
+ * @this {import('../driver').AndroidDriver}
28
+ * @returns {Promise<string>}
29
+ */
30
+ async function getActiveIMEEngine() {
31
+ this.log.debug('Retrieving current default IME');
32
+ return String(await this.adb.defaultIME());
33
+ }
34
+ exports.getActiveIMEEngine = getActiveIMEEngine;
35
+ /**
36
+ * @this {import('../driver').AndroidDriver}
37
+ * @param {string} imeId
38
+ * @returns {Promise<void>}
39
+ */
40
+ async function activateIMEEngine(imeId) {
41
+ this.log.debug(`Attempting to activate IME ${imeId}`);
42
+ let availableEngines = await this.adb.availableIMEs();
43
+ if (availableEngines.indexOf(imeId) === -1) {
44
+ this.log.debug('IME not found, failing');
45
+ throw new driver_1.errors.IMENotAvailableError();
46
+ }
47
+ this.log.debug('Found installed IME, attempting to activate');
48
+ await this.adb.enableIME(imeId);
49
+ await this.adb.setIME(imeId);
50
+ }
51
+ exports.activateIMEEngine = activateIMEEngine;
52
+ /**
53
+ * @this {import('../driver').AndroidDriver}
54
+ * @returns {Promise<void>}
55
+ */
56
+ async function deactivateIMEEngine() {
57
+ let currentEngine = await this.getActiveIMEEngine();
58
+ // XXX: this allowed 'null' to be passed into `adb.shell`
59
+ if (currentEngine) {
60
+ this.log.debug(`Attempting to deactivate ${currentEngine}`);
61
+ await this.adb.disableIME(currentEngine);
62
+ }
63
+ }
64
+ exports.deactivateIMEEngine = deactivateIMEEngine;
48
65
  /**
49
66
  * @typedef {import('appium-adb').ADB} ADB
50
67
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ime.js","sourceRoot":"","sources":["../../../lib/commands/ime.js"],"names":[],"mappings":";AAAA,YAAY;;AAEZ,qCAA+B;AAC/B,0CAAqC;AAErC;;;GAGG;AACH,MAAM,QAAQ,GAAG;IACf,KAAK,CAAC,cAAc;QAClB,oCAAoC;QACpC,6CAA6C;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC5C,IAAI,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,IAAI,CAAC,GAAG,CAAC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;AACI,KAAK,UAAU,mBAAmB;IACvC,IAAI,aAAa,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;IACpD,yDAAyD;IACzD,IAAI,aAAa,EAAE;QACjB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,aAAa,EAAE,CAAC,CAAC;QAC5D,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;KAC1C;AACH,CAAC;AAPD,kDAOC;AAED;;GAEG"}
@@ -1,8 +1,59 @@
1
- export default ActivityMixin;
2
- export type ADB = import('appium-adb').ADB;
3
1
  /**
4
- * @type {import('./mixins').ActivityMixin & ThisType<import('../driver').AndroidDriver>}
5
- * @satisfies {import('@appium/types').ExternalDriver}
2
+ * @deprecated
3
+ * @this {import('../driver').AndroidDriver}
4
+ * @param {string} appPackage
5
+ * @param {string} appActivity
6
+ * @param {string} [appWaitPackage]
7
+ * @param {string} [appWaitActivity]
8
+ * @param {string} [intentAction]
9
+ * @param {string} [intentCategory]
10
+ * @param {string} [intentFlags]
11
+ * @param {string} [optionalIntentArguments]
12
+ * @param {boolean} [dontStopAppOnReset]
13
+ * @returns {Promise<void>}
14
+ */
15
+ export function startActivity(this: import("../driver").AndroidDriver, appPackage: string, appActivity: string, appWaitPackage?: string | undefined, appWaitActivity?: string | undefined, intentAction?: string | undefined, intentCategory?: string | undefined, intentFlags?: string | undefined, optionalIntentArguments?: string | undefined, dontStopAppOnReset?: boolean | undefined): Promise<void>;
16
+ export class startActivity {
17
+ /**
18
+ * @deprecated
19
+ * @this {import('../driver').AndroidDriver}
20
+ * @param {string} appPackage
21
+ * @param {string} appActivity
22
+ * @param {string} [appWaitPackage]
23
+ * @param {string} [appWaitActivity]
24
+ * @param {string} [intentAction]
25
+ * @param {string} [intentCategory]
26
+ * @param {string} [intentFlags]
27
+ * @param {string} [optionalIntentArguments]
28
+ * @param {boolean} [dontStopAppOnReset]
29
+ * @returns {Promise<void>}
30
+ */
31
+ constructor(this: import("../driver").AndroidDriver, appPackage: string, appActivity: string, appWaitPackage?: string | undefined, appWaitActivity?: string | undefined, intentAction?: string | undefined, intentCategory?: string | undefined, intentFlags?: string | undefined, optionalIntentArguments?: string | undefined, dontStopAppOnReset?: boolean | undefined);
32
+ _cachedActivityArgs: import("@appium/types").StringRecord;
33
+ }
34
+ /**
35
+ * @this {import('../driver').AndroidDriver}
36
+ * @param {import('./types').StartActivityOpts} [opts={}]
37
+ * @returns {Promise<string>}
38
+ */
39
+ export function mobileStartActivity(this: import("../driver").AndroidDriver, opts?: import("./types").StartActivityOpts | undefined): Promise<string>;
40
+ /**
41
+ * @this {import('../driver').AndroidDriver}
42
+ * @param {import('./types').BroadcastOpts} [opts={}]
43
+ * @returns {Promise<string>}
6
44
  */
7
- declare const ActivityMixin: import('./mixins').ActivityMixin & ThisType<import('../driver').AndroidDriver>;
45
+ export function mobileBroadcast(this: import("../driver").AndroidDriver, opts?: import("./types").BroadcastOpts | undefined): Promise<string>;
46
+ /**
47
+ * @this {import('../driver').AndroidDriver}
48
+ * @param {import('./types').StartServiceOpts} [opts={}]
49
+ * @returns {Promise<string>}
50
+ */
51
+ export function mobileStartService(this: import("../driver").AndroidDriver, opts?: import("./types").StartServiceOpts | undefined): Promise<string>;
52
+ /**
53
+ * @this {import('../driver').AndroidDriver}
54
+ * @param {import('./types').StopServiceOpts} [opts={}]
55
+ * @returns {Promise<string>}
56
+ */
57
+ export function mobileStopService(this: import("../driver").AndroidDriver, opts?: import("./types").IntentOpts | undefined): Promise<string>;
58
+ export type ADB = import('appium-adb').ADB;
8
59
  //# sourceMappingURL=intent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../../lib/commands/intent.js"],"names":[],"mappings":";kBA4La,OAAO,YAAY,EAAE,GAAG;AAvFrC;;;GAGG;AACH,6BAHU,OAAO,UAAU,EAAE,aAAa,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CA+EtF"}
1
+ {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../../lib/commands/intent.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;;GAaG;AACH,mFAXW,MAAM,eACN,MAAM,gRAQJ,QAAQ,IAAI,CAAC,CAoCzB;;IAhDD;;;;;;;;;;;;;OAaG;IACH,iEAXW,MAAM,eACN,MAAM,+QA4ChB;IAHC,0DAAyD;;AAK3D;;;;GAIG;AACH,sIAFa,QAAQ,MAAM,CAAC,CA4B3B;AAED;;;;GAIG;AACH,8HAFa,QAAQ,MAAM,CAAC,CAgB3B;AAED;;;;GAIG;AACH,oIAFa,QAAQ,MAAM,CAAC,CAe3B;AAED;;;;GAIG;AACH,6HAFa,QAAQ,MAAM,CAAC,CAa3B;kBAiFY,OAAO,YAAY,EAAE,GAAG"}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- // @ts-check
3
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
4
  };
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
- const mixins_1 = require("./mixins");
6
+ exports.mobileStopService = exports.mobileStartService = exports.mobileBroadcast = exports.mobileStartActivity = exports.startActivity = void 0;
8
7
  const lodash_1 = __importDefault(require("lodash"));
9
8
  const driver_1 = require("appium/driver");
9
+ const support_1 = require("@appium/support");
10
10
  const NO_VALUE_ARG_TYPE = 'sn';
11
11
  const SUPPORTED_EXTRA_TYPES = [
12
12
  's',
@@ -27,6 +27,138 @@ const SUPPORTED_EXTRA_TYPES = [
27
27
  'sal',
28
28
  ];
29
29
  const API_LEVEL_ANDROID_8 = 26;
30
+ /**
31
+ * @deprecated
32
+ * @this {import('../driver').AndroidDriver}
33
+ * @param {string} appPackage
34
+ * @param {string} appActivity
35
+ * @param {string} [appWaitPackage]
36
+ * @param {string} [appWaitActivity]
37
+ * @param {string} [intentAction]
38
+ * @param {string} [intentCategory]
39
+ * @param {string} [intentFlags]
40
+ * @param {string} [optionalIntentArguments]
41
+ * @param {boolean} [dontStopAppOnReset]
42
+ * @returns {Promise<void>}
43
+ */
44
+ async function startActivity(appPackage, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset) {
45
+ this.log.debug(`Starting package '${appPackage}' and activity '${appActivity}'`);
46
+ // dontStopAppOnReset is both an argument here, and a desired capability
47
+ // if the argument is set, use it, otherwise use the cap
48
+ if (!support_1.util.hasValue(dontStopAppOnReset)) {
49
+ dontStopAppOnReset = !!this.opts.dontStopAppOnReset;
50
+ }
51
+ /** @type {import('appium-adb').StartAppOptions} */
52
+ let args = {
53
+ pkg: appPackage,
54
+ activity: appActivity,
55
+ waitPkg: appWaitPackage || appPackage,
56
+ waitActivity: appWaitActivity || appActivity,
57
+ action: intentAction,
58
+ category: intentCategory,
59
+ flags: intentFlags,
60
+ optionalIntentArguments,
61
+ stopApp: !dontStopAppOnReset,
62
+ };
63
+ this._cachedActivityArgs = this._cachedActivityArgs || {};
64
+ this._cachedActivityArgs[`${args.waitPkg}/${args.waitActivity}`] = args;
65
+ await this.adb.startApp(args);
66
+ }
67
+ exports.startActivity = startActivity;
68
+ /**
69
+ * @this {import('../driver').AndroidDriver}
70
+ * @param {import('./types').StartActivityOpts} [opts={}]
71
+ * @returns {Promise<string>}
72
+ */
73
+ async function mobileStartActivity(opts = {}) {
74
+ const { user, wait, stop, windowingMode, activityType, display } = opts;
75
+ const cmd = [
76
+ 'am',
77
+ (await this.adb.getApiLevel()) < API_LEVEL_ANDROID_8 ? 'start' : 'start-activity',
78
+ ];
79
+ if (!lodash_1.default.isNil(user)) {
80
+ cmd.push('--user', String(user));
81
+ }
82
+ if (wait) {
83
+ cmd.push('-W');
84
+ }
85
+ if (stop) {
86
+ cmd.push('-S');
87
+ }
88
+ if (!lodash_1.default.isNil(windowingMode)) {
89
+ cmd.push('--windowingMode', String(windowingMode));
90
+ }
91
+ if (!lodash_1.default.isNil(activityType)) {
92
+ cmd.push('--activityType', String(activityType));
93
+ }
94
+ if (!lodash_1.default.isNil(display)) {
95
+ cmd.push('--display', String(display));
96
+ }
97
+ cmd.push(...parseIntentSpec(opts));
98
+ return await this.adb.shell(cmd);
99
+ }
100
+ exports.mobileStartActivity = mobileStartActivity;
101
+ /**
102
+ * @this {import('../driver').AndroidDriver}
103
+ * @param {import('./types').BroadcastOpts} [opts={}]
104
+ * @returns {Promise<string>}
105
+ */
106
+ async function mobileBroadcast(opts = {}) {
107
+ const { user, receiverPermission, allowBackgroundActivityStarts } = opts;
108
+ const cmd = ['am', 'broadcast'];
109
+ if (!lodash_1.default.isNil(user)) {
110
+ cmd.push('--user', String(user));
111
+ }
112
+ if (receiverPermission) {
113
+ cmd.push('--receiver-permission', receiverPermission);
114
+ }
115
+ if (allowBackgroundActivityStarts) {
116
+ cmd.push('--allow-background-activity-starts');
117
+ }
118
+ cmd.push(...parseIntentSpec(opts));
119
+ return await this.adb.shell(cmd);
120
+ }
121
+ exports.mobileBroadcast = mobileBroadcast;
122
+ /**
123
+ * @this {import('../driver').AndroidDriver}
124
+ * @param {import('./types').StartServiceOpts} [opts={}]
125
+ * @returns {Promise<string>}
126
+ */
127
+ async function mobileStartService(opts = {}) {
128
+ const { user, foreground } = opts;
129
+ const cmd = ['am'];
130
+ if ((await this.adb.getApiLevel()) < API_LEVEL_ANDROID_8) {
131
+ cmd.push('startservice');
132
+ }
133
+ else {
134
+ cmd.push(foreground ? 'start-foreground-service' : 'start-service');
135
+ }
136
+ if (!lodash_1.default.isNil(user)) {
137
+ cmd.push('--user', String(user));
138
+ }
139
+ cmd.push(...parseIntentSpec(opts));
140
+ return await this.adb.shell(cmd);
141
+ }
142
+ exports.mobileStartService = mobileStartService;
143
+ /**
144
+ * @this {import('../driver').AndroidDriver}
145
+ * @param {import('./types').StopServiceOpts} [opts={}]
146
+ * @returns {Promise<string>}
147
+ */
148
+ async function mobileStopService(opts = {}) {
149
+ const { user } = opts;
150
+ const cmd = [
151
+ 'am',
152
+ (await this.adb.getApiLevel()) < API_LEVEL_ANDROID_8 ? 'stopservice' : 'stop-service',
153
+ ];
154
+ if (!lodash_1.default.isNil(user)) {
155
+ cmd.push('--user', String(user));
156
+ }
157
+ cmd.push(...parseIntentSpec(opts));
158
+ return await this.adb.shell(cmd);
159
+ }
160
+ exports.mobileStopService = mobileStopService;
161
+ // #region Internal helpers
30
162
  /**
31
163
  *
32
164
  * @param {import('./types').IntentOpts} opts
@@ -97,87 +229,7 @@ function parseIntentSpec(opts = {}) {
97
229
  }
98
230
  return resultArgs;
99
231
  }
100
- /**
101
- * @type {import('./mixins').ActivityMixin & ThisType<import('../driver').AndroidDriver>}
102
- * @satisfies {import('@appium/types').ExternalDriver}
103
- */
104
- const ActivityMixin = {
105
- async mobileStartActivity(opts = {}) {
106
- const { user, wait, stop, windowingMode, activityType, display } = opts;
107
- const cmd = [
108
- 'am',
109
- (await this.adb.getApiLevel()) < API_LEVEL_ANDROID_8
110
- ? 'start'
111
- : 'start-activity',
112
- ];
113
- if (!lodash_1.default.isNil(user)) {
114
- cmd.push('--user', String(user));
115
- }
116
- if (wait) {
117
- cmd.push('-W');
118
- }
119
- if (stop) {
120
- cmd.push('-S');
121
- }
122
- if (!lodash_1.default.isNil(windowingMode)) {
123
- cmd.push('--windowingMode', String(windowingMode));
124
- }
125
- if (!lodash_1.default.isNil(activityType)) {
126
- cmd.push('--activityType', String(activityType));
127
- }
128
- if (!lodash_1.default.isNil(display)) {
129
- cmd.push('--display', String(display));
130
- }
131
- cmd.push(...parseIntentSpec(opts));
132
- return await this.adb.shell(cmd);
133
- },
134
- async mobileBroadcast(opts = {}) {
135
- const { user, receiverPermission, allowBackgroundActivityStarts } = opts;
136
- const cmd = ['am', 'broadcast'];
137
- if (!lodash_1.default.isNil(user)) {
138
- cmd.push('--user', String(user));
139
- }
140
- if (receiverPermission) {
141
- cmd.push('--receiver-permission', receiverPermission);
142
- }
143
- if (allowBackgroundActivityStarts) {
144
- cmd.push('--allow-background-activity-starts');
145
- }
146
- cmd.push(...parseIntentSpec(opts));
147
- return await this.adb.shell(cmd);
148
- },
149
- async mobileStartService(opts = {}) {
150
- const { user, foreground } = opts;
151
- const cmd = ['am'];
152
- if ((await this.adb.getApiLevel()) < API_LEVEL_ANDROID_8) {
153
- cmd.push('startservice');
154
- }
155
- else {
156
- cmd.push(foreground ? 'start-foreground-service' : 'start-service');
157
- }
158
- if (!lodash_1.default.isNil(user)) {
159
- cmd.push('--user', String(user));
160
- }
161
- cmd.push(...parseIntentSpec(opts));
162
- return await this.adb.shell(cmd);
163
- },
164
- async mobileStopService(opts = {}) {
165
- const { user } = opts;
166
- const cmd = [
167
- 'am',
168
- (await this.adb.getApiLevel()) < API_LEVEL_ANDROID_8
169
- ? 'stopservice'
170
- : 'stop-service',
171
- ];
172
- if (!lodash_1.default.isNil(user)) {
173
- cmd.push('--user', String(user));
174
- }
175
- cmd.push(...parseIntentSpec(opts));
176
- return await this.adb.shell(cmd);
177
- },
178
- };
179
- (0, mixins_1.mixin)(ActivityMixin);
180
- exports.default = ActivityMixin;
232
+ // #endregion
181
233
  /**
182
234
  * @typedef {import('appium-adb').ADB} ADB
183
235
  */