hal: force device switch when BT SCO is off
When BT SCO is off, the active use cases may still stay on SCO
devices which is not expected, switch the device to handset or
handset mic before receiving routing command from audio policy
manager.
Also, reset SCO configuration for SWB device only when BT SCO
is off, as the path needs to keep active to allow starting
playback/capture for multiple times during SCO is on.
Change-Id: I5817824fd921b2d5f9e17ee8aed02d0bd2cee0fc
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index 19c839c..e07a5ca 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -3016,9 +3016,11 @@
void sco_reset_configuration()
{
- ALOGD("sco_reset_configuration start");
+ if (a2dp.swb_configured) {
+ ALOGD("sco_reset_configuration start");
- reset_codec_config();
- a2dp.bt_encoder_format = CODEC_TYPE_INVALID;
- a2dp.swb_configured = false;
+ reset_codec_config();
+ a2dp.bt_encoder_format = CODEC_TYPE_INVALID;
+ a2dp.swb_configured = false;
+ }
}