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

Commit 58a28313 authored by Ramjee Singh's avatar Ramjee Singh
Browse files

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

  Need to extend getDeviceForStrategy function in
  custom audio policy so that WFD use-case selects
  proxy for needed strategies.

Change-Id: Ib5ca3d70eaeeecfa78529b939674d766388b133e
parent 6b3e7e19
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,