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

Commit 5815ab4e authored by Zhengping Jiang's avatar Zhengping Jiang Committed by Gerrit Code Review
Browse files

Merge "Revert "floss: don't add device to acceptlist if already connected"" into main

parents 758f2617 72bd7c60
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -1517,14 +1517,6 @@ void shim::legacy::Acl::CancelClassicConnection(const hci::Address& address) {
                 "classic");
}

void shim::legacy::Acl::DeviceAlreadyConnected(
    const hci::AddressWithType& address_with_type, std::promise<bool> promise) {
  auto handle =
      GetAclManager()->HACK_GetLeHandle(address_with_type.GetAddress());
  // 0xffff(kIllegalConnectionHandle) is the invalid handle.
  promise.set_value(handle != 0xffff);
}

void shim::legacy::Acl::AcceptLeConnectionFrom(
    const hci::AddressWithType& address_with_type, bool is_direct,
    std::promise<bool> promise) {
+0 −2
Original line number Diff line number Diff line
@@ -71,8 +71,6 @@ class Acl : public hci::acl_manager::ConnectionCallbacks,
  // LinkConnectionInterface
  void CreateClassicConnection(const hci::Address& address) override;
  void CancelClassicConnection(const hci::Address& address) override;
  void DeviceAlreadyConnected(const hci::AddressWithType& address_with_type,
                              std::promise<bool> promise);
  void AcceptLeConnectionFrom(const hci::AddressWithType& address_with_type,
                              bool is_direct,
                              std::promise<bool> promise) override;
+0 −10
Original line number Diff line number Diff line
@@ -56,16 +56,6 @@ void bluetooth::shim::ACL_CancelClassicConnection(
  Stack::GetInstance()->GetAcl()->CancelClassicConnection(address);
}

bool bluetooth::shim::ACL_DeviceAlreadyConnected(
    const tBLE_BD_ADDR& legacy_address_with_type) {
  std::promise<bool> promise;
  auto future = promise.get_future();
  Stack::GetInstance()->GetAcl()->DeviceAlreadyConnected(
      ToAddressWithTypeFromLegacy(legacy_address_with_type),
      std::move(promise));
  return future.get();
}

bool bluetooth::shim::ACL_AcceptLeConnectionFrom(
    const tBLE_BD_ADDR& legacy_address_with_type, bool is_direct) {
  std::promise<bool> promise;
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ namespace shim {

void ACL_CreateClassicConnection(const RawAddress& raw_address);
void ACL_CancelClassicConnection(const RawAddress& raw_address);
bool ACL_DeviceAlreadyConnected(const tBLE_BD_ADDR& legacy_address_with_type);
bool ACL_AcceptLeConnectionFrom(const tBLE_BD_ADDR& legacy_address_with_type,
                                bool is_direct);
void ACL_IgnoreLeConnectionFrom(const tBLE_BD_ADDR& legacy_address_with_type);
+0 −14
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include "stack/btm/btm_ble_bgconn.h"

#include <bluetooth/log.h>
#include <com_android_bluetooth_flags.h>

#include <cstdint>
#include <unordered_map>
@@ -39,7 +38,6 @@
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/acl_api.h"
#include "types/raw_address.h"

using namespace bluetooth;
@@ -116,18 +114,6 @@ bool BTM_AcceptlistAdd(const RawAddress& address, bool is_direct) {
    return false;
  }

  if (com::android::bluetooth::flags::verify_handle_before_add_accept_list()) {
    // Only RPA is checked here. RPA is converted to the identity address in
    // BTM_Sec_GetAddressWithType if host has resolved it. Adding the identity
    // address to accept list is not necessary if a valid handle already exists
    // for the RPA.
    if (BTM_BLE_IS_RESOLVE_BDA(address) &&
        bluetooth::shim::ACL_DeviceAlreadyConnected(
            {.type = 0x01, .bda = address})) {
      log::info("Already connected, not adding to accept list.");
      return true;
    }
  }
  return bluetooth::shim::ACL_AcceptLeConnectionFrom(
      BTM_Sec_GetAddressWithType(address), is_direct);
}
Loading