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

Commit eb8cbeb6 authored by Chienyuan's avatar Chienyuan Committed by Automerger Merge Worker
Browse files

Remove device from filter accept list before delete device record am: 8f408362

parents 26ce64bb 8f408362
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1338,12 +1338,16 @@ void shim::legacy::Acl::CancelClassicConnection(const hci::Address& address) {
void shim::legacy::Acl::AcceptLeConnectionFrom(
    const hci::AddressWithType& address_with_type, bool is_direct,
    std::promise<bool> promise) {
  LOG_DEBUG("AcceptLeConnectionFrom %s",
            PRIVATE_ADDRESS(address_with_type.GetAddress()));
  handler_->CallOn(pimpl_.get(), &Acl::impl::accept_le_connection_from,
                   address_with_type, is_direct, std::move(promise));
}

void shim::legacy::Acl::IgnoreLeConnectionFrom(
    const hci::AddressWithType& address_with_type) {
  LOG_DEBUG("IgnoreLeConnectionFrom %s",
            PRIVATE_ADDRESS(address_with_type.GetAddress()));
  handler_->CallOn(pimpl_.get(), &Acl::impl::ignore_le_connection_from,
                   address_with_type);
}
+15 −2
Original line number Diff line number Diff line
@@ -205,8 +205,14 @@ bool BTM_AcceptlistAdd(const RawAddress& address) {
    LOG_WARN("Controller does not support Le");
    return false;
  }

  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, btm_find_dev(address)),
      convert_to_address_with_type(address, p_dev_rec),
      /* is_direct */ false);
}

@@ -216,8 +222,15 @@ void BTM_AcceptlistRemove(const RawAddress& address) {
    LOG_WARN("Controller does not support Le");
    return;
  }

  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, btm_find_dev(address)));
      convert_to_address_with_type(address, p_dev_rec));
  return;
}

/** Clear the acceptlist, end any pending acceptlist connections */
+9 −0
Original line number Diff line number Diff line
@@ -136,6 +136,9 @@ void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec) {
  list_remove(btm_cb.sec_dev_rec, p_dev_rec);
}

/** Removes the device from acceptlist */
extern void BTM_AcceptlistRemove(const RawAddress& address);

/** Free resources associated with the device associated with |bd_addr| address.
 *
 * *** WARNING ***
@@ -162,6 +165,12 @@ 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",
               PRIVATE_ADDRESS(bd_addr));
      BTM_AcceptlistRemove(p_dev_rec->bd_addr);
    }

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