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

Commit f0e59bfe authored by Cheney Ni's avatar Cheney Ni
Browse files

A2DP: Clear the collision mask while disconnecting

While remote is opening AVDTP channel, the stack setup a coll_mask
flags with a signalling timer, and takes over the control after timer
expired. This prevents the connection collision. However, if there were
two incoming connections at the same time, the timer was overridden by
the second connection, and this flags of the first connection kept
activated, but the following outgoing connection was blocked. In order
to prevent the worng flags, this change reset flags while disconnecting.

Bug: 146849922
Test: Connect with multiple A2DP sinks
Change-Id: I4baff647d22f1148bf6fa2b61e778652c9c90091
parent 213f0559
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -922,6 +922,7 @@ void bta_av_cleanup(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) {
  p_scb->cur_psc_mask = 0;
  p_scb->wait = 0;
  p_scb->num_disc_snks = 0;
  p_scb->coll_mask = 0;
  alarm_cancel(p_scb->avrc_ct_timer);

  /* TODO(eisenbach): RE-IMPLEMENT USING VSC OR HAL EXTENSION
@@ -1398,15 +1399,16 @@ void bta_av_do_close(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) {
 *
 ******************************************************************************/
void bta_av_connect_req(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) {
  APPL_TRACE_DEBUG("%s: peer %s coll_mask:0x%x", __func__,
  APPL_TRACE_DEBUG("%s: peer %s coll_mask=0x%02x", __func__,
                   p_scb->PeerAddress().ToString().c_str(), p_scb->coll_mask);
  p_scb->sdp_discovery_started = false;
  if (p_scb->coll_mask & BTA_AV_COLL_INC_TMR) {
    /* SNK initiated L2C connection while SRC was doing SDP.    */
    /* Wait until timeout to check if SNK starts signalling.    */
    APPL_TRACE_EVENT("%s: coll_mask = 0x%2X", __func__, p_scb->coll_mask);
    APPL_TRACE_WARNING("%s: coll_mask=0x%02x incoming timer is up", __func__,
                       p_scb->coll_mask);
    p_scb->coll_mask |= BTA_AV_COLL_API_CALLED;
    APPL_TRACE_EVENT("%s: updated coll_mask = 0x%2X", __func__,
    APPL_TRACE_EVENT("%s: updated coll_mask=0x%02x", __func__,
                     p_scb->coll_mask);
    return;
  }
@@ -3057,7 +3059,7 @@ void bta_av_open_rc(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
void bta_av_open_at_inc(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  memcpy(&(p_scb->open_api), &(p_data->api_open), sizeof(tBTA_AV_API_OPEN));

  APPL_TRACE_DEBUG("%s: peer %s coll_mask:0x%x", __func__,
  APPL_TRACE_DEBUG("%s: peer %s coll_mask=0x%02x", __func__,
                   p_scb->PeerAddress().ToString().c_str(), p_scb->coll_mask);

  if (p_scb->coll_mask & BTA_AV_COLL_INC_TMR) {
+1 −1
Original line number Diff line number Diff line
@@ -1567,7 +1567,7 @@ static void bta_av_accept_signalling_timer_cback(void* data) {
    p_scb = p_cb->p_scb[inx];
  }
  if (p_scb) {
    APPL_TRACE_DEBUG("%s: coll_mask = 0x%02X", __func__, p_scb->coll_mask);
    APPL_TRACE_DEBUG("%s: coll_mask=0x%02x", __func__, p_scb->coll_mask);

    if (p_scb->coll_mask & BTA_AV_COLL_INC_TMR) {
      p_scb->coll_mask &= ~BTA_AV_COLL_INC_TMR;