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

Commit 89e87d64 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

GAP: Simplify gap_sec_check_complete

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ie0c2404964e6941c7d993b2f5230beda35eb8244
parent d9cc779c
Loading
Loading
Loading
Loading
+4 −16
Original line number Original line Diff line number Diff line
@@ -661,22 +661,10 @@ static void gap_checks_con_flags(tGAP_CCB* p_ccb) {
 * Returns          void
 * Returns          void
 *
 *
 ******************************************************************************/
 ******************************************************************************/
static void gap_sec_check_complete(const RawAddress*, tBT_TRANSPORT,
static void gap_sec_check_complete(tGAP_CCB* p_ccb) {
                                   void* p_ref_data, uint8_t res) {
  tGAP_CCB* p_ccb = (tGAP_CCB*)p_ref_data;

  DVLOG(1) << StringPrintf(
      "gap_sec_check_complete conn_state:%d, conn_flags:0x%x, status:%d",
      p_ccb->con_state, p_ccb->con_flags, res);
  if (p_ccb->con_state == GAP_CCB_STATE_IDLE) return;
  if (p_ccb->con_state == GAP_CCB_STATE_IDLE) return;

  if (res == BTM_SUCCESS) {
  p_ccb->con_flags |= GAP_CCB_FLAGS_SEC_DONE;
  p_ccb->con_flags |= GAP_CCB_FLAGS_SEC_DONE;
  gap_checks_con_flags(p_ccb);
  gap_checks_con_flags(p_ccb);
  } else {
    /* security failed - disconnect the channel */
    L2CA_DisconnectReq(p_ccb->connection_id);
  }
}
}


static void gap_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
static void gap_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
@@ -712,7 +700,7 @@ static void gap_connect_cfm(uint16_t l2cap_cid, uint16_t result) {
  if ((p_ccb->con_flags & GAP_CCB_FLAGS_SEC_DONE) == 0 &&
  if ((p_ccb->con_flags & GAP_CCB_FLAGS_SEC_DONE) == 0 &&
      p_ccb->transport != BT_TRANSPORT_LE) {
      p_ccb->transport != BT_TRANSPORT_LE) {
    // Assume security check is done by L2cap
    // Assume security check is done by L2cap
    gap_sec_check_complete(nullptr, BT_TRANSPORT_BR_EDR, p_ccb, BTM_SUCCESS);
    gap_sec_check_complete(p_ccb);
  }
  }


  /* If the connection response contains success status, then */
  /* If the connection response contains success status, then */