MCPcopy Index your code
hub / github.com/callstack/agent-device / closeAndroidApp

Function closeAndroidApp

src/platforms/android/app-lifecycle.ts:645–658  ·  view source on GitHub ↗
(device: DeviceInfo, app: string)

Source from the content-addressed store, hash-verified

643}
644
645export async function closeAndroidApp(device: DeviceInfo, app: string): Promise<void> {
646 const trimmed = app.trim();
647 if (trimmed.toLowerCase() === 'settings') {
648 await runAndroidAdb(device, ['shell', 'am', 'force-stop', 'com.android.settings']);
649 await waitForAndroidPackageStopped(device, 'com.android.settings');
650 return;
651 }
652 const resolved = await resolveAndroidApp(device, app);
653 if (resolved.type === 'intent') {
654 throw new AppError('INVALID_ARGS', 'Close requires a package name, not an intent');
655 }
656 await runAndroidAdb(device, ['shell', 'am', 'force-stop', resolved.value]);
657 await waitForAndroidPackageStopped(device, resolved.value);
658}
659
660async function waitForAndroidPackageStopped(
661 device: DeviceInfo,

Callers 2

createAndroidInteractorFunction · 0.90
index.test.tsFile · 0.90

Calls 3

runAndroidAdbFunction · 0.90
resolveAndroidAppFunction · 0.85

Tested by

no test coverage detected