Skip to content

Device: Add media and noise-control stem gesture actions#526

Merged
d4rken merged 1 commit into
mainfrom
feat/press-controls-more-actions
Apr 17, 2026
Merged

Device: Add media and noise-control stem gesture actions#526
d4rken merged 1 commit into
mainfrom
feat/press-controls-more-actions

Conversation

@d4rken

@d4rken d4rken commented Apr 17, 2026

Copy link
Copy Markdown
Member

What changed

  • Adds six actions you can assign to AirPods stem gestures: Stop, Fast Forward, Rewind, Mute Music, Cycle Noise Control, Toggle Transparency.
  • Restores noise-control cycling on any gesture slot. Previously, assigning any long-press action stripped the stem's native ANC cycle; the new Cycle Noise Control action brings it back and can be placed on any press type (single / double / triple / long, either side).
  • Noise-control actions only appear on models that support them. The long-press warning about overriding ANC cycle hides automatically when long-press is mapped to the new cycle action.

Technical Context

  • StemAction migrates from a flat enum to a sealed interface with @Serializable @SerialName(…) data objects, so future parameterized actions can be added without another call-site sweep.
  • On-disk profiles reset once on first launch after upgrade (bare-string → discriminated-object wire form). Accepted because the app is currently on testing tracks only.
  • StemPressReaction intentionally does NOT inject DeviceMonitor — that would create a Hilt cycle via AapLifecycleManager. Instead it reads live AAP state from AapConnectionManager.allStates with a profile-learned-values fallback (same pattern StemConfigSender already uses).
  • The gesture cycle helper strictly honours resolvedAncCycleMask + allowOffOption?.enabled + pendingAncMode, so rapid repeat presses advance from the pending target rather than stale state, and the gesture cycle matches what the Noise Control dialog says.
  • ToggleAncTransparency is stateless: leaving Transparency prefers ON, falls back to ADAPTIVE, then OFF.
  • MuteToggle targets STREAM_MUSIC explicitly (not the currently-suggested stream) — intent is "mute my music", not "mute whatever Android routes next".
  • Capability gating for the dropdown derives from device?.model ?: profile?.model and is split per action: CycleAnc requires hasListeningModeCycle, ToggleAncTransparency requires hasAncControl. An already-configured action always stays visible inside its own dropdown row.

Review checklist

  • First launch after upgrade with existing profiles: profile container resets (expected on testing track)
  • On AirPods Pro 2 / Pro 3: Cycle Noise Control advances through the cycle configured in the Noise Control dialog, and respects "Allow Off"
  • On a model without hasListeningModeCycle: Cycle Noise Control is hidden from the dropdown; Toggle Transparency still appears if the model has ANC
  • Long-press info box hides when long-press is mapped to Cycle Noise Control; reappears for other long-press mappings
  • Mute Music mutes music playback specifically (not ringer / call audio)

Adds Stop, Fast Forward, Rewind, Mute, Cycle Noise Control, and Toggle Transparency as gesture targets. Migrates StemAction from enum to sealed interface with polymorphic serialization to unlock future parameterized actions. ANC actions are gated per-device capability and reuse the existing listening-mode cycle mask.
@d4rken d4rken added enhancement Add a new feature of improve an existing feature coms/AAP Uses Apples AirPod Protocol. Requires Android ROM with fixed L2CAP support on the Bluetooth sockets. labels Apr 17, 2026
@d4rken d4rken merged commit bba9155 into main Apr 17, 2026
6 of 10 checks passed
@d4rken d4rken deleted the feat/press-controls-more-actions branch April 17, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coms/AAP Uses Apples AirPod Protocol. Requires Android ROM with fixed L2CAP support on the Bluetooth sockets. enhancement Add a new feature of improve an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant