mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
fix(android): target the selected device in adb reads; don't strand nav mode
Review fixes: - ForegroundPackage/FocusedWindowPackage now take a serial and pass -s, so the foreground/scope guard works when several devices are attached (the --device path). Previously they ran bare `adb shell`, which errors with multiple devices, silently disabling app-scope enforcement. The sidecar client passes its serial through. - Extract an adbArgs helper and route every adb call through it, removing four duplicated serial-arg builders. - ForceThreeButtonNav now decides what to restore before changing anything: if the current mode is unknown or already 3-button it leaves nav untouched, instead of switching and then stranding the device in 3-button. Logic split into the pure navModeToRestore, now unit tested.
This commit is contained in:
1 parent
542bf11a02
commit
c48b13f304
3 files changed
+111
-56
No files matched your search
@@ -54,7 +54,7 @@ func (c *Client) ForegroundApp(ctx context.Context) (string, error) {
|
||||
if c.platform != "android" {
|
||||
return "", nil
|
||||
}
|
||||
return android.ForegroundPackage(ctx)
|
||||
return android.ForegroundPackage(ctx, c.serial)
|
||||
}
|
||||
|
||||
// FocusedWindowApp reports the package owning the focused window. Only Android
|
||||
@@ -64,7 +64,7 @@ func (c *Client) FocusedWindowApp(ctx context.Context) (string, error) {
|
||||
if c.platform != "android" {
|
||||
return "", nil
|
||||
}
|
||||
return android.FocusedWindowPackage(ctx)
|
||||
return android.FocusedWindowPackage(ctx, c.serial)
|
||||
}
|
||||
|
||||
// Dial connects to the sidecar gRPC server at the given address.
|
||||
|
||||
Reference in new issue
Block a user