hal: fix listen and audio calibration concurency
- ACDB loader is maintaining the same calibration buffers
for both listen and audio. So there is a possibility that
the audio calibration buffers may be overwritten with listen
calibration soon after notifying the device busy state to
listen hal
- Avoid this issue by notifying listen hal before sending the
audio calibration so that listen hal can complete pushing its
calibration
Change-Id: I4d954b1287b59ee4e1510707db25f466d14dca97
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 2f67784..e0df97c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -329,13 +329,16 @@
} else {
ALOGV("%s: snd_device(%d: %s)", __func__,
snd_device, device_name);
+ /* due to the possibility of calibration overwrite between listen
+ and audio, notify listen hal before audio calibration is sent */
+ audio_extn_listen_update_status(snd_device,
+ LISTEN_EVENT_SND_DEVICE_BUSY);
if (platform_send_audio_calibration(adev->platform, snd_device) < 0) {
adev->snd_dev_ref_cnt[snd_device]--;
+ audio_extn_listen_update_status(snd_device,
+ LISTEN_EVENT_SND_DEVICE_FREE);
return -EINVAL;
}
- audio_extn_listen_update_status(snd_device,
- LISTEN_EVENT_SND_DEVICE_BUSY);
-
audio_route_apply_path(adev->audio_route, device_name);
}
if (update_mixer)