hal: Fix device selection during voice call

During a voice call, when a device switch happens
for any stream, we try to make sure that all
streams sharing the same back end is re-routed
to the new device. This was causing even
devices that do not share the same codec backend
to get re-routed to the new device. Fix this
by checking for the device on which use case
is running

Change-Id: I101b79d3642fa1f8f32eeaf3731a5c7bd5364c72
CRs-Fixed: 1006364
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 5bd6651..a7938ce 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -679,7 +679,6 @@
               platform_get_snd_device_name(snd_device),
               platform_get_snd_device_name(usecase->out_snd_device),
               platform_check_backends_match(snd_device, usecase->out_snd_device));
-
         if (usecase->type != PCM_CAPTURE &&
             usecase != uc_info &&
             (usecase->out_snd_device != snd_device || force_routing)  &&
@@ -968,12 +967,15 @@
          * be switched to new device when select_devices() is called for voice call
          * usecase. This is to avoid switching devices for voice call when
          * check_usecases_codec_backend() is called below.
+         * choose voice call device only if the use case device is
+         * also using the codec backend
          */
         if (voice_is_in_call(adev) && adev->mode != AUDIO_MODE_NORMAL) {
             vc_usecase = get_usecase_from_list(adev,
                                                get_usecase_id_from_usecase_type(adev, VOICE_CALL));
-            if ((vc_usecase) && ((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) ||
-                (usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL))) {
+            if (((vc_usecase) && ((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
+                                 (usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND))) ||
+                                (usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL)) {
                 in_snd_device = vc_usecase->in_snd_device;
                 out_snd_device = vc_usecase->out_snd_device;
             }