hal: refine conditional logic when device connected/disconnected
When non-USB in device is connected, the device will be wrongly treated
as AUDIO_DEVICE_IN_USB_DEVICE, which causes AFE proxy being disabled.
Remove AUDIO_DEVICE_BIT_IN when checking device type to avoid wrong
device type selection.
CRs-Fixed: 1061424
Change-Id: I9086325d44106d683d31e6ddc366a4b5e18d19ea
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 7d3c824..43c83de 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -4109,7 +4109,7 @@
ALOGV("cache new edid");
platform_cache_edid(adev->platform);
} else if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
- (val & AUDIO_DEVICE_IN_USB_DEVICE)) {
+ !(val ^ AUDIO_DEVICE_IN_USB_DEVICE)) {
/*
* Do not allow AFE proxy port usage by WFD source when USB headset is connected.
* Per AudioPolicyManager, USB device is higher priority than WFD.
@@ -4133,7 +4133,7 @@
ALOGV("invalidate cached edid");
platform_invalidate_hdmi_config(adev->platform);
} else if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
- (val & AUDIO_DEVICE_IN_USB_DEVICE)) {
+ !(val ^ AUDIO_DEVICE_IN_USB_DEVICE)) {
ret = str_parms_get_str(parms, "card", value, sizeof(value));
if (ret >= 0) {
audio_extn_usb_remove_device(val, atoi(value));