From 8885d6f4ea0aca5e97a5f405434d4494c5e41b85 Mon Sep 17 00:00:00 2001 From: Mallikarjuna GB Date: Fri, 28 Nov 2014 10:21:15 +0530 Subject: [PATCH] Update call state before opening SCO. This change makes sure to update the current call state before opening SCO connection when incoming call is answered. Some car kits are strict in checking this sequence and go in bad state if not done this way. Change-Id: Ie744dc26c02d897eaf016ee73022bfc2a0db067e --- bta/ag/bta_ag_cmd.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/bta/ag/bta_ag_cmd.c b/bta/ag/bta_ag_cmd.c index e59240451..a0564d9e3 100755 --- a/bta/ag/bta_ag_cmd.c +++ b/bta/ag/bta_ag_cmd.c @@ -1488,28 +1488,22 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result) /* stop ring timer */ bta_sys_stop_timer(&p_scb->act_timer); - /* if sco not opened and we need to open it, open sco first - ** then send indicators + /* if sco not opened and we need to open it, send indicators first + ** then open sco. */ - if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) && - !bta_ag_sco_is_open(p_scb) && !(p_scb->features & BTA_AG_FEAT_NOSCO)) - { - p_scb->post_sco = BTA_AG_POST_SCO_CALL_CONN; - bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result); - } - /* else if sco open and we need to close it, close sco first - ** then send indicators - */ - else if (p_result->data.audio_handle == BTA_AG_HANDLE_NONE && - bta_ag_sco_is_open(p_scb) && !(p_scb->features & BTA_AG_FEAT_NOSCO)) - { - p_scb->post_sco = BTA_AG_POST_SCO_CALL_CONN; - bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result); - } - /* else send indicators now */ - else + bta_ag_send_call_inds(p_scb, p_result->result); + + if (!(p_scb->features & BTA_AG_FEAT_NOSCO)) { - bta_ag_send_call_inds(p_scb, p_result->result); + if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb)) + { + bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result); + } + else if ((p_result->data.audio_handle == BTA_AG_HANDLE_NONE) && + bta_ag_sco_is_open(p_scb)) + { + bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result); + } } break; -- 2.11.0