Skip to content

fix: arm auto-switch only for devices the user dragged#28

Merged
pantafive merged 1 commit into
mainfrom
fix/auto-switch-arming
Jul 10, 2026
Merged

fix: arm auto-switch only for devices the user dragged#28
pantafive merged 1 commit into
mainfrom
fix/auto-switch-arming

Conversation

@pantafive

Copy link
Copy Markdown
Owner

Summary

Fixes #26. A drag in the device list ranks every visible row (the drop position must persist), and rank alone counted as consent for auto-switch, so devices the user never touched became switch targets. This PR records the dragged UIDs in an armed set (DeviceRanking.armed, persisted per direction next to the order) and lets only armed devices win a hotplug or fallback switch. Existing installs start unarmed: auto-switch goes dormant until a deliberate drag re-arms a device.

Test plan

  • make test: bug tests reproduce the report (a ranked but never-dragged device must not capture the default; fallback skips unarmed devices), plus an armed-set round-trip; existing policy tests updated to the new signature.
  • Manual: drag one row, confirm only that device auto-switches on reconnect.

A drag persists its drop position by ranking every visible row, so the
priority list also holds devices the user never touched — and rank alone
was consent for auto-switch. Bluetooth earbuds ranked this way captured
the default output and input on every self-reconnect, mid-call, forcing
the HFP codec.

Track the dragged UIDs in an armed set alongside the order; only armed
devices are hotplug or fallback candidates. Existing installs start
unarmed, so auto-switch stays dormant until a deliberate drag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pantafive pantafive merged commit b8a12a1 into main Jul 10, 2026
1 check passed
@pantafive pantafive deleted the fix/auto-switch-arming branch July 10, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-switch targets devices the user never chose and yanks audio mid-call

1 participant