fix: arm auto-switch only for devices the user dragged#28
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.