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

Commit 6f640052 authored by Rahul Arya's avatar Rahul Arya
Browse files

[Connection Manager] Remove unused flags

Dead code removal. The only logical change is that now, on unbond, we
unconditionally remove the device from the allowlist, rather than
checking before doing so. But the le_impl checks for this anyway,
here: https://source.corp.google.com/aosp-master/packages/modules/Bluetooth/system/gd/hci/acl_manager/le_impl.h;l=794?q=%22acceptlist%20and%20cannot%20be%20removed%22

Bug: 272572974
Test: compiles
Change-Id: I3414348552e02426b9b210517cd5c5da862b9f78
parent 629d585c
Loading
Loading
Loading
Loading
+0 −32
Original line number Diff line number Diff line
@@ -170,32 +170,6 @@ bool BTM_BackgroundConnectAddressKnown(const RawAddress& address) {
  return false;
}

bool BTM_SetLeConnectionModeToFast() {
  VLOG(2) << __func__;
  tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb;
  if ((p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF &&
       p_cb->scan_win == BTM_BLE_SCAN_PARAM_UNDEF) ||
      (p_cb->scan_int == BTM_BLE_SCAN_SLOW_INT_1 &&
       p_cb->scan_win == BTM_BLE_SCAN_SLOW_WIN_1)) {
    p_cb->scan_int = BTM_BLE_SCAN_FAST_INT;
    p_cb->scan_win = BTM_BLE_SCAN_FAST_WIN;
    return true;
  }
  return false;
}

void BTM_SetLeConnectionModeToSlow() {
  VLOG(2) << __func__;
  tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb;
  if ((p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF &&
       p_cb->scan_win == BTM_BLE_SCAN_PARAM_UNDEF) ||
      (p_cb->scan_int == BTM_BLE_SCAN_FAST_INT &&
       p_cb->scan_win == BTM_BLE_SCAN_FAST_WIN)) {
    p_cb->scan_int = BTM_BLE_SCAN_SLOW_INT_1;
    p_cb->scan_win = BTM_BLE_SCAN_SLOW_WIN_1;
  }
}

/** Adds the device into acceptlist. Returns false if acceptlist is full and
 * device can't be added, true otherwise. */
bool BTM_AcceptlistAdd(const RawAddress& address) {
@@ -205,9 +179,6 @@ bool BTM_AcceptlistAdd(const RawAddress& address) {
  }

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(address);
  if (p_dev_rec != NULL && p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) {
    p_dev_rec->ble.in_controller_list |= BTM_ACCEPTLIST_BIT;
  }

  return bluetooth::shim::ACL_AcceptLeConnectionFrom(
      convert_to_address_with_type(address, p_dev_rec),
@@ -222,9 +193,6 @@ void BTM_AcceptlistRemove(const RawAddress& address) {
  }

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(address);
  if (p_dev_rec != NULL && p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) {
    p_dev_rec->ble.in_controller_list &= ~BTM_ACCEPTLIST_BIT;
  }

  bluetooth::shim::ACL_IgnoreLeConnectionFrom(
      convert_to_address_with_type(address, p_dev_rec));
+0 −11
Original line number Diff line number Diff line
@@ -27,14 +27,3 @@ extern void BTM_AcceptlistRemove(const RawAddress& address);

/** Clear the acceptlist, end any pending acceptlist connections */
extern void BTM_AcceptlistClear();

/* Use fast scan window/interval for LE connection establishment.
 * This does not send any requests to controller, instead it changes the
 * parameters that will be used after next add/remove request.
 * Returns true, if the change is scheduled, false otherwise. */
extern bool BTM_SetLeConnectionModeToFast();

/* Use slow scan window/interval for LE connection establishment.
 * This does not send any requests to controller, instead it changes the
 * parameters that will be used after next add/remove request */
extern void BTM_SetLeConnectionModeToSlow();
+0 −3
Original line number Diff line number Diff line
@@ -3478,9 +3478,6 @@ void btm_ble_init(void) {
  p_cb->inq_var.fast_adv_timer = alarm_new("btm_ble_inq.fast_adv_timer");
  p_cb->inq_var.inquiry_timer = alarm_new("btm_ble_inq.inquiry_timer");

  /* for background connection, reset connection params to be undefined */
  p_cb->scan_int = p_cb->scan_win = BTM_BLE_SCAN_PARAM_UNDEF;

  p_cb->inq_var.evt_type = BTM_BLE_NON_CONNECT_EVT;

  p_cb->addr_mgnt_cb.refresh_raddr_timer =
+0 −16
Original line number Diff line number Diff line
@@ -248,22 +248,6 @@ typedef struct {
  /* target announcement observer */
  tBTM_INQ_RESULTS_CB* p_target_announcement_obs_results_cb;

  /* background connection procedure cb value */
  uint16_t scan_int;
  uint16_t scan_win;

  /* acceptlist information */
  uint8_t wl_state;
  void set_acceptlist_process_in_progress() {
    wl_state |= BTM_BLE_ACCEPTLIST_INIT;
  }
  void reset_acceptlist_process_in_progress() {
    wl_state &= ~BTM_BLE_ACCEPTLIST_INIT;
  }
  bool is_acceptlist_in_progress() const {
    return wl_state & BTM_BLE_ACCEPTLIST_INIT;
  }

 private:
  enum : uint8_t { /* BLE connection state */
                   BLE_CONN_IDLE = 0,
+3 −5
Original line number Diff line number Diff line
@@ -174,11 +174,9 @@ bool BTM_SecDeleteDevice(const RawAddress& bd_addr) {
  if (p_dev_rec != NULL) {
    RawAddress bda = p_dev_rec->bd_addr;

    if (p_dev_rec->ble.in_controller_list & BTM_ACCEPTLIST_BIT) {
    LOG_INFO("Remove device %s from filter accept list before delete record",
             ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
    BTM_AcceptlistRemove(p_dev_rec->bd_addr);
    }

    /* Clear out any saved BLE keys */
    btm_sec_clear_ble_keys(p_dev_rec);
Loading