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

Commit 49d60220 authored by xiaotonj's avatar xiaotonj
Browse files

Enter QuiescentBluetoothRoute first when audio disconnect BT at the end

of the call.

Currently we try to enter QuiescentBluetoothRoute after request to audio
disconnect BT devices. This will cause the BT_AUDIO_DISCONNECTED coming
in when the state machine still in ActiveBluetoothRoute and we
mistakenly enter to earpiece route after the call even if the BT device
still connected to the phone.

Bug: b/306113816
Test: CallAudioRouteStateMachineTest
Change-Id: I57410e507e239b64470706c6ca59078c9eb84bdd
parent 9d1f1629
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -13,3 +13,10 @@ flag {
  description: "Ensure that the audio mode is updated anytime the foreground call changes."
  bug: "289861657"
}

flag {
  name: "transit_route_before_audio_disconnect_bt"
  namespace: "telecom"
  description: "Fix audio route transition issue on call disconnection when bt audio connected."
  bug: "306113816"
}
+19 −8
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
@@ -45,6 +44,7 @@ import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
import com.android.server.telecom.bluetooth.BluetoothRouteManager;
import com.android.server.telecom.flags.FeatureFlags;

import java.util.Collection;
import java.util.HashMap;
@@ -85,7 +85,8 @@ public class CallAudioRouteStateMachine extends StateMachine {
                CallAudioManager.AudioServiceFactory audioServiceFactory,
                int earpieceControl,
                Executor asyncTaskExecutor,
                CallAudioCommunicationDeviceTracker communicationDeviceTracker) {
                CallAudioCommunicationDeviceTracker communicationDeviceTracker,
                FeatureFlags featureFlags) {
            return new CallAudioRouteStateMachine(context,
                    callsManager,
                    bluetoothManager,
@@ -94,7 +95,8 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    audioServiceFactory,
                    earpieceControl,
                    asyncTaskExecutor,
                    communicationDeviceTracker);
                    communicationDeviceTracker,
                    featureFlags);
        }
    }
    /** Values for CallAudioRouteStateMachine constructor's earPieceRouting arg. */
