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

Commit 1c1f2e26 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

Introduce ACL_CONN is_enceypted am: 94d310a0

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

Change-Id: Ic9e98e076f21bfde9ce83c33970d5fa1ba650fa6
parents 443a931f 94d310a0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ typedef struct {
  }

 public:
  bool is_encrypted = false;
  uint8_t link_role;
  uint8_t lmp_version;
  uint8_t switch_role_failed_attempts;
+3 −4
Original line number Diff line number Diff line
@@ -576,10 +576,7 @@ tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role) {
  }
  /* some devices do not support switch while encryption is on */
  else {
    tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(remote_bd_addr);
    if ((p_dev_rec != NULL) &&
        ((p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED) != 0) &&
        !BTM_EPR_AVAILABLE(p_acl)) {
    if (p_acl->is_encrypted && !BTM_EPR_AVAILABLE(p_acl)) {
      /* bypass turning off encryption if change link key is already doing it */
      p_acl->set_encryption_off();
      p_acl->set_switch_role_encryption_off();
@@ -617,6 +614,8 @@ void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
  else
    return;

  p->is_encrypted = encr_enable;

  /* Process Role Switch if active */
  if (p->is_switch_role_encryption_off()) {
    /* if encryption turn off failed we still will try to switch role */