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

Commit 5771290a authored by William Escande's avatar William Escande Committed by Cherrypicker Worker
Browse files

Replace build time authentication config with runtime

BTM_DISABLE_CONCURRENT_PEER_AUTH is now replaced with a system
properties:
  bluetooth.btm.sec.concurrent_peer_auth.enabled

Note that the condition is inverted to match the system_properties
pattern that looks for enabled and not ~disabled~

Bug: 263323082
Test: manual
Change-Id: Iabc456f2ec67840d633965e61eef3c2047fcc504
(cherry picked from commit 4ced26a7)
Merged-In: Iabc456f2ec67840d633965e61eef3c2047fcc504
parent e274973f
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1026,8 +1026,4 @@

#include "bt_trace.h"

#ifndef BTM_DISABLE_CONCURRENT_PEER_AUTH
#define BTM_DISABLE_CONCURRENT_PEER_AUTH FALSE
#endif

#endif /* BT_TARGET_H */
+12 −7
Original line number Diff line number Diff line
@@ -154,6 +154,14 @@ static void NotifyBondingChange(tBTM_SEC_DEV_REC& p_dev_rec,
  }
}

static bool concurrentPeerAuthIsEnabled() {
  // Was previously named BTM_DISABLE_CONCURRENT_PEER_AUTH.
  // Renamed to ENABLED for homogeneity with system properties
  static const bool sCONCURRENT_PEER_AUTH_IS_ENABLED = osi_property_get_bool(
      "bluetooth.btm.sec.concurrent_peer_auth.enabled", true);
  return sCONCURRENT_PEER_AUTH_IS_ENABLED;
}

void NotifyBondingCanceled(tBTM_STATUS btm_status) {
  if (btm_cb.api.p_bond_cancel_cmpl_callback) {
    btm_cb.api.p_bond_cancel_cmpl_callback(BTM_SUCCESS);
@@ -3407,11 +3415,9 @@ void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
                      __func__, p_dev_rec, p_dev_rec->p_callback);
      p_dev_rec->p_callback = NULL;
      l2cu_resubmit_pending_sec_req(&p_dev_rec->bd_addr);
#ifdef BTM_DISABLE_CONCURRENT_PEER_AUTH
    } else if (BTM_DISABLE_CONCURRENT_PEER_AUTH &&
    } else if (!concurrentPeerAuthIsEnabled() &&
               p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING) {
      p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
#endif
    }
    return;
  }
@@ -4036,10 +4042,9 @@ void btm_sec_link_key_request(const uint8_t* p_event) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_or_alloc_dev(bda);

  VLOG(2) << __func__ << " bda: " << bda;
#if (defined(BTM_DISABLE_CONCURRENT_PEER_AUTH) && \
     (BTM_DISABLE_CONCURRENT_PEER_AUTH == TRUE))
  if (!concurrentPeerAuthIsEnabled()) {
    p_dev_rec->sec_state = BTM_SEC_STATE_AUTHENTICATING;
#endif
  }

  if ((btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_PIN_REQ) &&
      (btm_cb.collision_start_time != 0) &&