Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad29149d authored by Zhihai Xu's avatar Zhihai Xu
Browse files

fix incorrect track position reported from BT AVRCP

when music player continuously update playing state
with invalid play postion -1 during playing,
The track postion are not changed correcly.

bug:11377223
Change-Id: Ie4cecfe7757cb92fc96ea49a7442a9d0bd9fc63a
parent 761334b2
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -464,13 +464,15 @@ final class Avrcp {
            mCurrentPosMs = getPlayPosition();
        }

        mCurrentPlayState = state;
        if (currentPosMs != RemoteControlClient.PLAYBACK_POSITION_INVALID) {
            mCurrentPosMs = currentPosMs;
        }
        if (state == RemoteControlClient.PLAYSTATE_PLAYING) {
        if ((state == RemoteControlClient.PLAYSTATE_PLAYING) &&
            ((currentPosMs != RemoteControlClient.PLAYBACK_POSITION_INVALID) ||
            (mCurrentPlayState != RemoteControlClient.PLAYSTATE_PLAYING))) {
            mPlayStartTimeMs = SystemClock.elapsedRealtime();
        }
        mCurrentPlayState = state;

        boolean newPosValid = (mCurrentPosMs !=
                               RemoteControlClient.PLAYBACK_POSITION_ALWAYS_UNKNOWN);