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:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.sound;
|
||||
|
||||
import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||
import static android.media.AudioSystem.DEVICE_OUT_USB_HEADSET;
|
||||
import static android.media.MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
@@ -91,7 +93,7 @@ public class MediaOutputPreferenceController extends AudioSwitchPreferenceContro
|
||||
// Setup devices entries, select active connected device
|
||||
setupPreferenceEntries(mediaOutputs, mediaValues, activeDevice);
|
||||
|
||||
if (mAudioManager.isWiredHeadsetOn() && !mAudioManager.isBluetoothA2dpOn()) {
|
||||
if (isStreamFromOutputDevice(STREAM_VOICE_CALL, DEVICE_OUT_USB_HEADSET)) {
|
||||
// If wired headset is plugged in and active, select to default device.
|
||||
mSelectedIndex = getDefaultDeviceIndex();
|
||||
}
|
||||
|
Reference in New Issue
Block a user