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

Commit a45e9d30 authored by Grace Jia's avatar Grace Jia Committed by Android (Google) Code Review
Browse files

Merge "Fallback to QuiescentBluetoothRoute when abandon focus from ActiveBluetoothRoute."

parents 9d857d2c f20a256b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -918,7 +918,7 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    if (msg.arg1 == NO_FOCUS) {
                        // Only disconnect audio here instead of routing away from BT entirely.
                        mBluetoothRouteManager.disconnectAudio();
                        reinitialize();
                        transitionTo(mQuiescentBluetoothRoute);
                        mCallAudioManager.notifyAudioOperationsComplete();
                    } else if (msg.arg1 == RINGING_FOCUS
                            && !mBluetoothRouteManager.isInbandRingingEnabled()) {
+11 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import java.util.List;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
@@ -694,6 +695,16 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
        verify(mockBluetoothRouteManager, atLeastOnce())
                .connectBluetoothAudio(eq(bluetoothDevice1.getAddress()));
        assertTrue(stateMachine.isInActiveState());

        // Switch to inactive, pretending that the call disconnected.
        stateMachine.sendMessageWithSessionInfo(CallAudioRouteStateMachine.SWITCH_FOCUS,
                CallAudioRouteStateMachine.NO_FOCUS);
        waitForHandlerAction(stateMachine.getHandler(), TEST_TIMEOUT);

        // Make sure that we've successfully switched to the quiescent BT route
        assertEquals(CallAudioState.ROUTE_BLUETOOTH,
                stateMachine.getCurrentCallAudioState().getRoute());
        assertFalse(stateMachine.isInActiveState());
    }

    @SmallTest