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

Commit 0ac90f1c authored by Hansong Zhang's avatar Hansong Zhang
Browse files

ACL: btm_cont_rswitch no longer needs dev rec

We know is_encrypted.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I3773bd20efe349bc0f9e91f559e393d70a8964dc
parent c35b5c22
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ extern tBTM_CB btm_cb;

static void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p,
                                              uint16_t* p_pkt_type);
static void btm_cont_rswitch(tACL_CONN* p, tBTM_SEC_DEV_REC* p_dev_rec);
static void btm_cont_rswitch(tACL_CONN* p);
static void btm_read_automatic_flush_timeout_timeout(void* data);
static void btm_read_failed_contact_counter_timeout(void* data);
static void btm_read_remote_ext_features(uint16_t handle, uint8_t page_number);
@@ -2179,16 +2179,14 @@ uint8_t BTM_SetTraceLevel(uint8_t new_level) {
 * Returns          void
 *
 ******************************************************************************/
void btm_cont_rswitch(tACL_CONN* p, tBTM_SEC_DEV_REC* p_dev_rec) {
void btm_cont_rswitch(tACL_CONN* p) {
  /* Check to see if encryption needs to be turned off if pending
     change of link key or role switch */
  if (p->is_switch_role_mode_change()) {
    /* Must turn off Encryption first if necessary */
    /* Some devices do not support switch or change of link key while encryption
     * is on */
    if (p_dev_rec != NULL &&
        ((p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED) != 0) &&
        !BTM_EPR_AVAILABLE(p)) {
    if (p->is_encrypted && !BTM_EPR_AVAILABLE(p)) {
      p->set_encryption_off();
      if (p->is_switch_role_mode_change()) {
        p->set_switch_role_encryption_off();
@@ -2211,7 +2209,7 @@ void btm_cont_rswitch_from_handle(uint16_t hci_handle) {
    LOG_WARN("Role switch received but with no active ACL");
    return;
  }
  btm_cont_rswitch(p_acl, btm_find_dev(p_acl->remote_addr));
  btm_cont_rswitch(p_acl);
}

/*******************************************************************************