Merge "hal: Fix the device disable/enable sequence for capture usecases"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index d738de1..821b339 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -663,9 +663,10 @@
            specified usecase to new snd devices */
         list_for_each(node, &adev->usecase_list) {
             usecase = node_to_item(node, struct audio_usecase, list);
-            /* Update the out_snd_device only for the usecases that are enabled here */
-            if (switch_device[usecase->id] && (usecase->type != VOICE_CALL)) {
-                    usecase->out_snd_device = snd_device;
+            /* Update the out_snd_device only before enabling the audio route */
+            if (switch_device[usecase->id] ) {
+                usecase->out_snd_device = snd_device;
+                if (usecase->type != VOICE_CALL)
                     enable_audio_route(adev, usecase);
             }
         }
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index b3943fd..1133790 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -2428,7 +2428,7 @@
         goto exit;
     }
 
-    if (popcount(devices) == 2 && !voice_is_in_call(adev)) {
+    if (popcount(devices) == 2) {
         if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
                         AUDIO_DEVICE_OUT_SPEAKER)) {
             if (my_data->external_spk_1)
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index f2d975f..142a85d 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2049,7 +2049,7 @@
         goto exit;
     }
 
-    if (popcount(devices) == 2 && !voice_is_in_call(adev)) {
+    if (popcount(devices) == 2) {
         if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
                         AUDIO_DEVICE_OUT_SPEAKER)) {
             if (my_data->external_spk_1)