Merge "hal: Modify A2DP output routing post releaseAudioPatch" into qt-dev
am: bde007c7f0

Change-Id: I417add02df9cf2747a0d59791a2f3b695b443efd
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 517351e..e0c2fce 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2881,7 +2881,8 @@
          */
         if ((out->devices & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP) &&
                 (val == AUDIO_DEVICE_NONE) &&
-                !audio_extn_a2dp_is_ready()) {
+                !audio_extn_a2dp_is_ready() &&
+                !adev->bt_sco_on) {
                 val = AUDIO_DEVICE_OUT_SPEAKER;
         }
 
@@ -5349,6 +5350,14 @@
         adev->bt_wb_speech_enabled = !strcmp(value, AUDIO_PARAMETER_VALUE_ON);
     }
 
+    ret = str_parms_get_str(parms, "BT_SCO", value, sizeof(value));
+    if (ret >= 0) {
+        if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0)
+            adev->bt_sco_on = true;
+        else
+            adev->bt_sco_on = false;
+    }
+
     ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value));
     if (ret >= 0) {
         audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 0992650..e8fe65b 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -421,6 +421,7 @@
     /* logging */
     snd_device_t last_logged_snd_device[AUDIO_USECASE_MAX][2]; /* [out, in] */
     int camera_orientation; /* CAMERA_BACK_LANDSCAPE ... CAMERA_FRONT_PORTRAIT */
+    bool bt_sco_on;
 };
 
 int select_devices(struct audio_device *adev,