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

Commit 16331c52 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

ACL: Move some security flag change to Security am: 1dbff51c am: 12235e7f

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

Change-Id: I4879b8373cdee88806ab7015cea680310ab50726
parents 4ab82ac5 12235e7f
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -487,18 +487,6 @@ void btm_acl_removed(uint16_t handle) {
    BTA_dm_acl_down(bda, transport);
  }

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bda);
  if (p_dev_rec == nullptr) {
    LOG_WARN("Device security record not found");
  } else {
    if (p_acl->transport == BT_TRANSPORT_LE) {
      p_dev_rec->sec_flags &= ~(BTM_SEC_LE_ENCRYPTED | BTM_SEC_ROLE_SWITCHED);
      if ((p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN) == 0) {
        p_dev_rec->sec_flags &=
            ~(BTM_SEC_LE_LINK_KEY_AUTHED | BTM_SEC_LE_AUTHENTICATED);
      }
    }
  }
  memset(p_acl, 0, sizeof(tACL_CONN));
}

+7 −1
Original line number Diff line number Diff line
@@ -3729,9 +3729,15 @@ void btm_sec_disconnected(uint16_t handle, tHCI_STATUS reason) {

  if (transport == BT_TRANSPORT_LE) {
    p_dev_rec->ble_hci_handle = HCI_INVALID_HANDLE;
    p_dev_rec->sec_flags &= ~(BTM_SEC_LE_AUTHENTICATED | BTM_SEC_LE_ENCRYPTED);
    p_dev_rec->sec_flags &= ~(BTM_SEC_LE_AUTHENTICATED | BTM_SEC_LE_ENCRYPTED |
                              BTM_SEC_ROLE_SWITCHED);
    p_dev_rec->enc_key_size = 0;

    if ((p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN) == 0) {
      p_dev_rec->sec_flags &=
          ~(BTM_SEC_LE_LINK_KEY_AUTHED | BTM_SEC_LE_AUTHENTICATED);
    }

    // This is for chips that don't support being in connected and advertising
    // state at same time.
    if (!p_dev_rec->is_originator) {