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

Commit 1636ca0c authored by Sal Savage's avatar Sal Savage
Browse files

Add additional debugging output for available and addressed player status

Tag: #stability
Bug: 187107189
Test: atest BluetoothInstrumentationTests
Change-Id: If8d6a4e67f41db8b6d78dc3d46b08e89817b0764
parent fb862d0d
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.media.MediaBrowserCompat.MediaItem;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.Log;
@@ -226,6 +227,22 @@ class AvrcpControllerStateMachine extends StateMachine {
        ProfileService.println(sb, "isActive: " + isActive());
        ProfileService.println(sb, "Control: " + mRemoteControlConnected);
        ProfileService.println(sb, "Browsing: " + mBrowsingConnected);

        ProfileService.println(sb, "Addressed Player ID: " + mAddressedPlayerId);
        ProfileService.println(sb, "Available Players (" + mAvailablePlayerList.size() + "): ");
        for (int i = 0; i < mAvailablePlayerList.size(); i++) {
            AvrcpPlayer player = mAvailablePlayerList.valueAt(i);
            boolean isAddressed = (player.getId() == mAddressedPlayerId);
            ProfileService.println(sb, "\t" + (isAddressed ? "(Addressed) " : "") + player);
        }

        List<MediaItem> queue = null;
        if (mBrowseTree.mNowPlayingNode != null) {
            queue = mBrowseTree.mNowPlayingNode.getContents();
        }
        ProfileService.println(sb, "Current Track: " + mAddressedPlayer.getCurrentTrack());
        ProfileService.println(sb, "Playback State: " + mAddressedPlayer.getPlaybackState());
        ProfileService.println(sb, "Queue (" + (queue == null ? 0 : queue.size()) + "): " + queue);
    }

    @VisibleForTesting
+3 −2
Original line number Diff line number Diff line
@@ -240,8 +240,9 @@ public class AvrcpItem {
    public String toString() {
        return "AvrcpItem{mUuid=" + mUuid + ", mUid=" + mUid + ", mItemType=" + mItemType
                + ", mType=" + mType + ", mDisplayableName=" + mDisplayableName
                + ", mTitle=" + mTitle + ", mPlayable=" + mPlayable + ", mBrowsable="
                + mBrowsable + ", mCoverArtHandle=" + getCoverArtHandle()
                + ", mTitle=" + mTitle + " mPlayingTime=" + mPlayingTime + " mTrack="
                + mTrackNumber + "/" + mTotalNumberOfTracks + ", mPlayable=" + mPlayable
                + ", mBrowsable=" + mBrowsable + ", mCoverArtHandle=" + getCoverArtHandle()
                + ", mImageUuid=" + mImageUuid + ", mImageUri" + mImageUri + "}";
    }

+6 −0
Original line number Diff line number Diff line
@@ -238,4 +238,10 @@ class AvrcpPlayer {

        if (DBG) Log.d(TAG, "Supported Actions = " + mAvailableActions);
    }

    @Override
    public String toString() {
        return "<AvrcpPlayer id=" + mId + " name=" + mName + " track=" + mCurrentTrack
                + " play_status=" + mPlayStatus + ">";
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -434,7 +434,14 @@ public class AvrcpControllerStateMachineTest {
                + "(null) name=AvrcpControllerStateMachine state=Disconnected\n"
                + "  isActive: true\n"
                + "  Control: false\n"
                + "  Browsing: false\n");
                + "  Browsing: false\n"
                + "  Addressed Player ID: -1\n"
                + "  Available Players (0): \n"
                + "  Current Track: null\n"
                + "  Playback State: PlaybackState {state=0, position=0, buffered position=0, "
                + "speed=0.0, updated=0, actions=16439, error code=0, error message=null, custom "
                + "actions=[], active item id=-1}\n"
                + "  Queue (0): null\n");
    }

    /**