Skip to content

Commit 04b635f

Browse files
eriedclaude
andcommitted
fix(automation): media control only acts on a live wheel connection
A disconnected wheel reports 0 speed, which trips the pause threshold and would stop your music the moment you walk off with the phone. Guard media control on ConnectionState.CONNECTED, matching the wheel-lock automation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GADLyChheAoMX9dQbRgRnH
1 parent 1ebe924 commit 04b635f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/src/main/java/com/eried/eucplanet/service/AutomationManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ class AutomationManager @Inject constructor(
252252
* stopped.
253253
*/
254254
private fun evaluateMediaControl(settings: AppSettings) {
255+
// Only act on a live wheel connection. A disconnected wheel reports 0 speed,
256+
// which would otherwise pause your music the moment you walk off with the phone.
257+
if (wheelRepository.connectionState.value != ConnectionState.CONNECTED) {
258+
mediaPauseCandidateSinceMs = 0L
259+
mediaResumeCandidateSinceMs = 0L
260+
return
261+
}
255262
val mc = settings.mediaControl
256263
val speed = wheelRepository.wheelData.value.speed.absoluteValue
257264
val now = System.currentTimeMillis()

0 commit comments

Comments
 (0)