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

Commit 0f928fab authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: fix getDeviceForStrategy()

Modification of getDEviceForStrategy by commit 28d09f06 made
wrong use of available output devices vector passed by reference
and caused an update of the actual list of connected devices instead
of the local list.

Bug: 27586202

Change-Id: I805b9cf27e1fb28494e6e23b2b874e0e5c3487e6
parent 02c4f1c0
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -231,20 +231,20 @@ routing_strategy Engine::getStrategyForUsage(audio_usage_t usage)

audio_devices_t Engine::getDeviceForStrategy(routing_strategy strategy) const
{
    const DeviceVector &availableOutputDevices = mApmObserver->getAvailableOutputDevices();
    const DeviceVector &availableInputDevices = mApmObserver->getAvailableInputDevices();
    DeviceVector availableOutputDevices = mApmObserver->getAvailableOutputDevices();
    DeviceVector availableInputDevices = mApmObserver->getAvailableInputDevices();

    const SwAudioOutputCollection &outputs = mApmObserver->getOutputs();

    return getDeviceForStrategyInt(strategy, (DeviceVector&)availableOutputDevices,
    return getDeviceForStrategyInt(strategy, availableOutputDevices,
                                   availableInputDevices, outputs);
}



audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
                                                DeviceVector &availableOutputDevices,
                                                const DeviceVector &availableInputDevices,
                                                DeviceVector availableOutputDevices,
                                                DeviceVector availableInputDevices,
                                                const SwAudioOutputCollection &outputs) const
{
    uint32_t device = AUDIO_DEVICE_NONE;
+2 −2
Original line number Diff line number Diff line
@@ -126,8 +126,8 @@ private:
    routing_strategy getStrategyForUsage(audio_usage_t usage);
    audio_devices_t getDeviceForStrategy(routing_strategy strategy) const;
    audio_devices_t getDeviceForStrategyInt(routing_strategy strategy,
                                            DeviceVector &availableOutputDevices,
                                            const DeviceVector &availableInputDevices,
                                            DeviceVector availableOutputDevices,
                                            DeviceVector availableInputDevices,
                                            const SwAudioOutputCollection &outputs) const;
    audio_devices_t getDeviceForInputSource(audio_source_t inputSource) const;
    audio_mode_t mPhoneState;  /**< current phone state. */