@@ -918,8 +920,13 @@ public class CallAudioRouteStateMachine extends StateMachine {
                case SWITCH_FOCUS:
                    if (msg.arg1 == NO_FOCUS) {
                        // Only disconnect audio here instead of routing away from BT entirely.
                        if (mFeatureFlags.transitRouteBeforeAudioDisconnectBt()) {
                            transitionTo(mQuiescentBluetoothRoute);
                            mBluetoothRouteManager.disconnectAudio();
                        } else {
                            mBluetoothRouteManager.disconnectAudio();
                            transitionTo(mQuiescentBluetoothRoute);
                        }
                        mCallAudioManager.notifyAudioOperationsComplete();
                    } else if (msg.arg1 == RINGING_FOCUS
                            && !mBluetoothRouteManager.isInbandRingingEnabled()) {
@@ -1548,6 +1555,7 @@ public class CallAudioRouteStateMachine extends StateMachine {

    private CallAudioManager mCallAudioManager;
    private CallAudioCommunicationDeviceTracker mCommunicationDeviceTracker;
    private FeatureFlags mFeatureFlags;

    public CallAudioRouteStateMachine(
            Context context,
@@ -1558,7 +1566,8 @@ public class CallAudioRouteStateMachine extends StateMachine {
            CallAudioManager.AudioServiceFactory audioServiceFactory,
            int earpieceControl,
            Executor asyncTaskExecutor,
            CallAudioCommunicationDeviceTracker communicationDeviceTracker) {
            CallAudioCommunicationDeviceTracker communicationDeviceTracker,
            FeatureFlags featureFlags) {
        super(NAME);
        mContext = context;
        mCallsManager = callsManager;
@@ -1570,6 +1579,7 @@ public class CallAudioRouteStateMachine extends StateMachine {
        mLock = callsManager.getLock();
        mAsyncTaskExecutor = asyncTaskExecutor;
        mCommunicationDeviceTracker = communicationDeviceTracker;
        mFeatureFlags = featureFlags;
        createStates(earpieceControl);
    }

@@ -1582,7 +1592,8 @@ public class CallAudioRouteStateMachine extends StateMachine {
            StatusBarNotifier statusBarNotifier,
            CallAudioManager.AudioServiceFactory audioServiceFactory,
            int earpieceControl, Looper looper, Executor asyncTaskExecutor,
            CallAudioCommunicationDeviceTracker communicationDeviceTracker) {
            CallAudioCommunicationDeviceTracker communicationDeviceTracker,
            FeatureFlags featureFlags) {
        super(NAME, looper);
        mContext = context;
        mCallsManager = callsManager;
@@ -1594,7 +1605,7 @@ public class CallAudioRouteStateMachine extends StateMachine {
        mLock = callsManager.getLock();
        mAsyncTaskExecutor = asyncTaskExecutor;
        mCommunicationDeviceTracker = communicationDeviceTracker;

        mFeatureFlags = featureFlags;
        createStates(earpieceControl);
    }

+2 −1
Original line number Diff line number Diff line
@@ -616,7 +616,8 @@ public class CallsManager extends Call.ListenerBase
                        audioServiceFactory,
                        CallAudioRouteStateMachine.EARPIECE_AUTO_DETECT,
                        asyncCallAudioTaskExecutor,
                        communicationDeviceTracker
                        communicationDeviceTracker,
                        featureFlags
                );
        callAudioRouteStateMachine.initialize();

+127 −45
Original line number Diff line number Diff line
@@ -16,12 +16,31 @@

package com.android.server.telecom.tests;

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.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.media.IAudioService;
@@ -30,16 +49,16 @@ import android.telecom.CallAudioState;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;

import com.android.server.telecom.CallAudioCommunicationDeviceTracker;
import com.android.server.telecom.bluetooth.BluetoothRouteManager;
import com.android.server.telecom.Call;
import com.android.server.telecom.CallAudioCommunicationDeviceTracker;
import com.android.server.telecom.CallAudioManager;
import com.android.server.telecom.CallAudioRouteStateMachine;
import com.android.server.telecom.CallsManager;
import com.android.server.telecom.ConnectionServiceWrapper;
import com.android.server.telecom.CallAudioManager;
import com.android.server.telecom.StatusBarNotifier;
import com.android.server.telecom.TelecomSystem;
import com.android.server.telecom.WiredHeadsetManager;
import com.android.server.telecom.bluetooth.BluetoothRouteManager;

import org.junit.After;
import org.junit.Before;
@@ -60,26 +79,6 @@ import java.util.HashSet;
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.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(JUnit4.class)
public class CallAudioRouteStateMachineTest extends TelecomTestCase {

@@ -137,6 +136,7 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
        when(fakeSelfManagedCall.isAlive()).thenReturn(true);
        when(fakeSelfManagedCall.getSupportedAudioRoutes()).thenReturn(CallAudioState.ROUTE_ALL);
        when(fakeSelfManagedCall.isSelfManaged()).thenReturn(true);
        when(mFeatureFlags.transitRouteBeforeAudioDisconnectBt()).thenReturn(false);

        doNothing().when(mockConnectionServiceWrapper).onCallAudioStateChanged(any(Call.class),
                any(CallAudioState.class));
@@ -163,7 +163,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_AUTO_DETECT,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);

        // Since we don't know if we're on a platform with an earpiece or not, all we can do
        // is ensure the stateMachine construction didn't fail.  But at least we exercised the
@@ -184,7 +185,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_AUTO_DETECT,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        Set<Call> trackedCalls = new HashSet<>(Arrays.asList(fakeCall, fakeSelfManagedCall));
@@ -231,7 +233,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_AUTO_DETECT,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        Set<Call> trackedCalls = new HashSet<>(Arrays.asList(fakeCall, fakeSelfManagedCall));
@@ -282,7 +285,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);
        CallAudioState initState = new CallAudioState(false, CallAudioState.ROUTE_SPEAKER,
                CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_SPEAKER);
@@ -328,7 +332,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);

        when(mockBluetoothRouteManager.isBluetoothAudioConnectedOrPending()).thenReturn(false);
        when(mockBluetoothRouteManager.isBluetoothAvailable()).thenReturn(true);
@@ -375,7 +380,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        when(mockBluetoothRouteManager.isBluetoothAudioConnectedOrPending()).thenReturn(false);
@@ -421,7 +427,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);
        Collection<BluetoothDevice> availableDevices = Collections.singleton(bluetoothDevice1);

@@ -501,7 +508,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        when(mockBluetoothRouteManager.isBluetoothAudioConnectedOrPending()).thenReturn(false);
@@ -539,7 +547,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);
        setInBandRing(false);
        when(mockBluetoothRouteManager.isBluetoothAudioConnectedOrPending()).thenReturn(false);
@@ -599,7 +608,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);
        List<BluetoothDevice> availableDevices =
                Arrays.asList(bluetoothDevice1, bluetoothDevice2, bluetoothDevice3);
