mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
ColorOS 16 accepts setStreamVolume from a backgrounded app and leaves the level where it was, so the conversation reaction ducked nothing. duckMusicVolume now classifies the outcome (Ducked / Unchanged / Skipped) instead of collapsing everything into a nullable duck, and a level that came back *higher* stays a skip: that is the user raising the volume between the two reads, not a refusal. On Unchanged the reaction requests AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK and lets the framework attenuate the other player. Teardown abandons the focus and, if the volume ended up below the pre-duck level anyway, restores it (guard for a device that applies the write asynchronously). The focus request is built by an injected factory because AudioFocusRequest.Builder is an unmocked stub in plain JVM unit tests.