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

Commit 9fcb0552 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "policy-hal: extend getDeviceForStrategy for WFD use-cases."

parents 7e2a5ba8 58a28313
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -1076,4 +1076,31 @@ non_direct_output:

    return output;
}

audio_devices_t AudioPolicyManagerCustom::getDeviceForStrategy(routing_strategy strategy, bool fromCache)
{
    audio_devices_t availableOutputDeviceTypes = mAvailableOutputDevices.types();
    audio_devices_t device = AUDIO_DEVICE_NONE;
    switch (strategy) {
        case STRATEGY_SONIFICATION:
        case STRATEGY_ENFORCED_AUDIBLE:
        case STRATEGY_ACCESSIBILITY:
        case STRATEGY_REROUTING:
        case STRATEGY_MEDIA:
            if (strategy != STRATEGY_SONIFICATION){
                // no sonification on WFD sink
                device |= availableOutputDeviceTypes & AUDIO_DEVICE_OUT_PROXY;
                if (device != AUDIO_DEVICE_NONE) {
                    ALOGV("Found proxy for strategy %d", strategy);
                    return device;
                }
            }
            break;
        default:
            ALOGV("getDeviceForStrategy() unknown strategy: %d", strategy);
            break;
    }
    device = AudioPolicyManager::getDeviceForStrategy(strategy, fromCache);
    return device;
}
}
+3 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ namespace android {
#endif

#ifndef AFE_PROXY_ENABLED
#define AUDIO_DEVICE_OUT_PROXY 0x40000
#define AUDIO_DEVICE_OUT_PROXY 0x1000000
#endif
// ----------------------------------------------------------------------------

@@ -67,6 +67,8 @@ public:
        virtual bool isOffloadSupported(const audio_offload_info_t& offloadInfo);

        // true if given state represents a device in a telephony or VoIP call

        virtual audio_devices_t getDeviceForStrategy(routing_strategy strategy, bool fromCache);
protected:

         status_t checkAndSetVolume(audio_stream_type_t stream,