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

Commit 1e0a61f7 authored by Ayan Ghosh's avatar Ayan Ghosh Committed by Andre Eisenbach
Browse files

Restart sniff timer on AVDTP signalling channel establishment

VolksWagan UHV Preminum takes time to initiate AVDTP media channel
after AVDTP signalling channel is up. If mentioned duration exceeds
7 seconds then ACL link goes into sniff due to which A2dp Connection
fails.

With this change we make sure that when AVDTP signalling channel
is up and media channel is not connected we do not go to sniff,
which is achieved by restarting sniff timer on signalling channel up
so that link does not go to sniff in between ongoing connection.

Change-Id: Ic3f268703067155ffd55a43f320ce199641c6b3f
parent a7f75765
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1593,6 +1593,9 @@ void bta_av_sig_chg(tBTA_AV_DATA *p_data)
                         */
                        bta_av_signalling_timer(NULL);

                        APPL_TRACE_DEBUG("%s: Re-start timer for AVDTP service", __func__);
                        bta_sys_conn_open(BTA_ID_AV, p_cb->p_scb[xx]->app_id,
                                p_cb->p_scb[xx]->peer_addr);
                        /* Possible collision : need to avoid outgoing processing while the timer is running */
                        p_cb->p_scb[xx]->coll_mask = BTA_AV_COLL_INC_TMR;
                        alarm_set_on_queue(p_cb->accept_signalling_timer,
@@ -1634,6 +1637,13 @@ void bta_av_sig_chg(tBTA_AV_DATA *p_data)
            /* clean up ssm  */
            for(xx=0; xx < BTA_AV_NUM_STRS; xx++)
            {

                if ((p_cb->p_scb[xx]) &&
                        (bdcmp(p_cb->p_scb[xx]->peer_addr, p_data->str_msg.bd_addr) == 0))
                {
                    APPL_TRACE_DEBUG("%s: Closing timer for AVDTP service", __func__);
                    bta_sys_conn_close(BTA_ID_AV, p_cb->p_scb[xx]->app_id,p_cb->p_scb[xx]->peer_addr);
                }
                mask = 1 << (xx + 1);
                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))
+28 −0
Original line number Diff line number Diff line
@@ -1628,3 +1628,31 @@ bool btif_av_peer_supports_3mbps(void) {
                   btif_av_is_connected(), is3mbps);
  return (btif_av_is_connected() && is3mbps);
}

/*******************************************************************************
**
** Function         btif_av_move_idle
**
** Description      Opening state is intermediate state. It cannot handle
**                  incoming/outgoing connect/disconnect requests.When ACL
**                  is disconnected and we are in opening state then move back
**                  to idle state which is proper to handle connections.
**
** Returns          Void
**
*******************************************************************************/
void btif_av_move_idle(bt_bdaddr_t bd_addr)
{
    /* inform the application that ACL is disconnected and move to idle state */
    btif_sm_state_t state = btif_sm_get_state(btif_av_cb.sm_handle);
    BTIF_TRACE_DEBUG("%s: ACL Disconnected state %d  is same device %d", __func__,
            state, memcmp (&bd_addr, &(btif_av_cb.peer_bda), sizeof(bd_addr)));
    if (state == BTIF_AV_STATE_OPENING &&
            (memcmp (&bd_addr, &(btif_av_cb.peer_bda), sizeof(bd_addr)) == 0))
    {
        BTIF_TRACE_DEBUG("%s: Moving State from Opening to Idle due to ACL disconnect", __func__);
        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);
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ extern bt_status_t btif_sdp_execute_service(bool b_enable);
extern int btif_hh_connect(bt_bdaddr_t* bd_addr);
extern void bta_gatt_convert_uuid16_to_uuid128(uint8_t uuid_128[LEN_UUID_128],
                                               uint16_t uuid_16);
extern void btif_av_move_idle(bt_bdaddr_t bd_addr);

/******************************************************************************
 *  Functions
@@ -1733,6 +1734,7 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
    case BTA_DM_LINK_DOWN_EVT:
      bdcpy(bd_addr.address, p_data->link_down.bd_addr);
      btm_set_bond_type_dev(p_data->link_down.bd_addr, BOND_TYPE_UNKNOWN);
      btif_av_move_idle(bd_addr);
      BTIF_TRACE_DEBUG(
          "BTA_DM_LINK_DOWN_EVT. Sending BT_ACL_STATE_DISCONNECTED");
      HAL_CBACK(bt_hal_cbacks, acl_state_changed_cb, BT_STATUS_SUCCESS,