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

Commit 4b0308e5 authored by Prabhakaran Malli Chandrasekaran's avatar Prabhakaran Malli Chandrasekaran Committed by bidsharma
Browse files

Ignore additional encrypt change events when link is auth & encrypted

Bug: 243105146
Test: Tested initial setup sequence between wearable device and Phone,
made sure wearable device is ignoring the additional encrypt change
events when the link is already authenticated and encrypted.
Processing additional enc change event was causing pairing failure issues.

Change-Id: I4c85ef176296b31e094b08705ab6293aae11f927
(cherry picked from commit 63be13b923a6aa3819660488e69e3ef11d2f0c0a)
parent 76119858
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3289,6 +3289,13 @@ void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
  if (status == HCI_SUCCESS) {
    if (encr_enable) {
      if (p_dev_rec->hci_handle == handle) {  // classic
        if ((p_dev_rec->sec_flags & BTM_SEC_AUTHENTICATED) &&
            (p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED)) {
          LOG_INFO(
              "Link is authenticated & encrypted, ignoring this enc change "
              "event");
          return;
        }
        p_dev_rec->sec_flags |= (BTM_SEC_AUTHENTICATED | BTM_SEC_ENCRYPTED);
        if (p_dev_rec->pin_code_length >= 16 ||
            p_dev_rec->link_key_type == BTM_LKEY_TYPE_AUTH_COMB ||