Merge "hal: refine conditional logic when device connected/disconnected" into audio-userspace.lnx.2.1-dev
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));