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

Commit 0ff5f570 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Do not ignore timeout for bonding devices

We should ignore timeout only for bonded devices.

Test: mma -j32
Test: pts-bot GAP#GAP/SEC/SEM/BV-04-C
Bug: 382119799
Bug: 309141668
Flag: exempt, trivial fix
Change-Id: Ia14383c91a85f7bda97e75749420f11b46829592
parent 84d76f6c
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -3384,16 +3384,20 @@ static void btif_dm_ble_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
        break;

      case BTA_DM_AUTH_SMP_CONN_TOUT: {
        if (!p_auth_cmpl->is_ctkd && btm_sec_is_a_bonded_dev(bd_addr)) {
        bool during_bonding =
                (bd_addr == pairing_cb.bd_addr || bd_addr == pairing_cb.static_bdaddr);

        if (during_bonding || p_auth_cmpl->is_ctkd || !btm_sec_is_a_bonded_dev(bd_addr)) {
          log::info("Removing ble bonding keys on SMP_CONN_TOUT during_bonding: {}, is_ctkd: {}",
                    during_bonding, p_auth_cmpl->is_ctkd);
          btif_dm_remove_ble_bonding_keys();
          status = BT_STATUS_AUTH_FAILURE;
        } else {
          log::warn("Bonded device addr={}, timed out - will not remove the keys", bd_addr);
          // Don't send state change to upper layers - otherwise Java think we
          // unbonded, and will disconnect HID profile.
          return;
        }
        log::info("Removing ble bonding keys on SMP_CONN_TOUT during crosskey: {}",
                  p_auth_cmpl->is_ctkd);
        btif_dm_remove_ble_bonding_keys();
        status = BT_STATUS_AUTH_FAILURE;
        break;
      }
      case BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT: