Merge "hal: Enable logs for EDID messages."
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 197bdfb..e2db95b 100755
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -666,9 +666,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);
             }
         }
@@ -703,7 +704,8 @@
                 usecase != uc_info &&
                 usecase->in_snd_device != snd_device &&
                 ((uc_info->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
-                ((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND)) &&
+                 (((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND) ||
+                  (usecase->type == VOICE_CALL))) &&
                 (usecase->id != USECASE_AUDIO_SPKR_CALIB_TX)) {
             ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..",
                   __func__, use_case_table[usecase->id],
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 0af526d..1833208 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)
@@ -2528,7 +2528,8 @@
     if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
         devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
         if (OUTPUT_SAMPLING_RATE_44100 == sample_rate &&
-            platform_get_native_support()) {
+            platform_get_native_support() &&
+            !audio_extn_get_anc_enabled()) {
             snd_device = SND_DEVICE_OUT_HEADPHONES_44_1;
         }else if (devices & AUDIO_DEVICE_OUT_WIRED_HEADSET
             && audio_extn_get_anc_enabled()) {
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index d215a89..2975a00 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)
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 2791b6d..1d2cb8f 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1372,7 +1372,7 @@
         flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER);
     } else if (/* stream == AUDIO_STREAM_MUSIC && */
             flags == AUDIO_OUTPUT_FLAG_NONE &&
-            property_get_bool("audio.deep_buffer.media", false /* default_value */)) {
+            property_get_bool("audio.deep_buffer.media", true/* default_value */)) {
         flags = (audio_output_flags_t)AUDIO_OUTPUT_FLAG_DEEP_BUFFER;
     }