fix(android): polling tick track update is forward-only so user Next isn't undone
android / Build + lint + test (push) Successful in 3m27s

This commit is contained in:
2026-06-04 06:50:35 -04:00
parent 36054506c2
commit cacb280832
@@ -525,7 +525,11 @@ class PlayerController @Inject constructor(
val newPos = effectivePosition.coerceAtLeast(0)
val newDur = effectiveDuration(upnpActive, remoteState.durationMs, controller.duration)
val newBuf = controller.bufferedPosition.coerceAtLeast(0)
val trackChanged = desiredIdx != current.queueIndex && desiredIdx in queueRefs.indices
// Forward-only. If desiredIdx < queueIndex, the user just pressed Next
// and Sonos's poll hasn't caught up yet -- walking backward would undo
// their press (logcat 2026-06-04 showed exactly that jump-back-then-
// forward cycle). Mirrors maybeSyncLocalCursor's forward-only policy.
val trackChanged = desiredIdx > current.queueIndex && desiredIdx in queueRefs.indices
val somethingChanged = trackChanged ||
current.isPlaying != effectiveIsPlaying ||
current.positionMs != newPos ||