@@ -635,7 +645,69 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                bluetoothDevice2,
                availableDevices);

        verifyNewSystemCallAudioState(initState, expectedEndState);
        assertEquals(expectedEndState, stateMachine.getCurrentCallAudioState());
    }

    @SmallTest
    @Test
    public void testCallDisconnectedWhenAudioRoutedToBluetooth() {
        CallAudioRouteStateMachine stateMachine = new CallAudioRouteStateMachine(
                mContext,
                mockCallsManager,
                mockBluetoothRouteManager,
                mockWiredHeadsetManager,
                mockStatusBarNotifier,
                mAudioServiceFactory,
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);
        List<BluetoothDevice> availableDevices = Arrays.asList(bluetoothDevice1);

        when(mockAudioManager.isSpeakerphoneOn()).thenReturn(false);
        when(mockBluetoothRouteManager.isBluetoothAudioConnectedOrPending()).thenReturn(false);
        when(mockBluetoothRouteManager.isBluetoothAvailable()).thenReturn(true);
        when(mockBluetoothRouteManager.getConnectedDevices()).thenReturn(availableDevices);
        when(mockBluetoothRouteManager.isInbandRingingEnabled()).thenReturn(true);
        when(mFeatureFlags.transitRouteBeforeAudioDisconnectBt()).thenReturn(true);
        doAnswer(invocation -> {
            when(mockBluetoothRouteManager.getBluetoothAudioConnectedDevice())
                    .thenReturn(bluetoothDevice1);
            stateMachine.sendMessageWithSessionInfo(CallAudioRouteStateMachine.BT_AUDIO_CONNECTED);
            return null;
        }).when(mockBluetoothRouteManager).connectBluetoothAudio(bluetoothDevice1.getAddress());
        doAnswer(invocation -> {
            when(mockBluetoothRouteManager.getBluetoothAudioConnectedDevice())
                    .thenReturn(bluetoothDevice1);
            stateMachine.sendMessageWithSessionInfo(
                    CallAudioRouteStateMachine.BT_AUDIO_DISCONNECTED);
            return null;
        }).when(mockBluetoothRouteManager).disconnectAudio();

        CallAudioState initState = new CallAudioState(false, CallAudioState.ROUTE_BLUETOOTH,
                CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH, null,
                availableDevices);
        stateMachine.initialize(initState);

        stateMachine.sendMessageWithSessionInfo(CallAudioRouteStateMachine.SWITCH_FOCUS,
                CallAudioRouteStateMachine.ACTIVE_FOCUS);
        waitForHandlerAction(stateMachine.getHandler(), TEST_TIMEOUT);

        stateMachine.sendMessageWithSessionInfo(CallAudioRouteStateMachine.SWITCH_FOCUS,
                CallAudioRouteStateMachine.NO_FOCUS, bluetoothDevice1.getAddress());
        waitForHandlerAction(stateMachine.getHandler(), TEST_TIMEOUT);

        verify(mockBluetoothRouteManager).disconnectAudio();
        waitForHandlerAction(stateMachine.getHandler(), TEST_TIMEOUT);
        CallAudioState expectedEndState = new CallAudioState(false,
                CallAudioState.ROUTE_BLUETOOTH,
                CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH,
                bluetoothDevice1,
                availableDevices);

        assertEquals(expectedEndState, stateMachine.getCurrentCallAudioState());
    }

    @SmallTest
@@ -651,7 +723,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);
        when(mockAudioManager.isSpeakerphoneOn()).thenReturn(false);
        CallAudioState initState = new CallAudioState(false, CallAudioState.ROUTE_SPEAKER,
@@ -684,7 +757,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        when(mockAudioManager.isSpeakerphoneOn()).thenReturn(false);
@@ -720,7 +794,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);
        List<BluetoothDevice> availableDevices =
                Arrays.asList(bluetoothDevice1, bluetoothDevice2);
@@ -774,7 +849,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        AudioDeviceInfo earpiece = mock(AudioDeviceInfo.class);
@@ -842,7 +918,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        // Start the route in quiescent and ensure that a switch to ACTIVE_FOCUS transitions to
@@ -947,7 +1024,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.initialize();
        assertEquals(expectedState, stateMachine.getCurrentCallAudioState());
    }
@@ -965,7 +1043,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        CallAudioState initState = new CallAudioState(false, CallAudioState.ROUTE_EARPIECE,
@@ -1002,7 +1081,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        CallAudioState initState = new CallAudioState(false, CallAudioState.ROUTE_SPEAKER,
@@ -1046,7 +1126,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                earpieceControl,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.initialize();
        assertEquals(expectedState, stateMachine.getCurrentCallAudioState());
    }
@@ -1098,7 +1179,8 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
                CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
                mThreadHandler.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        AudioDeviceInfo headset = mock(AudioDeviceInfo.class);
+4 −2
Original line number Diff line number Diff line
@@ -276,7 +276,8 @@ public class CallAudioRouteTransitionTests extends TelecomTestCase {
                mParams.earpieceControl,
                mHandlerThread.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        setupMocksForParams(stateMachine, mParams);
@@ -374,7 +375,8 @@ public class CallAudioRouteTransitionTests extends TelecomTestCase {
                mParams.earpieceControl,
                mHandlerThread.getLooper(),
                Runnable::run /** do async stuff sync for test purposes */,
                mCommunicationDeviceTracker);
                mCommunicationDeviceTracker,
                mFeatureFlags);
        stateMachine.setCallAudioManager(mockCallAudioManager);

        // Set up bluetooth and speakerphone state
Loading