Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06c762f5 authored by Mallikarjuna GB's avatar Mallikarjuna GB Committed by Andre Eisenbach
Browse files

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
parent a5cde0fb
Loading
Loading
Loading
Loading
+14 −20
Original line number Diff line number Diff line
@@ -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))
            bta_ag_send_call_inds(p_scb, p_result->result);

            if (!(p_scb->features & BTA_AG_FEAT_NOSCO))
            {
                if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb))
                {
                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))
                else if ((p_result->data.audio_handle == BTA_AG_HANDLE_NONE) &&
                        bta_ag_sco_is_open(p_scb))
                {
                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);
            }
            break;