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

Commit f9e78274 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Remove def BTM_DISC_DURING_RS am: 413e8381

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1407403

Change-Id: I912567fc34ec52e514d735328d8dd23ff44ae38b
parents b7a83271 413e8381
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -650,9 +650,7 @@ tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role) {
      btsnd_hcic_switch_role(remote_bd_addr, new_role);
      p->switch_role_state = BTM_ACL_SWKEY_STATE_IN_PROGRESS;

#if (BTM_DISC_DURING_RS == TRUE)
      if (p_dev_rec) p_dev_rec->rs_disc_pending = BTM_SEC_RS_PENDING;
#endif
    }
  }

@@ -698,10 +696,8 @@ void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
    }

    btsnd_hcic_switch_role(p->remote_addr, (uint8_t)!p->link_role);
#if (BTM_DISC_DURING_RS == TRUE)
    p_dev_rec = btm_find_dev(p->remote_addr);
    if (p_dev_rec != NULL) p_dev_rec->rs_disc_pending = BTM_SEC_RS_PENDING;
#endif

  }
  /* Finished enabling Encryption after role switch */
@@ -718,7 +714,6 @@ void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
        "%s: Role Switch Event: new_role 0x%02x, HCI Status 0x%02x, rs_st:%d",
        __func__, new_role, hci_status, p->switch_role_state);

#if (BTM_DISC_DURING_RS == TRUE)
    /* If a disconnect is pending, issue it now that role switch has completed
     */
    p_dev_rec = btm_find_dev(p->remote_addr);
@@ -733,7 +728,6 @@ void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
          PTR_TO_UINT(p_dev_rec), p_dev_rec->rs_disc_pending);
      p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
    }
#endif
  }
}

@@ -1554,7 +1548,6 @@ void btm_acl_role_changed(uint8_t hci_status, const RawAddress& bd_addr,
      __func__, bd_addr.ToString().c_str(), p_switch_role->role,
      p_switch_role->hci_status, p_acl->switch_role_state);

#if (BTM_DISC_DURING_RS == TRUE)
  /* If a disconnect is pending, issue it now that role switch has completed */
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
  if (p_dev_rec != nullptr) {
@@ -1567,7 +1560,6 @@ void btm_acl_role_changed(uint8_t hci_status, const RawAddress& bd_addr,
                    bd_addr.ToString().c_str(), p_dev_rec->rs_disc_pending);
    p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
  }
#endif
}

/*******************************************************************************
@@ -2218,14 +2210,12 @@ tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  tBTM_STATUS status = BTM_SUCCESS;

  BTM_TRACE_DEBUG("btm_remove_acl");
#if (BTM_DISC_DURING_RS == TRUE)
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);

  /* Role Switch is pending, postpone until completed */
  if (p_dev_rec && (p_dev_rec->rs_disc_pending == BTM_SEC_RS_PENDING)) {
    p_dev_rec->rs_disc_pending = BTM_SEC_DISC_PENDING;
  } else /* otherwise can disconnect right away */
#endif
  {
    if (hci_handle != HCI_INVALID_HANDLE && p_dev_rec &&
        p_dev_rec->sec_state != BTM_SEC_STATE_DISCONNECTING) {
@@ -2286,9 +2276,7 @@ void btm_cont_rswitch(tACL_CONN* p, tBTM_SEC_DEV_REC* p_dev_rec) {
    {
      if (p->switch_role_state == BTM_ACL_SWKEY_STATE_MODE_CHANGE) {
        p->switch_role_state = BTM_ACL_SWKEY_STATE_IN_PROGRESS;
#if (BTM_DISC_DURING_RS == TRUE)
        if (p_dev_rec) p_dev_rec->rs_disc_pending = BTM_SEC_RS_PENDING;
#endif
        btsnd_hcic_switch_role(p->remote_addr, (uint8_t)!p->link_role);
      }
    }
+0 −6
Original line number Diff line number Diff line
@@ -3588,9 +3588,7 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
              btm_sec_change_pairing_state(BTM_PAIR_STATE_IDLE);
            }
          }
#if (BTM_DISC_DURING_RS == TRUE)
          p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
#endif
          return;
        } else {
          l2cu_update_lcb_4_bonding(p_dev_rec->bd_addr, true);
@@ -3603,9 +3601,7 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,

  p_dev_rec->device_type |= BT_DEVICE_TYPE_BREDR;

#if (BTM_DISC_DURING_RS == TRUE)
  p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
#endif

  p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */

@@ -3864,11 +3860,9 @@ void btm_sec_disconnected(uint16_t handle, uint8_t reason) {

  p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */

#if (BTM_DISC_DURING_RS == TRUE)
  LOG_INFO("%s clearing pending flag handle:%d reason:%d", __func__, handle,
           reason);
  p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
#endif

  /* clear unused flags */
  p_dev_rec->sm4 &= BTM_SM4_TRUE;
+0 −2
Original line number Diff line number Diff line
@@ -457,11 +457,9 @@ typedef struct {
  tBTM_SEC_BLE ble;
  tBTM_LE_CONN_PRAMS conn_params;

#if (BTM_DISC_DURING_RS == TRUE)
#define BTM_SEC_RS_NOT_PENDING 0 /* Role Switch not in progress */
#define BTM_SEC_RS_PENDING 1     /* Role Switch in progress */
#define BTM_SEC_DISC_PENDING 2   /* Disconnect is pending */
  uint8_t rs_disc_pending;
#endif

} tBTM_SEC_DEV_REC;