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

Commit 4833c1bd authored by Sal Savage's avatar Sal Savage Committed by Automerger Merge Worker
Browse files

Only trigger a metadata sync if we don't have any cover artwork am: e085eb6f

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Bluetooth/+/11922314

Change-Id: I32bacf32c5bcee78a028b11fa65f8bc68668308d
parents 3b7b0a7c e085eb6f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -167,6 +167,16 @@ public class AvrcpControllerService extends ProfileService {
        return new AvrcpControllerStateMachine(device, this);
    }

    protected void getCurrentMetadataIfNoCoverArt(BluetoothDevice device) {
        if (device == null) return;
        AvrcpControllerStateMachine stateMachine = getStateMachine(device);
        if (stateMachine == null) return;
        AvrcpItem track = stateMachine.getCurrentTrack();
        if (track != null && track.getCoverArtLocation() == null) {
            getCurrentMetadataNative(Utils.getByteAddress(device));
        }
    }

    private void refreshContents(BrowseTree.BrowseNode node) {
        BluetoothDevice device = node.getDevice();
        if (device == null) {
+7 −0
Original line number Diff line number Diff line
@@ -207,6 +207,13 @@ class AvrcpControllerStateMachine extends StateMachine {
        sendMessage(DISCONNECT);
    }

    /**
     * Get the current playing track
     */
    public AvrcpItem getCurrentTrack() {
        return mAddressedPlayer.getCurrentTrack();
    }

    /**
     * Dump the current State Machine to the string builder.
     *
+2 −4
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@ import android.net.Uri;
import android.os.SystemProperties;
import android.util.Log;

import com.android.bluetooth.Utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@@ -284,8 +282,8 @@ public class AvrcpCoverArtManager {
                mCoverArtStorage.removeImagesForDevice(mDevice);

                // Once we're connected fetch the current metadata again in case the target has an
                // image handle they can now give us
                mService.getCurrentMetadataNative(Utils.getByteAddress(mDevice));
                // image handle they can now give us. Only do this if we don't already have one.
                mService.getCurrentMetadataIfNoCoverArt(mDevice);
            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                AvrcpBipClient client = getClient(mDevice);
                boolean shouldReconnect = (client != null);