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

Commit 3e4c27d5 authored by Chris Manton's avatar Chris Manton
Browse files

Always create connection when hci status SUCCESS

Bug: 232195935
Test: gd/cert/run
Tag: #refactor

Ignore-AOSP-First: cherry-pick
Merged-In: Ie7b6821aee38812255545b484aef7f6a6994cc85
Change-Id: Ie7b6821aee38812255545b484aef7f6a6994cc85
parent 287e72fd
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -3638,9 +3638,12 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle,
    return;
  }

  /* If initiated dedicated bonding, return the link key now, and initiate
   * disconnect */
  /* If dedicated bonding, and we now have a link key, we are all done */
  /*
   * The device is still in the pairing state machine and we now have the
   * link key.  If we have not sent the link key, send it now and remove
   * the authenticate requirement bit.  Reset the pairing state machine
   * and inform l2cap if the directed bonding was initiated.
   */
  if (is_pairing_device && (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN)) {
    if (p_dev_rec->link_key_not_sent) {
      p_dev_rec->link_key_not_sent = false;
@@ -3650,20 +3653,20 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle,
    p_dev_rec->security_required &= ~BTM_SEC_OUT_AUTHENTICATE;

    /* remember flag before it is initialized */
    bool is_pair_flags_we_started_dd = false;
    if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD)
      is_pair_flags_we_started_dd = true;
    else
      is_pair_flags_we_started_dd = false;

    const bool is_pair_flags_we_started_dd =
        btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD;
    btm_sec_change_pairing_state(BTM_PAIR_STATE_IDLE);

    if (is_pair_flags_we_started_dd) {
      /* Let l2cap start bond timer */
      l2cu_update_lcb_4_bonding(p_dev_rec->bd_addr, true);
    }

    return;
    LOG_INFO("Connection complete during pairing process peer:%s",
             PRIVATE_ADDRESS(bda));
    BTM_LogHistory(kBtmLogTag, bda, "Dedicated bonding",
                   base::StringPrintf("Initiated:%c pairing_flag:0x%02x",
                                      (is_pair_flags_we_started_dd) ? 'T' : 'F',
                                      p_dev_rec->sec_flags));
  }

  p_dev_rec->hci_handle = handle;