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

Commit 2158d736 authored by Joseph Pirozzo's avatar Joseph Pirozzo Committed by Automerger Merge Worker
Browse files

Merge changes I355e8244,Iac6ebeca into rvc-dev am: cc8f6dc4 am: 67c60eb9

Change-Id: Ief69f39c93e9fb9c91a678ee53411bdafed9987e
parents 44d9cfd7 67c60eb9
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -668,11 +668,18 @@ public class AvrcpControllerStateMachineTest {
        secondAvrcpStateMachine.start();
        Assert.assertFalse(mAvrcpStateMachine.isActive());

        // Connect device 1 and 2 and verify first one is set as active
        // Connect device 1 and 2 and verify second one is set as active
        setUpConnectedState(true, true);
        secondAvrcpStateMachine.connect(StackEvent.connectionStateChanged(true, true));
        TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper());
        Assert.assertTrue(mAvrcpStateMachine.isActive());
        Assert.assertFalse(secondAvrcpStateMachine.isActive());

        secondAvrcpStateMachine.connect(StackEvent.connectionStateChanged(true, true));
        TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper());
        TestUtils.waitForLooperToFinishScheduledTask(secondAvrcpStateMachine.getHandler()
                .getLooper());

        Assert.assertFalse(mAvrcpStateMachine.isActive());
        Assert.assertTrue(secondAvrcpStateMachine.isActive());

        // Request the second device to play an item and verify active device switched
        BrowseTree.BrowseNode results = mAvrcpStateMachine.findNode(rootName);
+6 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;

import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.Utils;

import org.hamcrest.core.AllOf;
@@ -96,6 +97,7 @@ public class HeadsetClientStateMachineTest {
                new HeadsetClientStateMachine(mHeadsetClientService, mHandlerThread.getLooper(),
                                              mNativeInterface);
        mHeadsetClientStateMachine.start();
        TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper());
    }

    @After
@@ -103,6 +105,7 @@ public class HeadsetClientStateMachineTest {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_hfpclient)) {
            return;
        }
        TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper());
        mHeadsetClientStateMachine.doQuit();
        mHandlerThread.quit();
    }
@@ -292,10 +295,11 @@ public class HeadsetClientStateMachineTest {
                        -1));
        Assert.assertEquals(true, mHeadsetClientStateMachine.getInBandRing());


        // Simulate a new incoming phone call
        StackEvent eventCallStatusUpdated = new StackEvent(StackEvent.EVENT_TYPE_CLIP);
        TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper());
        mHeadsetClientStateMachine.sendMessage(StackEvent.STACK_EVENT, eventCallStatusUpdated);
        TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper());
        verify(mHeadsetClientService, timeout(STANDARD_WAIT_MILLIS).times(3)).sendBroadcast(
                intentArgument.capture(),
                anyString());
@@ -319,11 +323,11 @@ public class HeadsetClientStateMachineTest {
        StackEvent eventCommandStatus = new StackEvent(StackEvent.EVENT_TYPE_CMD_RESULT);
        eventCommandStatus.valueInt = AT_OK;
        mHeadsetClientStateMachine.sendMessage(StackEvent.STACK_EVENT, eventCommandStatus);
        TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper());
        verify(mHeadsetClientService, timeout(QUERY_CURRENT_CALLS_TEST_WAIT_MILLIS).times(4))
                .sendBroadcast(
                intentArgument.capture(),
                anyString());

        // Verify that the new call is being registered with the inBandRing flag set.
        Assert.assertEquals(true,
                ((BluetoothHeadsetClientCall) intentArgument.getValue().getParcelableExtra(