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

Commit bb23d0f5 authored by jasonwshsu's avatar jasonwshsu Committed by Jason Hsu
Browse files

Clean up logic to not support 'ASHA' profile for 'Spatial Audio'

* SpatializerHelper in audio framework already not support TYPE_HEARING_AID, just clean up logic in settingslib to be consistent.

Bug: 409467374
Bug: 423515256
Test: atest BluetoothUtilsTest
Flag: EXEMPT bugfix
Change-Id: If49cf5dd552ec9aeff7735e28b057526b8d50625
parent 8bfe8a87
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public class BluetoothUtils {
    private static final String KEY_HEARABLE_CONTROL_SLICE = "HEARABLE_CONTROL_SLICE_WITH_WIDTH";
    private static final Set<Integer> SA_PROFILES =
            ImmutableSet.of(
                    BluetoothProfile.A2DP, BluetoothProfile.LE_AUDIO, BluetoothProfile.HEARING_AID);
                    BluetoothProfile.A2DP, BluetoothProfile.LE_AUDIO);
    private static final List<Integer> BLUETOOTH_DEVICE_CLASS_HEADSET =
            List.of(
                    BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES,
+0 −21
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@ public class BluetoothUtilsTest {
    @Mock private PackageManager mPackageManager;
    @Mock private LeAudioProfile mA2dpProfile;
    @Mock private LeAudioProfile mLeAudioProfile;
    @Mock private LeAudioProfile mHearingAid;
    @Mock private LocalBluetoothLeBroadcast mBroadcast;
    @Mock private LocalBluetoothProfileManager mProfileManager;
    @Mock private LocalBluetoothManager mLocalBluetoothManager;
@@ -158,7 +157,6 @@ public class BluetoothUtilsTest {
        when(mProfileManager.getLeAudioProfile()).thenReturn(mLeAudioProfile);
        when(mA2dpProfile.getProfileId()).thenReturn(BluetoothProfile.A2DP);
        when(mLeAudioProfile.getProfileId()).thenReturn(BluetoothProfile.LE_AUDIO);
        when(mHearingAid.getProfileId()).thenReturn(BluetoothProfile.HEARING_AID);
        when(mContext.getSystemService(InputManager.class)).thenReturn(mInputManager);
        when(mInputManager.getInputDeviceIds()).thenReturn(new int[]{TEST_DEVICE_ID});
        when(mInputManager.getInputDeviceBluetoothAddress(TEST_DEVICE_ID)).thenReturn(TEST_ADDRESS);
@@ -1228,25 +1226,6 @@ public class BluetoothUtilsTest {
                                TEST_ADDRESS));
    }

    @Test
    public void getAudioDeviceAttributesForSpatialAudio_hearingAid() {
        when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
        when(mCachedBluetoothDevice.getAddress()).thenReturn(TEST_ADDRESS);
        when(mCachedBluetoothDevice.getProfiles()).thenReturn(List.of(mHearingAid));
        when(mHearingAid.isEnabled(mBluetoothDevice)).thenReturn(true);

        AudioDeviceAttributes attr =
                BluetoothUtils.getAudioDeviceAttributesForSpatialAudio(
                        mCachedBluetoothDevice, AudioManager.AUDIO_DEVICE_CATEGORY_HEARING_AID);

        assertThat(attr)
                .isEqualTo(
                        new AudioDeviceAttributes(
                                AudioDeviceAttributes.ROLE_OUTPUT,
                                AudioDeviceInfo.TYPE_HEARING_AID,
                                TEST_ADDRESS));
    }

    @Test
    public void isAudioSharingEnabled_flagOff_returnsFalse() {
        mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_LE_AUDIO_SHARING);