Loading src/com/android/settings/bluetooth/BluetoothDetailsSpatialAudioController.java +0 −6 Original line number Diff line number Diff line Loading @@ -272,10 +272,6 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont AudioDeviceAttributes.ROLE_OUTPUT, AudioDeviceInfo.TYPE_BLE_BROADCAST, mCachedDevice.getAddress()); AudioDeviceAttributes hearingAidDevice = new AudioDeviceAttributes( AudioDeviceAttributes.ROLE_OUTPUT, AudioDeviceInfo.TYPE_HEARING_AID, mCachedDevice.getAddress()); if (mSpatializer.isAvailableForDevice(bleHeadsetDevice)) { mAudioDevice = bleHeadsetDevice; Loading @@ -285,8 +281,6 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont mAudioDevice = bleBroadcastDevice; } else if (mSpatializer.isAvailableForDevice(a2dpDevice)) { mAudioDevice = a2dpDevice; } else if (mSpatializer.isAvailableForDevice(hearingAidDevice)) { mAudioDevice = hearingAidDevice; } else { mAudioDevice = null; } Loading tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsSpatialAudioControllerTest.java +1 −21 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import androidx.preference.TwoStatePreference; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settingslib.bluetooth.A2dpProfile; import com.android.settingslib.bluetooth.HearingAidProfile; import com.android.settingslib.bluetooth.LeAudioProfile; import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.flags.Flags; Loading Loading @@ -76,7 +75,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails @Mock private BluetoothDevice mBluetoothDevice; @Mock private A2dpProfile mA2dpProfile; @Mock private LeAudioProfile mLeAudioProfile; @Mock private HearingAidProfile mHearingAidProfile; private AudioDeviceAttributes mAvailableDevice; Loading @@ -96,12 +94,10 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails when(mAudioManager.getSpatializer()).thenReturn(mSpatializer); when(mCachedDevice.getAddress()).thenReturn(MAC_ADDRESS); when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice); when(mCachedDevice.getProfiles()) .thenReturn(List.of(mA2dpProfile, mLeAudioProfile, mHearingAidProfile)); when(mCachedDevice.getProfiles()).thenReturn(List.of(mA2dpProfile, mLeAudioProfile)); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mA2dpProfile.getProfileId()).thenReturn(BluetoothProfile.A2DP); when(mLeAudioProfile.getProfileId()).thenReturn(BluetoothProfile.LE_AUDIO); when(mHearingAidProfile.getProfileId()).thenReturn(BluetoothProfile.HEARING_AID); when(mBluetoothDevice.getAnonymizedAddress()).thenReturn(MAC_ADDRESS); when(mFeatureFactory.getBluetoothFeatureProvider().getSpatializer(mContext)) .thenReturn(mSpatializer); Loading Loading @@ -296,7 +292,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails public void refresh_leAudioProfileEnabledForHeadset_useLeAudioHeadsetAttributes() { when(mLeAudioProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mHearingAidProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)) .thenReturn(AudioManager.AUDIO_DEVICE_CATEGORY_HEADPHONES); when(mSpatializer.isAvailableForDevice(any())).thenReturn(true); Loading @@ -312,7 +307,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails public void refresh_leAudioProfileEnabledForSpeaker_useLeAudioSpeakerAttributes() { when(mLeAudioProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mHearingAidProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)) .thenReturn(AudioManager.AUDIO_DEVICE_CATEGORY_SPEAKER); when(mSpatializer.isAvailableForDevice(any())).thenReturn(true); Loading @@ -323,20 +317,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails assertThat(mController.mAudioDevice.getType()).isEqualTo(AudioDeviceInfo.TYPE_BLE_SPEAKER); } @Test @EnableFlags(Flags.FLAG_ENABLE_DETERMINING_SPATIAL_AUDIO_ATTRIBUTES_BY_PROFILE) public void refresh_hearingAidProfileEnabled_useHearingAidAttributes() { when(mLeAudioProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mHearingAidProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mSpatializer.isAvailableForDevice(any())).thenReturn(true); mController.refresh(); ShadowLooper.idleMainLooper(); assertThat(mController.mAudioDevice.getType()).isEqualTo(AudioDeviceInfo.TYPE_HEARING_AID); } @Test public void turnedOnSpatialAudio_invokesAddCompatibleAudioDevice() { mController.setAvailableDevice(mAvailableDevice); Loading Loading
src/com/android/settings/bluetooth/BluetoothDetailsSpatialAudioController.java +0 −6 Original line number Diff line number Diff line Loading @@ -272,10 +272,6 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont AudioDeviceAttributes.ROLE_OUTPUT, AudioDeviceInfo.TYPE_BLE_BROADCAST, mCachedDevice.getAddress()); AudioDeviceAttributes hearingAidDevice = new AudioDeviceAttributes( AudioDeviceAttributes.ROLE_OUTPUT, AudioDeviceInfo.TYPE_HEARING_AID, mCachedDevice.getAddress()); if (mSpatializer.isAvailableForDevice(bleHeadsetDevice)) { mAudioDevice = bleHeadsetDevice; Loading @@ -285,8 +281,6 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont mAudioDevice = bleBroadcastDevice; } else if (mSpatializer.isAvailableForDevice(a2dpDevice)) { mAudioDevice = a2dpDevice; } else if (mSpatializer.isAvailableForDevice(hearingAidDevice)) { mAudioDevice = hearingAidDevice; } else { mAudioDevice = null; } Loading
tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsSpatialAudioControllerTest.java +1 −21 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import androidx.preference.TwoStatePreference; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settingslib.bluetooth.A2dpProfile; import com.android.settingslib.bluetooth.HearingAidProfile; import com.android.settingslib.bluetooth.LeAudioProfile; import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.flags.Flags; Loading Loading @@ -76,7 +75,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails @Mock private BluetoothDevice mBluetoothDevice; @Mock private A2dpProfile mA2dpProfile; @Mock private LeAudioProfile mLeAudioProfile; @Mock private HearingAidProfile mHearingAidProfile; private AudioDeviceAttributes mAvailableDevice; Loading @@ -96,12 +94,10 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails when(mAudioManager.getSpatializer()).thenReturn(mSpatializer); when(mCachedDevice.getAddress()).thenReturn(MAC_ADDRESS); when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice); when(mCachedDevice.getProfiles()) .thenReturn(List.of(mA2dpProfile, mLeAudioProfile, mHearingAidProfile)); when(mCachedDevice.getProfiles()).thenReturn(List.of(mA2dpProfile, mLeAudioProfile)); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mA2dpProfile.getProfileId()).thenReturn(BluetoothProfile.A2DP); when(mLeAudioProfile.getProfileId()).thenReturn(BluetoothProfile.LE_AUDIO); when(mHearingAidProfile.getProfileId()).thenReturn(BluetoothProfile.HEARING_AID); when(mBluetoothDevice.getAnonymizedAddress()).thenReturn(MAC_ADDRESS); when(mFeatureFactory.getBluetoothFeatureProvider().getSpatializer(mContext)) .thenReturn(mSpatializer); Loading Loading @@ -296,7 +292,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails public void refresh_leAudioProfileEnabledForHeadset_useLeAudioHeadsetAttributes() { when(mLeAudioProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mHearingAidProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)) .thenReturn(AudioManager.AUDIO_DEVICE_CATEGORY_HEADPHONES); when(mSpatializer.isAvailableForDevice(any())).thenReturn(true); Loading @@ -312,7 +307,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails public void refresh_leAudioProfileEnabledForSpeaker_useLeAudioSpeakerAttributes() { when(mLeAudioProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mHearingAidProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)) .thenReturn(AudioManager.AUDIO_DEVICE_CATEGORY_SPEAKER); when(mSpatializer.isAvailableForDevice(any())).thenReturn(true); Loading @@ -323,20 +317,6 @@ public class BluetoothDetailsSpatialAudioControllerTest extends BluetoothDetails assertThat(mController.mAudioDevice.getType()).isEqualTo(AudioDeviceInfo.TYPE_BLE_SPEAKER); } @Test @EnableFlags(Flags.FLAG_ENABLE_DETERMINING_SPATIAL_AUDIO_ATTRIBUTES_BY_PROFILE) public void refresh_hearingAidProfileEnabled_useHearingAidAttributes() { when(mLeAudioProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mA2dpProfile.isEnabled(mBluetoothDevice)).thenReturn(false); when(mHearingAidProfile.isEnabled(mBluetoothDevice)).thenReturn(true); when(mSpatializer.isAvailableForDevice(any())).thenReturn(true); mController.refresh(); ShadowLooper.idleMainLooper(); assertThat(mController.mAudioDevice.getType()).isEqualTo(AudioDeviceInfo.TYPE_HEARING_AID); } @Test public void turnedOnSpatialAudio_invokesAddCompatibleAudioDevice() { mController.setAvailableDevice(mAvailableDevice); Loading