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

Commit 8af38022 authored by Joseph Pirozzo's avatar Joseph Pirozzo Committed by android-build-merger
Browse files

Merge "AVRCP Controller State without Browsing" am: 258dc6b9

am: a11f52d8

Change-Id: Id9ade05370c6b9c10a5f5c1e626b14dbc0812f41
parents e0cec887 a11f52d8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -223,7 +223,6 @@ class AvrcpControllerStateMachine extends StateMachine {
        mService.sBrowseTree.mRootNode.addChild(mBrowseTree.mRootNode);
        BluetoothMediaBrowserService.notifyChanged(mService
                .sBrowseTree.mRootNode);
        BluetoothMediaBrowserService.notifyChanged(mAddressedPlayer.getPlaybackState());
        mBrowsingConnected = true;
    }

@@ -233,12 +232,10 @@ class AvrcpControllerStateMachine extends StateMachine {
        mAddressedPlayer.updateCurrentTrack(null);
        mBrowseTree.mNowPlayingNode.setCached(false);
        BluetoothMediaBrowserService.notifyChanged(mBrowseTree.mNowPlayingNode);
        BluetoothMediaBrowserService.addressedPlayerChanged(null);
        mService.sBrowseTree.mRootNode.removeChild(
                mBrowseTree.mRootNode);
        BluetoothMediaBrowserService.notifyChanged(mService
                .sBrowseTree.mRootNode);
        BluetoothMediaBrowserService.trackChanged(null);
        mBrowsingConnected = false;
    }

@@ -299,6 +296,7 @@ class AvrcpControllerStateMachine extends StateMachine {
        @Override
        public void enter() {
            if (mMostRecentState == BluetoothProfile.STATE_CONNECTING) {
                BluetoothMediaBrowserService.notifyChanged(mAddressedPlayer.getPlaybackState());
                broadcastConnectionStateChanged(BluetoothProfile.STATE_CONNECTED);
                BluetoothMediaBrowserService.addressedPlayerChanged(mSessionCallbacks);
            } else {
@@ -712,6 +710,8 @@ class AvrcpControllerStateMachine extends StateMachine {
        @Override
        public void enter() {
            onBrowsingDisconnected();
            BluetoothMediaBrowserService.trackChanged(null);
            BluetoothMediaBrowserService.addressedPlayerChanged(null);
            broadcastConnectionStateChanged(BluetoothProfile.STATE_DISCONNECTING);
            transitionTo(mDisconnected);
        }
+17 −0
Original line number Diff line number Diff line
@@ -151,6 +151,10 @@ public class AvrcpControllerStateMachineTest {
                IsInstanceOf.instanceOf(AvrcpControllerStateMachine.Disconnected.class));
        Assert.assertEquals(mAvrcpStateMachine.getState(), BluetoothProfile.STATE_DISCONNECTED);
        verify(mAvrcpControllerService).removeStateMachine(eq(mAvrcpStateMachine));
        MediaControllerCompat.TransportControls transportControls =
                BluetoothMediaBrowserService.getTransportControls();
        Assert.assertEquals(PlaybackStateCompat.STATE_ERROR,
                BluetoothMediaBrowserService.getPlaybackState());
    }

    /**
@@ -159,6 +163,11 @@ public class AvrcpControllerStateMachineTest {
    @Test
    public void testControlOnly() {
        int numBroadcastsSent = setUpConnectedState(true, false);
        MediaControllerCompat.TransportControls transportControls =
                BluetoothMediaBrowserService.getTransportControls();
        Assert.assertNotNull(transportControls);
        Assert.assertEquals(PlaybackStateCompat.STATE_NONE,
                BluetoothMediaBrowserService.getPlaybackState());
        StackEvent event =
                StackEvent.connectionStateChanged(false, false);
        mAvrcpStateMachine.disconnect();
@@ -176,6 +185,8 @@ public class AvrcpControllerStateMachineTest {
                IsInstanceOf.instanceOf(AvrcpControllerStateMachine.Disconnected.class));
        Assert.assertEquals(mAvrcpStateMachine.getState(), BluetoothProfile.STATE_DISCONNECTED);
        verify(mAvrcpControllerService).removeStateMachine(eq(mAvrcpStateMachine));
        Assert.assertEquals(PlaybackStateCompat.STATE_ERROR,
                BluetoothMediaBrowserService.getPlaybackState());
    }

    /**
@@ -186,6 +197,8 @@ public class AvrcpControllerStateMachineTest {
        Assert.assertEquals(0, mAvrcpControllerService.sBrowseTree.mRootNode.getChildrenCount());
        int numBroadcastsSent = setUpConnectedState(false, true);
        Assert.assertEquals(1, mAvrcpControllerService.sBrowseTree.mRootNode.getChildrenCount());
        Assert.assertEquals(PlaybackStateCompat.STATE_NONE,
                BluetoothMediaBrowserService.getPlaybackState());
        StackEvent event =
                StackEvent.connectionStateChanged(false, false);
        mAvrcpStateMachine.disconnect();
@@ -203,6 +216,10 @@ public class AvrcpControllerStateMachineTest {
                IsInstanceOf.instanceOf(AvrcpControllerStateMachine.Disconnected.class));
        Assert.assertEquals(mAvrcpStateMachine.getState(), BluetoothProfile.STATE_DISCONNECTED);
        verify(mAvrcpControllerService).removeStateMachine(eq(mAvrcpStateMachine));
        MediaControllerCompat.TransportControls transportControls =
                BluetoothMediaBrowserService.getTransportControls();
        Assert.assertEquals(PlaybackStateCompat.STATE_ERROR,
                BluetoothMediaBrowserService.getPlaybackState());
    }

    /**