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

Commit a8971496 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

AVRCP: Cache queue in isMetadataSynced

getQueue() can be nullptr in the middile.

Test: manual
Bug: 170450741
Change-Id: I84e62a118a0bd1fd1f7d3059edb7791e4a0f26d4
parent 7dd8545e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -212,11 +212,12 @@ public class MediaPlayerWrapper {
     * Return whether the queue, metadata, and queueID are all in sync.
     */
    boolean isMetadataSynced() {
        if (getQueue() != null && getActiveQueueID() != -1) {
        List<MediaSession.QueueItem> queue = getQueue();
        if (queue != null && getActiveQueueID() != -1) {
            // Check if currentPlayingQueueId is in the current Queue
            MediaSession.QueueItem currItem = null;

            for (MediaSession.QueueItem item : getQueue()) {
            for (MediaSession.QueueItem item : queue) {
                if (item.getQueueId()
                        == getActiveQueueID()) { // The item exists in the current queue
                    currItem = item;