Update song position correctly
Some media players such as spotify update song position to -1.
But some vendors such as Audi can not update song position until
reconnection when receiving 0xFFFFFFFF.
Actually it is a possible number according to AVRCP SPEC but it causes
problems on the market.
Bug: 204097819
Fix: 204097819
Tag: #feature
Test: Build
Change-Id: I17c2069a27c3c1a902176a2cd013dd1ba36be78d
diff --git a/src/com/android/bluetooth/audio_util/helpers/PlayStatus.java b/src/com/android/bluetooth/audio_util/helpers/PlayStatus.java
index 922b151..75a760b 100644
--- a/src/com/android/bluetooth/audio_util/helpers/PlayStatus.java
+++ b/src/com/android/bluetooth/audio_util/helpers/PlayStatus.java
@@ -31,7 +31,7 @@
static final byte REV_SEEK = 4;
static final byte ERROR = -1;
- public long position = 0xFFFFFFFFFFFFFFFFL;
+ public long position = 0;
public long duration = 0x00L;
public byte state = STOPPED;
@@ -41,7 +41,7 @@
if (state == null) return ret;
ret.state = playbackStateToAvrcpState(state.getState());
- ret.position = state.getPosition();
+ ret.position = (state.getPosition() > 0) ? state.getPosition() : 0;
ret.duration = duration;
return ret;
}