( device: DeviceInfo, app: string, optionsOrActivity?: OpenAndroidAppOptions | string, )
| 321 | } |
| 322 | |
| 323 | export async function openAndroidApp( |
| 324 | device: DeviceInfo, |
| 325 | app: string, |
| 326 | optionsOrActivity?: OpenAndroidAppOptions | string, |
| 327 | ): Promise<void> { |
| 328 | if (!device.booted) { |
| 329 | await waitForAndroidBoot(device.id); |
| 330 | } |
| 331 | const options = normalizeOpenAndroidAppOptions(optionsOrActivity); |
| 332 | const activity = options.activity; |
| 333 | const deepLinkTarget = app.trim(); |
| 334 | if (isDeepLinkTarget(deepLinkTarget)) { |
| 335 | await openAndroidDeepLink(device, deepLinkTarget, options); |
| 336 | return; |
| 337 | } |
| 338 | if (options.url !== undefined) { |
| 339 | await openAndroidAppBoundDeepLink(device, app, options); |
| 340 | return; |
| 341 | } |
| 342 | const resolved = await resolveAndroidApp(device, app); |
| 343 | const launchCategory = resolveAndroidLauncherCategory(device); |
| 344 | if (resolved.type === 'intent') { |
| 345 | await openAndroidIntent(device, resolved.value, options); |
| 346 | return; |
| 347 | } |
| 348 | if (activity) { |
| 349 | await openAndroidPackageActivity(device, resolved.value, activity, launchCategory, options); |
| 350 | return; |
| 351 | } |
| 352 | await openAndroidPackage(device, resolved.value, launchCategory, options); |
| 353 | } |
| 354 | |
| 355 | async function openAndroidDeepLink( |
| 356 | device: DeviceInfo, |
no test coverage detected