hal: fm: Fix incorrect routing of fm audio to speaker
- FM audio is enabled or disabled through set_parameters() API
on primary output stream. The audio is routed to device of
primary output stream.
- If the routing is not updated before the enable command, the
audio is routed to previous device of primary output.
- Fix the issue by updating the primary output device with device
from enable command.
Change-Id: I67764b8b5d2cfaddef94ccfe555702289bf36f95
CRs-Fixed: 651821
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index a4157f8..249ae9e 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -230,9 +230,10 @@
ALOGD("%s: FM usecase", __func__);
if (val != 0) {
if(val & AUDIO_DEVICE_OUT_FM
- && fmmod.is_fm_running == false)
+ && fmmod.is_fm_running == false) {
+ adev->primary_output->devices = val & ~AUDIO_DEVICE_OUT_FM;
fm_start(adev);
- else if (!(val & AUDIO_DEVICE_OUT_FM)
+ } else if (!(val & AUDIO_DEVICE_OUT_FM)
&& fmmod.is_fm_running == true)
fm_stop(adev);
}