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

Commit 6d3122aa authored by Myles Watson's avatar Myles Watson
Browse files

Remove unused GetSecurity from shim

Bug: 301661850
Test: atest bluetooth_test_gd_unit
Flag: EXEMPT, unused code
Change-Id: Ib1be8e3431fd180176af8b6cdb740e5953b28bf7
parent 807d8841
Loading
Loading
Loading
Loading
+0 −38
Original line number Diff line number Diff line
@@ -487,44 +487,6 @@ size_t Btm::GetNumberOfAdvertisingInstances() const {
  return GetAdvertising()->GetNumberOfAdvertisingInstances();
}

tBTM_STATUS Btm::CreateBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                            tBT_TRANSPORT transport, int device_type) {
  if (transport == BT_TRANSPORT_AUTO) {
    if (device_type & BT_DEVICE_TYPE_BLE) {
      transport = BT_TRANSPORT_LE;
    } else if (device_type & BT_DEVICE_TYPE_BREDR) {
      transport = BT_TRANSPORT_BR_EDR;
    }
    LOG_INFO("%s guessing transport as %02x ", __func__, transport);
  }

  auto security_manager = GetSecurityModule()->GetSecurityManager();
  switch (transport) {
    case BT_TRANSPORT_BR_EDR:
      security_manager->CreateBond(ToAddressWithType(bd_addr, BLE_ADDR_PUBLIC));
      break;
    case BT_TRANSPORT_LE:
      security_manager->CreateBondLe(ToAddressWithType(bd_addr, addr_type));
      break;
    default:
      return BTM_ILLEGAL_VALUE;
  }
  return BTM_CMD_STARTED;
}

bool Btm::CancelBond(const RawAddress& bd_addr) {
  auto security_manager = GetSecurityModule()->GetSecurityManager();
  security_manager->CancelBond(ToAddressWithType(bd_addr, BLE_ADDR_PUBLIC));
  return true;
}

bool Btm::RemoveBond(const RawAddress& bd_addr) {
  // TODO(cmanton) Check if acl is connected
  auto security_manager = GetSecurityModule()->GetSecurityManager();
  security_manager->RemoveBond(ToAddressWithType(bd_addr, BLE_ADDR_PUBLIC));
  return true;
}

uint16_t Btm::GetAclHandle(const RawAddress& remote_bda,
                           tBT_TRANSPORT transport) {
  auto acl_manager = GetAclManager();
+0 −19
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
#include "gd/neighbor/inquiry.h"
#include "gd/neighbor/page.h"
#include "gd/os/handler.h"
#include "gd/security/security_module.h"
#include "gd/shim/dumpsys.h"
#include "gd/storage/storage_module.h"
#include "hci/acl_manager.h"
@@ -80,18 +79,6 @@ hci::HciLayer* GetHciLayer() {
  return Stack::GetInstance()->GetStackManager()->GetInstance<hci::HciLayer>();
}

l2cap::classic::L2capClassicModule* GetL2capClassicModule() {
  return Stack::GetInstance()
      ->GetStackManager()
      ->GetInstance<bluetooth::l2cap::classic::L2capClassicModule>();
}

bluetooth::l2cap::le::L2capLeModule* GetL2capLeModule() {
  return Stack::GetInstance()
      ->GetStackManager()
      ->GetInstance<bluetooth::l2cap::le::L2capLeModule>();
}

neighbor::PageModule* GetPage() {
  return Stack::GetInstance()
      ->GetStackManager()
@@ -116,12 +103,6 @@ hci::DistanceMeasurementManager* GetDistanceMeasurementManager() {
      ->GetInstance<hci::DistanceMeasurementManager>();
}

security::SecurityModule* GetSecurityModule() {
  return Stack::GetInstance()
      ->GetStackManager()
      ->GetInstance<security::SecurityModule>();
}

hal::SnoopLogger* GetSnoopLogger() {
  return Stack::GetInstance()
      ->GetStackManager()
+0 −15
Original line number Diff line number Diff line
@@ -55,22 +55,10 @@ class VendorSpecificEventManager;
class MsftExtensionManager;
}

namespace l2cap {
namespace classic {
class L2capClassicModule;
}  // namespace classic
namespace le {
class L2capLeModule;
}  // namespace le
}  // namespace l2cap

namespace metrics {
class CounterMetrics;
}

namespace security {
class SecurityModule;
}
namespace storage {
class StorageModule;
}
@@ -88,13 +76,10 @@ neighbor::ConnectabilityModule* GetConnectability();
Dumpsys* GetDumpsys();
neighbor::InquiryModule* GetInquiry();
hci::HciLayer* GetHciLayer();
l2cap::classic::L2capClassicModule* GetL2capClassicModule();
l2cap::le::L2capLeModule* GetL2capLeModule();
neighbor::PageModule* GetPage();
hci::RemoteNameRequestModule* GetRemoteNameRequest();
hci::DistanceMeasurementManager* GetDistanceMeasurementManager();
hci::LeScanningManager* GetScanning();
bluetooth::security::SecurityModule* GetSecurityModule();
hal::SnoopLogger* GetSnoopLogger();
storage::StorageModule* GetStorage();
hci::AclManager* GetAclManager();
+0 −1477

File changed.

Preview size limit exceeded, changes collapsed.

+0 −4
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@
#include "gd/neighbor/inquiry.h"
#include "gd/neighbor/page.h"
#include "gd/os/handler.h"
#include "gd/security/security_module.h"
#include "gd/storage/storage_module.h"
#include "main/shim/entry.h"

@@ -65,14 +64,11 @@ hci::DistanceMeasurementManager* GetDistanceMeasurementManager() {
hci::VendorSpecificEventManager* GetVendorSpecificEventManager() {
  return nullptr;
}
l2cap::classic::L2capClassicModule* GetL2capClassicModule() { return nullptr; }
l2cap::le::L2capLeModule* GetL2capLeModule() { return nullptr; }
neighbor::ConnectabilityModule* GetConnectability() { return nullptr; }
neighbor::DiscoverabilityModule* GetDiscoverability() { return nullptr; }
neighbor::InquiryModule* GetInquiry() { return nullptr; }
neighbor::PageModule* GetPage() { return nullptr; }
os::Handler* GetGdShimHandler() { return hci::testing::mock_gd_shim_handler_; }
security::SecurityModule* GetSecurityModule() { return nullptr; }
hal::SnoopLogger* GetSnoopLogger() { return nullptr; }
storage::StorageModule* GetStorage() { return nullptr; }
metrics::CounterMetrics* GetCounterMetrics() { return nullptr; }
Loading