From 59ee73d6f6d9dd36a2d652c8529b972085f3d7cb Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Wed, 19 Feb 2020 01:17:53 +0100 Subject: [PATCH] Get rid of Connectability shim Bug: 149757450 Change-Id: Idef691e97109e2634fc05fc7bddfeca72b967d11 --- gd/facade/grpc_root_server.cc | 4 +-- gd/shim/Android.bp | 1 - gd/shim/connectability.cc | 78 ------------------------------------------- gd/shim/connectability.h | 50 --------------------------- gd/shim/stack.cc | 2 -- gd/shim/stack.h | 2 +- main/shim/btm.cc | 2 +- main/shim/entry.cc | 7 ++-- main/shim/entry.h | 3 +- 9 files changed, 10 insertions(+), 139 deletions(-) delete mode 100644 gd/shim/connectability.cc delete mode 100644 gd/shim/connectability.h diff --git a/gd/facade/grpc_root_server.cc b/gd/facade/grpc_root_server.cc index 1f43938ba..3774d3885 100644 --- a/gd/facade/grpc_root_server.cc +++ b/gd/facade/grpc_root_server.cc @@ -29,6 +29,7 @@ #include "hci/facade/le_advertising_manager_facade.h" #include "hci/facade/le_scanning_manager_facade.h" #include "l2cap/classic/facade.h" +#include "neighbor/connectability.h" #include "neighbor/discoverability.h" #include "neighbor/facade/facade.h" #include "neighbor/page.h" @@ -37,7 +38,6 @@ #include "security/facade.h" #include "security/security_module.h" #include "shim/advertising.h" -#include "shim/connectability.h" #include "shim/dumpsys.h" #include "shim/hci_layer.h" #include "shim/inquiry.h" @@ -106,7 +106,7 @@ class RootFacadeService : public ::bluetooth::facade::RootFacade::Service { break; case BluetoothModule::SHIM: modules.add<::bluetooth::shim::Advertising>(); - modules.add<::bluetooth::shim::Connectability>(); + modules.add<::bluetooth::neighbor::ConnectabilityModule>(); modules.add<::bluetooth::neighbor::DiscoverabilityModule>(); modules.add<::bluetooth::shim::Dumpsys>(); modules.add<::bluetooth::shim::HciLayer>(); diff --git a/gd/shim/Android.bp b/gd/shim/Android.bp index 64e7f3f1b..78889bfec 100644 --- a/gd/shim/Android.bp +++ b/gd/shim/Android.bp @@ -2,7 +2,6 @@ filegroup { name: "BluetoothShimSources", srcs: [ "advertising.cc", - "connectability.cc", "dumpsys.cc", "hci_layer.cc", "inquiry.cc", diff --git a/gd/shim/connectability.cc b/gd/shim/connectability.cc deleted file mode 100644 index e472f09e9..000000000 --- a/gd/shim/connectability.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#define LOG_TAG "bt_gd_shim" - -#include -#include - -#include "common/bidi_queue.h" -#include "hci/address.h" -#include "hci/controller.h" -#include "hci/hci_packets.h" -#include "module.h" -#include "neighbor/connectability.h" -#include "os/handler.h" -#include "os/log.h" -#include "shim/connectability.h" - -namespace bluetooth { -namespace shim { - -namespace { -constexpr char kModuleName[] = "shim::Connectability"; -} // namespace - -const ModuleFactory Connectability::Factory = ModuleFactory([]() { return new Connectability(); }); - -struct Connectability::impl { - impl(neighbor::ConnectabilityModule* module) : module_(module) {} - - neighbor::ConnectabilityModule* module_{nullptr}; -}; - -void Connectability::StartConnectability() { - pimpl_->module_->StartConnectability(); -} - -void Connectability::StopConnectability() { - pimpl_->module_->StopConnectability(); -} - -bool Connectability::IsConnectable() const { - return pimpl_->module_->IsConnectable(); -} - -/** - * Module methods - */ -void Connectability::ListDependencies(ModuleList* list) { - list->add(); -} - -void Connectability::Start() { - pimpl_ = std::make_unique(GetDependency()); -} - -void Connectability::Stop() { - pimpl_.reset(); -} - -std::string Connectability::ToString() const { - return kModuleName; -} - -} // namespace shim -} // namespace bluetooth diff --git a/gd/shim/connectability.h b/gd/shim/connectability.h deleted file mode 100644 index f123d8116..000000000 --- a/gd/shim/connectability.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include -#include - -#include "module.h" - -namespace bluetooth { -namespace shim { - -class Connectability : public bluetooth::Module { - public: - void StartConnectability(); - void StopConnectability(); - bool IsConnectable() const; - - Connectability() = default; - ~Connectability() = default; - - static const ModuleFactory Factory; - - protected: - void ListDependencies(ModuleList* list) override; // Module - void Start() override; // Module - void Stop() override; // Module - std::string ToString() const override; // Module - - private: - struct impl; - std::unique_ptr pimpl_; - DISALLOW_COPY_AND_ASSIGN(Connectability); -}; - -} // namespace shim -} // namespace bluetooth diff --git a/gd/shim/stack.cc b/gd/shim/stack.cc index 7eb10e1bf..01fa0f872 100644 --- a/gd/shim/stack.cc +++ b/gd/shim/stack.cc @@ -36,7 +36,6 @@ #include "os/thread.h" #include "security/security_module.h" #include "shim/advertising.h" -#include "shim/connectability.h" #include "shim/dumpsys.h" #include "shim/hci_layer.h" #include "shim/inquiry.h" @@ -77,7 +76,6 @@ struct bluetooth::shim::Stack::impl { modules.add<::bluetooth::security::SecurityModule>(); modules.add<::bluetooth::storage::LegacyModule>(); modules.add<::bluetooth::shim::Advertising>(); - modules.add<::bluetooth::shim::Connectability>(); modules.add<::bluetooth::shim::Dumpsys>(); modules.add<::bluetooth::shim::Inquiry>(); modules.add<::bluetooth::shim::Name>(); diff --git a/gd/shim/stack.h b/gd/shim/stack.h index da7ab5c80..151693175 100644 --- a/gd/shim/stack.h +++ b/gd/shim/stack.h @@ -18,11 +18,11 @@ #include +#include "neighbor/connectability.h" #include "neighbor/discoverability.h" #include "neighbor/page.h" #include "security/security_module.h" #include "shim/advertising.h" -#include "shim/connectability.h" #include "shim/dumpsys.h" #include "shim/hci_layer.h" #include "shim/inquiry.h" diff --git a/main/shim/btm.cc b/main/shim/btm.cc index 1c45857ad..49a8e1656 100644 --- a/main/shim/btm.cc +++ b/main/shim/btm.cc @@ -32,11 +32,11 @@ #include "types/raw_address.h" #include "main/shim/helpers.h" +#include "neighbor/connectability.h" #include "neighbor/discoverability.h" #include "neighbor/page.h" #include "security/security_module.h" #include "shim/advertising.h" -#include "shim/connectability.h" #include "shim/controller.h" #include "shim/inquiry.h" #include "shim/name.h" diff --git a/main/shim/entry.cc b/main/shim/entry.cc index 6e2268d76..14520d913 100644 --- a/main/shim/entry.cc +++ b/main/shim/entry.cc @@ -18,11 +18,11 @@ #include "osi/include/future.h" #include "hci/controller.h" +#include "neighbor/connectability.h" #include "neighbor/discoverability.h" #include "neighbor/page.h" #include "security/security_module.h" #include "shim/advertising.h" -#include "shim/connectability.h" #include "shim/dumpsys.h" #include "shim/hci_layer.h" #include "shim/inquiry.h" @@ -58,10 +58,11 @@ bluetooth::hci::Controller* bluetooth::shim::GetController() { ->GetInstance(); } -bluetooth::shim::Connectability* bluetooth::shim::GetConnectability() { +bluetooth::neighbor::ConnectabilityModule* +bluetooth::shim::GetConnectability() { return GetGabeldorscheStack() ->GetStackManager() - ->GetInstance(); + ->GetInstance(); } bluetooth::neighbor::DiscoverabilityModule* diff --git a/main/shim/entry.h b/main/shim/entry.h index db5d577b8..f64094db2 100644 --- a/main/shim/entry.h +++ b/main/shim/entry.h @@ -34,6 +34,7 @@ namespace bluetooth { namespace neighbor { +class ConnectabilityModule; class DiscoverabilityModule; class PageModule; } @@ -52,7 +53,7 @@ future_t* StopGabeldorscheStack(); Advertising* GetAdvertising(); bluetooth::hci::Controller* GetController(); neighbor::DiscoverabilityModule* GetDiscoverability(); -Connectability* GetConnectability(); +neighbor::ConnectabilityModule* GetConnectability(); Dumpsys* GetDumpsys(); Inquiry* GetInquiry(); HciLayer* GetHciLayer(); -- 2.11.0