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

Commit a8e0f02d authored by Eric Laurent's avatar Eric Laurent Committed by Jack He
Browse files

audio policy: add rule for ringtone duplication over speaker + SCO

Bug: 19171297
Test: make, testplans/79248

Change-Id: Ic539256e53782806d5dbbca5fb6ebe9f2ca5ec76
parent 5052e9cf
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -418,6 +418,25 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
                (mForceUse[AUDIO_POLICY_FORCE_FOR_SYSTEM] == AUDIO_POLICY_FORCE_SYSTEM_ENFORCED)) {
            device = availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER;
        }

        // if SCO headset is connected and we are told to use it, play ringtone over
        // speaker and BT SCO
        if (((availableOutputDevicesType & AUDIO_DEVICE_OUT_ALL_SCO) != 0) &&
                (mForceUse[AUDIO_POLICY_FORCE_FOR_COMMUNICATION] == AUDIO_POLICY_FORCE_BT_SCO)) {
            uint32_t device2 = AUDIO_DEVICE_NONE;
            device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
            if (device2 == AUDIO_DEVICE_NONE) {
                device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
            }
            if (device2 == AUDIO_DEVICE_NONE) {
                device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO;
            }

            if (device2 != AUDIO_DEVICE_NONE) {
                device |= device2;
                break;
            }
        }
        // The second device used for sonification is the same as the device used by media strategy
        // FALL THROUGH