Skip to content

Commit 1dc9dea

Browse files
committed
fix(android): keep host-level adb visible to an installed provider scope
Collapsing execHostAdb and execSerialAdb into one port method inherited the serial variant's override escape, so a device-ready probe inside a provider scope reached the real adb binary instead of the scoped transport. Host-level adb stays visible to the override; the device-scoped executor is the caller that escapes it.
1 parent 4ab005c commit 1dc9dea

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎packages/platform-android/src/adb-host.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ export type AndroidAdbHost = Readonly<{
4646
/** Narrow filesystem authority used by Android helper, SDK, and artifact mechanics. */
4747
files: AndroidAdbFileHost;
4848
/**
49-
* Local adb execution for one addressing decision, escaping any active command-executor
50-
* override (a tunnel-backed provider shelling out to adb must not route back into itself)
51-
* and owning the host-side process-group/teardown semantics. The invocation's command is
52-
* appended verbatim; only `target` is lowered into adb global options.
49+
* Local adb execution for one addressing decision, visible to an installed command-executor
50+
* override so a scoped transport can answer for it. A caller that must not be captured — the
51+
* device-scoped executor a provider would otherwise re-enter — wraps this in
52+
* `withoutAdbCommandExecutorOverride`. The invocation's command is appended verbatim; only
53+
* `target` is lowered into adb global options.
5354
*/
5455
execAdb(
5556
invocation: AndroidAdbInvocation,

‎packages/platform-android/src/adb-provider-scope.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@ export function createDeviceAdbExecutor(
5353
function createSerialAdbExecutor(serial: string, serverPort?: number): AndroidAdbExecutor {
5454
return withAdbFailureHints(async (args, options) => {
5555
const port = scopedServerPort(serial, serverPort);
56-
return await requireAndroidAdbHost().execAdb(androidDeviceAdbInvocation(serial, args, port), {
57-
...options,
58-
detached: true,
59-
});
56+
// A device-scoped executor is the terminal local route: an installed provider must not
57+
// capture it and route the call back into itself.
58+
return await requireAndroidAdbHost().withoutAdbCommandExecutorOverride(
59+
async () =>
60+
await requireAndroidAdbHost().execAdb(androidDeviceAdbInvocation(serial, args, port), {
61+
...options,
62+
detached: true,
63+
}),
64+
);
6065
});
6166
}
6267

‎src/platform-runtime-android-adb-host.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ bindAndroidAdbHost({
9090
},
9191
execAdb: async (invocation, options) => {
9292
const lowered = lowerAndroidAdbInvocation(invocation, options);
93-
return await withoutCommandExecutorOverride(async () => {
94-
return await runCmd('adb', lowered.args, lowered.options);
95-
});
93+
return await runCmd('adb', lowered.args, lowered.options);
9694
},
9795
spawnAdb: (invocation, options) => {
9896
const lowered = lowerAndroidAdbInvocation(invocation, options);

0 commit comments

Comments
 (0)