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

Commit cd76e793 authored by Whale Chang's avatar Whale Chang Committed by Android (Google) Code Review
Browse files

Merge "Audio Policy: Route both audio input and output to SCO with...

Merge "Audio Policy: Route both audio input and output to SCO with setCommunicationDevice(TYPE_BLUETOOTH_SCO)" into main
parents 6055b5fb 8002e495
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -450,21 +450,19 @@ DeviceVector Engine::getDevicesForStrategyInt(legacy_strategy strategy,
                excludedDevices.push_back(AUDIO_DEVICE_OUT_AUX_DIGITAL);
            }
            if ((getForceUse(AUDIO_POLICY_FORCE_FOR_MEDIA) != AUDIO_POLICY_FORCE_NO_BT_A2DP)) {
                // Get the last connected device of wired and bluetooth a2dp
                devices2 = availableOutputDevices.getFirstDevicesFromTypes(
                        getLastRemovableMediaDevices(GROUP_NONE, excludedDevices));
                if (com::android::media::audioserver::use_bt_sco_for_media()) {
                    if (isBtScoActive(availableOutputDevices)
                         && !(devices2.getDevicesFromTypes(
                                 getAudioDeviceOutAllA2dpSet()).isEmpty()
                             && devices2.getDevicesFromTypes(
                                     getAudioDeviceOutAllBleSet()).isEmpty())) {
                    if (isBtScoActive(availableOutputDevices)) {
                        devices2 = availableOutputDevices.getFirstDevicesFromTypes(
                                { AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT,
                                AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET,
                                AUDIO_DEVICE_OUT_BLUETOOTH_SCO});
                    }
                }
                if (devices2.isEmpty()) {
                    // Get the last connected device of wired and bluetooth a2dp
                    devices2 = availableOutputDevices.getFirstDevicesFromTypes(
                            getLastRemovableMediaDevices(GROUP_NONE, excludedDevices));
                }
            } else {
                // Get the last connected device of wired except bluetooth a2dp
                devices2 = availableOutputDevices.getFirstDevicesFromTypes(