audio: Make platform_check_backends_match handle input devices as well
* The change 1d2a053 by Google introduced some additional checks
before disabling audio routes, sadly these checks depend on
platform_check_backends_match() supporting more than just
output devices, which is a thing on Google's fork of QCOM
audio HAL but not the CAF one.
* Without proper range checks, platform_check_backends_match()
would pretty much always return false, preventing 'audio-record'
usecase from being disabled during calls, which ends up breaking
incall microphone when Google Assistant is listening.
Change-Id: Ifc923069a0e8eec68ff1e2faab432cdc30ca6ceb
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 5ef0062..c938e36 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -4168,12 +4168,12 @@
platform_get_snd_device_name(snd_device1),
platform_get_snd_device_name(snd_device2));
- if ((snd_device1 < SND_DEVICE_MIN) || (snd_device1 >= SND_DEVICE_OUT_END)) {
+ if ((snd_device1 < SND_DEVICE_MIN) || (snd_device1 >= SND_DEVICE_MAX)) {
ALOGE("%s: Invalid snd_device = %s", __func__,
platform_get_snd_device_name(snd_device1));
return false;
}
- if ((snd_device2 < SND_DEVICE_MIN) || (snd_device2 >= SND_DEVICE_OUT_END)) {
+ if ((snd_device2 < SND_DEVICE_MIN) || (snd_device2 >= SND_DEVICE_MAX)) {
ALOGE("%s: Invalid snd_device = %s", __func__,
platform_get_snd_device_name(snd_device2));
return false;