Skip to content

Rewrite connection handling with per-device volume ownership#206

Merged
d4rken merged 8 commits intomainfrom
connection-handling-rewrite
Apr 14, 2026
Merged

Rewrite connection handling with per-device volume ownership#206
d4rken merged 8 commits intomainfrom
connection-handling-rewrite

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented Apr 14, 2026

Summary

Introduces a central AudioStreamOwnerRegistry that tracks which device group owns shared audio streams, replacing the previous broadcast-to-all approach. This ensures volumes are only applied to the correct device when multiple Bluetooth devices are connected simultaneously.

  • Add AudioStreamOwnerRegistry with device grouping (Samsung Buds L+R pair within 10s window), ownership resolution (latest connection wins, fresh > bootstrap, real > speaker fallback), and stale disconnect protection
  • Rewrite EventDispatcher with fast acceptance lane (ownership updated synchronously before async module launch), per-address job supersession, and displaced owner cancellation when ownership transfers
  • Make VolumeDisconnectModule non-cancellable so disconnect volume saves survive fast reconnects
  • Add ownership-aware filtering to VolumeUpdateModule, VolumeLockModule, VolumeRateLimiterModule, and RingerModeTransitionHandler
  • Fix dashboard slider jump from percent-level-percent round-trip drift
  • Fix device rename crash on Android 13+ without CDM association
  • Fix ownership registry not resetting when monitoring toggle is cycled

Testing

  • 116 unit tests across AudioStreamOwnerRegistryTest, EventDispatcherTest, BaseVolumeModuleTest, VolumeDisconnectModuleTest, VolumeLockModuleTest, VolumeUpdateModuleTest, VolumeRateLimiterModuleTest, and others
  • Manual QA on Pixel 7a with two sets of AirPods: single/dual connect-disconnect cycles, simultaneous disconnect, ownership handoff, bootstrap recovery, enabled toggle reset

@d4rken d4rken merged commit b991f87 into main Apr 14, 2026
10 checks passed
@d4rken d4rken deleted the connection-handling-rewrite branch April 14, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant