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

Commit 7b6f845f authored by Pranav Madapurmath's avatar Pranav Madapurmath
Browse files

Resolve BluetoothRouteManagerTest failures

When the callAudioCommunicationDeviceRefactor flag is enabled, the
testConnectLeftHearingAidWhenLeftIsActive and
testConnectRightHearingAidWhenLeftIsActive tests were failing. They
weren't accounting for the state of the
CallAudioCommunicationDeviceTracker class in this case.

Bug: 394912267
Test: atest BluetoothRouteManagerTest
Flag: EXEMPT test fix
Change-Id: I60fca9cdf888f68867b9caa966728f845f0a027d
parent 9367abfc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.bluetooth.BluetoothLeAudio;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothStatusCodes;
import android.content.ContentResolver;
import android.media.AudioDeviceInfo;
import android.os.Parcel;
import android.telecom.Log;

@@ -104,6 +105,8 @@ public class BluetoothRouteManagerTest extends TelecomTestCase {
            BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID);
        when(mDeviceManager.connectAudio(anyString(), anyBoolean())).thenReturn(true);
        when(mDeviceManager.isHearingAidSetAsCommunicationDevice()).thenReturn(true);
        when(mCommunicationDeviceTracker.isAudioDeviceSetForType(
                eq(AudioDeviceInfo.TYPE_HEARING_AID))).thenReturn(true);

        setupConnectedDevices(null, HEARING_AIDS, null, null, HEARING_AIDS, null);
        when(mBluetoothHeadset.getAudioState(nullable(BluetoothDevice.class)))
@@ -130,7 +133,8 @@ public class BluetoothRouteManagerTest extends TelecomTestCase {
            BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID);
        when(mDeviceManager.connectAudio(anyString(), anyBoolean())).thenReturn(true);
        when(mDeviceManager.isHearingAidSetAsCommunicationDevice()).thenReturn(true);

        when(mCommunicationDeviceTracker.isAudioDeviceSetForType(
                eq(AudioDeviceInfo.TYPE_HEARING_AID))).thenReturn(true);

        setupConnectedDevices(null, HEARING_AIDS, null, null, HEARING_AIDS, null);
        when(mBluetoothHeadset.getAudioState(nullable(BluetoothDevice.class)))