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

Commit eaccceb8 authored by Bhushan Shinkar's avatar Bhushan Shinkar Committed by Yuyang Huang
Browse files

HFP: Closing Rfcomm connection instead of resetting the connection

Bug: 305054669
Bug: 316993992
Test: m .
Change-Id: I3a74910a4896162529ee91fe5a77764fe8a3db57
parent 44ecf517
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -573,10 +573,13 @@ void bta_ag_rfc_acp_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) {
      }
    }
    if (dev_addr == ag_scb.peer_addr && p_scb != &ag_scb) {
      VLOG(1) << __func__ << ": fail outgoing connection before accepting "
              << ag_scb.peer_addr;
      LOG(INFO) << __func__ << ": close outgoing connection before accepting "
                << ag_scb.peer_addr << " with conn_handle="
                << ag_scb.conn_handle;
      if (!IS_FLAG_ENABLED(close_rfcomm_instead_of_reset)) {
        // Fail the outgoing connection to clean up any upper layer states
        bta_ag_rfc_fail(&ag_scb, tBTA_AG_DATA::kEmpty);
      }
      // If client port is opened, close it
      if (ag_scb.conn_handle > 0) {
        status = RFCOMM_RemoveConnection(ag_scb.conn_handle);
@@ -588,7 +591,7 @@ void bta_ag_rfc_acp_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) {
        }
      }
    }
    VLOG(1) << __func__ << ": dev_addr=" << dev_addr
    LOG(INFO) << __func__ << ": dev_addr=" << dev_addr
              << ", peer_addr=" << ag_scb.peer_addr
              << ", in_use=" << ag_scb.in_use
              << ", index=" << bta_ag_scb_to_idx(p_scb);