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

Commit 1445d3ac authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

gmcs: Tolerate invalid track duration

If track duration is invalid or unknown, GMCS should handle it gracefully
and  not assume that player is invalid.

Bug: 273614474
Test: atest BluetoothInstrumentationTests
Tag: #feature
Change-Id: I4f47634d260104ceaf370211b8b642547e7a0c46
parent a87fbe48
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -1326,16 +1326,8 @@ public class MediaControlGattService implements MediaControlGattServiceInterface

        int mediaState = getMediaStateChar();
        if (mediaState != mCurrentMediaState.getValue()) {
            if ((getTrackDurationChar() == 0
                    || getTrackDurationChar() == TRACK_DURATION_UNAVAILABLE)) {
                // Set to INACTIVE if not set already
                if (mediaState != MediaState.INACTIVE.getValue()) {
                    updateMediaStateChar(MediaState.INACTIVE.getValue());
                }
            } else {
            updateMediaStateChar(mCurrentMediaState.getValue());
        }
        }

        if (stateFields.containsKey(PlayerStateField.SEEKING_SPEED)) {
            int playbackState = getMediaStateChar();