Skip to content

General: Add Quick Settings tile for noise control#574

Merged
d4rken merged 1 commit into
mainfrom
feat/anc-quick-settings-tile
May 3, 2026
Merged

General: Add Quick Settings tile for noise control#574
d4rken merged 1 commit into
mainfrom
feat/anc-quick-settings-tile

Conversation

@d4rken

@d4rken d4rken commented May 3, 2026

Copy link
Copy Markdown
Member

What changed

Adds a Quick Settings tile that cycles AirPods noise control modes (Off / Transparency / Adaptive / Noise Cancellation) right from the system swipe-down panel — no need to open the app.

The tile auto-targets the user's primary device (system-connected first, then most recently seen). Each tap advances to the next available mode; rapid taps coalesce into a single command 1 s after the last tap, so the AirPods don't choke on a burst.

Pro-required, Bluetooth-off, no-device, and connecting states are surfaced honestly — the tile never claims to be ready when it isn't.

Technical Context

  • State holder is process-scoped (@Singleton AncTileStateStore) instead of per-TileService-instance: services are destroyed between panel sessions, so per-instance state forced the first tap of each session to await a hot flow emission — that produced a perceptible 500 ms hang on every panel reopen.
  • Send coordinator is also @Singleton with per-address debounced Jobs. Without process-scoped coalescing, taps across consecutive panel sessions each fired their own SetAncMode, overwhelming AAP verification and triggering "Rejected after retry" cascades that left the device unresponsive until app restart.
  • Optimistic UI overlay: the device echoes ANC changes back through AAP → BLE → DeviceMonitor, a multi-hundred-ms round trip. Without an overlay, the icon doesn't move until the echo arrives and cycling feels laggy. Pipeline is split — applyPendingTarget is pure (read-only overlay), acknowledgeDeviceState is the side-effecting clear, called from a dedicated collector.
  • 5 s safety timeout in the coordinator covers the rare case where AAP never propagates the in-flight pendingAncMode (e.g. socket dropped before the debounced send fires) — otherwise a failed send would freeze the optimistic overlay.
  • Reuses device.visibleAncModes so the tile honours "Allow Off" + Listening Mode Cycle the same way the home-screen widget does, no separate filtering logic.
  • PodDeviceTier extracted so tile and overview agree on "primary device" via a single comparator.

Closes #573

@d4rken d4rken added the enhancement Add a new feature of improve an existing feature label May 3, 2026
@d4rken d4rken merged commit acc6e92 into main May 3, 2026
11 checks passed
@d4rken d4rken deleted the feat/anc-quick-settings-tile branch May 3, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Add a new feature of improve an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quick settings tile for quickly switching between passthrough, adaptive and ANC

1 participant