diff options
author | Aniket Kumar Lata <alata@quicinc.com> | 2019-05-08 15:56:56 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2019-05-08 16:36:27 -0700 |
commit | 8f270269d00bbbe82c3f12d26131111ece165f82 (patch) | |
tree | 686175dff8c4ace5438aabb93ce1297461caea0c /hal | |
parent | 154055d2bce6311f03e5ac06e8ba417375b24817 (diff) | |
download | audio-8f270269d00bbbe82c3f12d26131111ece165f82.tar.gz |
hal: Modify A2DP output routing post releaseAudioPatch
HAL routes A2DP stream to speaker on releaseAudioPatch
from APM until the stream is put to standby from framework.
APM may releaseAudioPatch for an output where A2DP is
suspended and SCO is active leading to HAL switching all
streams to speaker. Fix this behavior by routing streams
to speaker only if both SCO and A2DP are not active.
Bug: 126848701
Test: repro steps in bug
Change-Id: Ic315b16480fe6d0c81c45716534a42b800e2d9da
Diffstat (limited to 'hal')
-rw-r--r-- | hal/audio_hw.c | 11 | ||||
-rw-r--r-- | hal/audio_hw.h | 1 |
2 files changed, 11 insertions, 1 deletions
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 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) */ 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 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) 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 @@ struct audio_device { /* 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, |