hal: avoid redundant device switch during playback.
With music playback in background, a new playback is started, current
snd_device of this new playback usecase is none at this moment,
then force_routing flag is set to true, which causes device
switch even if output snd devices are same.
Fix it by checking current snd_device to avoid redundant device switch.
CRs-Fixed: 2273928
Change-Id: Ic4592123bf0d1d9c1349b61fea2af56cf16cabf6
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 7c950e5..0c28182 100755
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6284,7 +6284,8 @@
ALOGI("%s: new_snd_devices[%d] is %d", __func__, i, new_snd_devices[i]);
if ((platform_check_codec_backend_cfg(adev, usecase, new_snd_devices[i],
&backend_cfg)) ||
- (!platform_check_backends_match(usecase->out_snd_device, snd_device))) {
+ ((usecase->out_snd_device != SND_DEVICE_NONE) &&
+ !platform_check_backends_match(usecase->out_snd_device, snd_device))) {
ret = platform_set_codec_backend_cfg(adev, new_snd_devices[i],
backend_cfg);
if (!ret) {