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

Commit 3c43820f authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8994498 from 3ab118fd to tm-qpr1-release

Change-Id: I2d225fa8dd14f089b9dc4cf6f1deb9788c1fa1df
parents 3b4581d6 3ab118fd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -435,6 +435,7 @@ public class BluetoothDeviceManager {
            mAudioManager.clearCommunicationDevice();
            mLeAudioSetAsCommunicationDevice = false;
        }
        mLeAudioSetAsCommunicationDevice = false;
    }

    public void clearHearingAidCommunicationDevice() {
@@ -453,6 +454,7 @@ public class BluetoothDeviceManager {
            mAudioManager.clearCommunicationDevice();
            mHearingAidSetAsCommunicationDevice = false;
        }
        mHearingAidSetAsCommunicationDevice = false;
    }

    public boolean setLeAudioCommunicationDevice() {
+15 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothHearingAid;
import android.bluetooth.BluetoothLeAudio;
import android.bluetooth.BluetoothProfile;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
@@ -42,6 +41,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.ArgumentMatchers.nullable;
@@ -49,7 +49,6 @@ import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@@ -482,6 +481,20 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase {
        verify(mAdapter).setActiveDevice(device6, BluetoothAdapter.ACTIVE_DEVICE_ALL);
    }

    @SmallTest
    @Test
    public void testClearHearingAidCommunicationDevice() {
        List<AudioDeviceInfo> devices = new ArrayList<>();

        when(mockAudioManager.getAvailableCommunicationDevices())
                .thenReturn(devices);

        mBluetoothDeviceManager.setHearingAidCommunicationDevice();
        when(mockAudioManager.getCommunicationDevice()).thenReturn(null);
        mBluetoothDeviceManager.clearHearingAidCommunicationDevice();
        assertFalse(mBluetoothDeviceManager.isHearingAidSetAsCommunicationDevice());
    }

    private Intent buildConnectionActionIntent(int state, BluetoothDevice device, int deviceType) {
        String intentString;