Skip to content

Commit d9a7268

Browse files
thymikeeclaude
andcommitted
test(android): pin the owner to the primary launch report
Key the lifecycle fixture's launch report on the opened target so the runtime-URL follow-up reports a different package. Drop the unreachable deep-link -S branch, since a bare URL relaunch is rejected before dispatch, and document Android intent ownership and relaunch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 37f04ca commit d9a7268

4 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎packages/platform-android/src/__tests__/app-lifecycle-open.test.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,6 @@ test('openAndroidApp returns the package am start reports it launched', async ()
542542
});
543543
});
544544

545-
test('openAndroidApp has am force-stop a deep link handler when terminating a running app', async () => {
546-
await withFakeAdb(androidOpenFakeAdb, async ({ calls, device }) => {
547-
await openAndroidApp(device, 'myapp://item/42', { terminateRunningApp: true });
548-
assert.deepEqual(calls.at(-1)?.slice(0, 5), ['shell', 'am', 'start', '-W', '-S']);
549-
});
550-
});
551-
552545
test('openAndroidApp stops the bound package before an app-bound deep link when terminating', async () => {
553546
await withFakeAdb(androidOpenFakeAdb, async ({ calls, device }) => {
554547
await openAndroidApp(device, 'com.example.app', {

‎packages/platform-android/src/app-lifecycle.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ async function openAndroidDeepLink(
262262
'am',
263263
'start',
264264
'-W',
265-
...(options.terminateRunningApp ? ['-S'] : []),
266265
'-a',
267266
'android.intent.action.VIEW',
268267
'-d',

‎packages/platform-android/src/lifecycle.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ function createLifecycle(
5151
({
5252
open: async (app: string, options?: { terminateRunningApp?: boolean }) => {
5353
calls.push(`open:${app}${options?.terminateRunningApp ? ' (terminate running)' : ''}`);
54-
return { launchedAppBundleId: params.launchedAppBundleId };
54+
return {
55+
launchedAppBundleId: app.includes('://')
56+
? 'com.example.follow-up'
57+
: params.launchedAppBundleId,
58+
};
5559
},
5660
openDevice: async () => {},
5761
close: async (app: string) => {

‎website/docs/docs/commands.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Open apps and links:
9090
- `open <app> --launch-console <path>` captures launch-time stdout/stderr for iOS simulator app launches. It is not valid for URL opens or other targets.
9191
- `open --platform macos --surface app|frontmost-app|desktop|menubar` selects the macOS session surface; `app` is the default when you name an app. See [Desktop targets](#desktop-targets). `--save-script` records the surface so `replay` reopens it; with no surface given, replay opens an app session.
9292
- Android React Native: `open --relaunch` needs an installed package name. Install or reinstall the APK first; `open <apk|aab> --relaunch` is rejected. For Metro-backed JS changes, run `metro reload` before reaching for `open <app> --relaunch`.
93+
- Android (adb): an intent target such as `open settings` records the package that opened as `appBundleId`. `open settings --relaunch` stops and restarts that app. If the intent matches more than one activity, `--relaunch` fails.
9394

9495
iOS Simulator launch behavior:
9596

0 commit comments

Comments
 (0)