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

Commit 6d564105 authored by Ayan Ghosh's avatar Ayan Ghosh Committed by Andre Eisenbach
Browse files

Move to idle when remote disconnects during connection.

Chrysler Uconnect Touch initiates disconnect for a2dp on
l2cap just after discovery on AVDTP channel, stack does not
send any message to BTIF layer for disconnection, this
causes btif getting stuck in opening state and later no stable
connection update is sent to app. Since it is intermediate
state all subsequent connection trials fails.

Send disconnect event from incoming state to closing state
and then closing state will send proper msg to btif layer. Add
closing msg handling in btif layer so that we can update app
for connection disconnect when initiated from remote and move to
proper stable state for accepting/initiating connection.

Change-Id: I011d9ffe9d721235217320c1e5281f70328c7f13
parent 3523f3e2
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1517,23 +1517,26 @@ void bta_av_sig_chg(tBTA_AV_DATA *p_data)
    else
    {
        /* disconnected. */
        APPL_TRACE_DEBUG("%s: bta_av_cb.conn_lcb is %d", __func__, bta_av_cb.conn_lcb);

        p_lcb = bta_av_find_lcb(p_data->str_msg.bd_addr, BTA_AV_LCB_FREE);
        if (p_lcb && p_lcb->conn_msk)
        if (p_lcb && (p_lcb->conn_msk || bta_av_cb.conn_lcb))
        {
            APPL_TRACE_DEBUG("conn_msk: 0x%x", p_lcb->conn_msk);
            /* clean up ssm  */
            for(xx=0; xx < BTA_AV_NUM_STRS; xx++)
            {
                mask = 1 << (xx + 1);
                if ((mask & p_lcb->conn_msk) && (p_cb->p_scb[xx]) &&
                if (((mask & p_lcb->conn_msk) || bta_av_cb.conn_lcb) && (p_cb->p_scb[xx]) &&
                    (bdcmp(p_cb->p_scb[xx]->peer_addr, p_data->str_msg.bd_addr) == 0))
                {
                    APPL_TRACE_DEBUG("%s: Sending AVDT_DISCONNECT_EVT", __func__);
                    bta_av_ssm_execute(p_cb->p_scb[xx], BTA_AV_AVDT_DISCONNECT_EVT, NULL);
                }
            }
        }
    }
    APPL_TRACE_DEBUG("conn_lcb: 0x%x", p_cb->conn_lcb);
    APPL_TRACE_DEBUG("%s: sig_chg conn_lcb: 0x%x", __func__, p_cb->conn_lcb);
}

/*******************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ static const UINT8 bta_av_sst_incoming[][BTA_AV_NUM_COLS] =
/* STR_RECONFIG_CFM_EVT */  {BTA_AV_SIGNORE,        BTA_AV_SIGNORE,        BTA_AV_INCOMING_SST },
/* AVRC_TIMER_EVT */        {BTA_AV_SIGNORE,        BTA_AV_SIGNORE,        BTA_AV_INCOMING_SST },
/* AVDT_CONNECT_EVT */      {BTA_AV_SIGNORE,        BTA_AV_SIGNORE,        BTA_AV_INCOMING_SST },
/* AVDT_DISCONNECT_EVT */   {BTA_AV_CCO_CLOSE,      BTA_AV_CLEANUP,        BTA_AV_INIT_SST },
/* AVDT_DISCONNECT_EVT */   {BTA_AV_CCO_CLOSE,      BTA_AV_DISCONNECT_REQ, BTA_AV_CLOSING_SST },
/* ROLE_CHANGE_EVT*/        {BTA_AV_SIGNORE,        BTA_AV_SIGNORE,        BTA_AV_INCOMING_SST },
/* AVDT_DELAY_RPT_EVT */    {BTA_AV_DELAY_CO,       BTA_AV_SIGNORE,        BTA_AV_INCOMING_SST },
/* ACP_CONNECT_EVT */       {BTA_AV_SIGNORE,        BTA_AV_SIGNORE,        BTA_AV_INCOMING_SST },
+7 −0
Original line number Diff line number Diff line
@@ -579,6 +579,13 @@ static BOOLEAN btif_av_state_opening_handler(btif_sm_event_t event, void *p_data
            BTIF_TRACE_ERROR("BTIF_AV_OFFLOAD_START_REQ_EVT: Stream not Started OPENING");
            break;

        case BTA_AV_CLOSE_EVT:
            btif_a2dp_on_stopped(NULL);
            btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
                    &(btif_av_cb.peer_bda));
            btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
            break;

        CHECK_RC_EVENT(event, p_data);

        default: