Replace deprecated APIs in audio switcher.
- Remove isWiredHeadsetOn() and isBluetoothA2dpOn() in MediaOutputPreferenceController. - Remove isWiredHeadsetOn() and isBluetoothScoOn() in HandsFreeProfileOutputPreferenceController. - Replace with AudioManager.getDevicesForStream(). - Update test cases. Bug: 78141441 Test: make RunSettingsRoboTests ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j40 Test: make RunSettingsRoboTests ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j40 Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j40 Change-Id: Ic57c40badf0fd5633f1b7412d63a0b5417d0f47a
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package com.android.settings.sound;
|
||||
|
||||
|
||||
import static android.media.AudioSystem.DEVICE_OUT_USB_HEADSET;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -256,8 +258,7 @@ public class MediaOutputPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_a2dpDevicesAvailableWiredHeadsetIsActivated_shouldSetDefaultSummary() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
mShadowAudioManager.setWiredHeadsetOn(true);
|
||||
mShadowAudioManager.setBluetoothA2dpOn(false);
|
||||
mShadowAudioManager.setStream(DEVICE_OUT_USB_HEADSET);
|
||||
when(mA2dpProfile.getConnectedDevices()).thenReturn(mConnectedDevices);
|
||||
when(mA2dpProfile.getActiveDevice()).thenReturn(
|
||||
mBluetoothDevice); // BT device is still activated in this case
|
||||
|
Reference in New Issue
Block a user