diff options
author | 2022-02-04 16:12:52 +0900 | |
---|---|---|
committer | 2022-02-18 10:58:21 +0900 | |
commit | 3f4c8efbccbf9743df688c51595e60e6a965e0e7 (patch) | |
tree | 03a7f6b05cac5b9a75db56fc553cc48b9a404816 | |
parent | 513d17cf443cf144ede74cb50605df73ddd21c66 (diff) |
floss: use delete ctor and remove all base/macros.h includes
The deprecated macros will be removed from base/macros.h from libchrome
r938828. The header file will no longer contains any macros and hence
renamed to base/ignore_result.h in libchrome r941411.
Bug: 211560276
Tag: #floss
Test: FEATURES=test emerge-hatch floss
Change-Id: I83c8c0d0a668df0d62544894884fe30d80f9f821
140 files changed, 571 insertions, 439 deletions
diff --git a/system/bta/csis/csis_client_test.cc b/system/bta/csis/csis_client_test.cc index f3aaefe098..1ad837f637 100644 --- a/system/bta/csis/csis_client_test.cc +++ b/system/bta/csis/csis_client_test.cc @@ -75,12 +75,12 @@ RawAddress GetTestAddress(int index) { class MockCsisLockCallback { public: MockCsisLockCallback() = default; + MockCsisLockCallback(const MockCsisLockCallback&) = delete; + MockCsisLockCallback& operator=(const MockCsisLockCallback&) = delete; + ~MockCsisLockCallback() = default; MOCK_METHOD((void), CsisGroupLockCb, (int group_id, bool locked, CsisGroupLockStatus status)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockCsisLockCallback); }; static MockCsisLockCallback* csis_lock_callback_mock; @@ -93,6 +93,9 @@ void SetMockCsisLockCallback(MockCsisLockCallback* mock) { class MockCsisCallbacks : public CsisClientCallbacks { public: MockCsisCallbacks() = default; + MockCsisCallbacks(const MockCsisCallbacks&) = delete; + MockCsisCallbacks& operator=(const MockCsisCallbacks&) = delete; + ~MockCsisCallbacks() override = default; MOCK_METHOD((void), OnConnectionState, @@ -110,9 +113,6 @@ class MockCsisCallbacks : public CsisClientCallbacks { MOCK_METHOD((void), OnGattCsisWriteLockRsp, (uint16_t conn_id, tGATT_STATUS status, uint16_t handle, void* data)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockCsisCallbacks); }; class CsisClientTest : public ::testing::Test { diff --git a/system/bta/groups/groups_test.cc b/system/bta/groups/groups_test.cc index 8966284df5..2299c573e3 100644 --- a/system/bta/groups/groups_test.cc +++ b/system/bta/groups/groups_test.cc @@ -52,6 +52,9 @@ RawAddress GetTestAddress(int index) { class MockGroupsCallbacks : public DeviceGroupsCallbacks { public: MockGroupsCallbacks() = default; + MockGroupsCallbacks(const MockGroupsCallbacks&) = delete; + MockGroupsCallbacks& operator=(const MockGroupsCallbacks&) = delete; + ~MockGroupsCallbacks() override = default; MOCK_METHOD((void), OnGroupAdded, @@ -69,9 +72,6 @@ class MockGroupsCallbacks : public DeviceGroupsCallbacks { (const RawAddress& address, const bluetooth::Uuid& uuid, int group_id), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockGroupsCallbacks); }; class GroupsTest : public ::testing::Test { diff --git a/system/bta/has/has_client_test.cc b/system/bta/has/has_client_test.cc index c46e034de7..571686981c 100644 --- a/system/bta/has/has_client_test.cc +++ b/system/bta/has/has_client_test.cc @@ -104,6 +104,9 @@ static uint16_t GetTestConnId(const RawAddress& address) { class MockHasCallbacks : public HasClientCallbacks { public: MockHasCallbacks() = default; + MockHasCallbacks(const MockHasCallbacks&) = delete; + MockHasCallbacks& operator=(const MockHasCallbacks&) = delete; + ~MockHasCallbacks() override = default; MOCK_METHOD((void), OnConnectionState, @@ -133,9 +136,6 @@ class MockHasCallbacks : public HasClientCallbacks { ((std::variant<RawAddress, int> addr_or_group_id), uint8_t preset_index, ErrorCode error_code), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockHasCallbacks); }; class HasClientTestBase : public ::testing::Test { diff --git a/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h b/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h index ee1d8749a5..eca09c87ba 100644 --- a/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h +++ b/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h @@ -27,6 +27,10 @@ class MockBleAdvertisingManager : public BleAdvertisingManager { public: MockBleAdvertisingManager() = default; + MockBleAdvertisingManager(const MockBleAdvertisingManager&) = delete; + MockBleAdvertisingManager& operator=(const MockBleAdvertisingManager&) = + delete; + ~MockBleAdvertisingManager() override = default; /* Allows getting and setting BleAdvertiserHciInterface dependency */ @@ -99,7 +103,6 @@ class MockBleAdvertisingManager : public BleAdvertisingManager { (override)); private: - DISALLOW_COPY_AND_ASSIGN(MockBleAdvertisingManager); base::WeakPtrFactory<MockBleAdvertisingManager> weak_factory_{this}; BleAdvertiserHciInterface* ble_adv_hci_interface_; }; diff --git a/system/bta/le_audio/broadcaster/state_machine_test.cc b/system/bta/le_audio/broadcaster/state_machine_test.cc index d0fc071c13..a203bcab2b 100644 --- a/system/bta/le_audio/broadcaster/state_machine_test.cc +++ b/system/bta/le_audio/broadcaster/state_machine_test.cc @@ -53,6 +53,11 @@ class MockBroadcastStatMachineCallbacks : public IBroadcastStateMachineCallbacks { public: MockBroadcastStatMachineCallbacks() = default; + MockBroadcastStatMachineCallbacks(const MockBroadcastStatMachineCallbacks&) = + delete; + MockBroadcastStatMachineCallbacks& operator=( + const MockBroadcastStatMachineCallbacks&) = delete; + ~MockBroadcastStatMachineCallbacks() override = default; MOCK_METHOD((void), OnStateMachineCreateStatus, @@ -70,9 +75,6 @@ class MockBroadcastStatMachineCallbacks MOCK_METHOD((uint32_t), GetSduItv, (uint8_t instance_id), (override)); MOCK_METHOD((uint16_t), GetMaxTransportLatency, (uint8_t instance_id), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockBroadcastStatMachineCallbacks); }; class StateMachineTest : public Test { diff --git a/system/bta/le_audio/mock_codec_manager.h b/system/bta/le_audio/mock_codec_manager.h index c31b08c7d1..d191a5fd04 100644 --- a/system/bta/le_audio/mock_codec_manager.h +++ b/system/bta/le_audio/mock_codec_manager.h @@ -25,6 +25,9 @@ class MockCodecManager { static MockCodecManager* GetInstance(); MockCodecManager() = default; + MockCodecManager(const MockCodecManager&) = delete; + MockCodecManager& operator=(const MockCodecManager&) = delete; + virtual ~MockCodecManager() = default; MOCK_METHOD((le_audio::types::CodecLocation), GetCodecLocation, (), (const)); @@ -40,7 +43,4 @@ class MockCodecManager { MOCK_METHOD((void), Start, ()); MOCK_METHOD((void), Stop, ()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockCodecManager); }; diff --git a/system/bta/le_audio/mock_iso_manager.h b/system/bta/le_audio/mock_iso_manager.h index e4a10abccb..8db3ade2a5 100644 --- a/system/bta/le_audio/mock_iso_manager.h +++ b/system/bta/le_audio/mock_iso_manager.h @@ -26,6 +26,9 @@ struct MockIsoManager { static MockIsoManager* GetInstance(); MockIsoManager() = default; + MockIsoManager(const MockIsoManager&) = delete; + MockIsoManager& operator=(const MockIsoManager&) = delete; + virtual ~MockIsoManager() = default; MOCK_METHOD((void), RegisterCigCallbacks, @@ -68,7 +71,4 @@ struct MockIsoManager { MOCK_METHOD((void), Start, ()); MOCK_METHOD((void), Stop, ()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockIsoManager); }; diff --git a/system/bta/le_audio/state_machine_test.cc b/system/bta/le_audio/state_machine_test.cc index 01ee3a3cb2..aa700730e5 100644 --- a/system/bta/le_audio/state_machine_test.cc +++ b/system/bta/le_audio/state_machine_test.cc @@ -137,14 +137,16 @@ class MockLeAudioGroupStateMachineCallbacks : public LeAudioGroupStateMachine::Callbacks { public: MockLeAudioGroupStateMachineCallbacks() = default; + MockLeAudioGroupStateMachineCallbacks( + const MockLeAudioGroupStateMachineCallbacks&) = delete; + MockLeAudioGroupStateMachineCallbacks& operator=( + const MockLeAudioGroupStateMachineCallbacks&) = delete; + ~MockLeAudioGroupStateMachineCallbacks() override = default; MOCK_METHOD((void), StatusReportCb, (int group_id, bluetooth::le_audio::GroupStreamStatus status), (override)); MOCK_METHOD((void), OnStateTransitionTimeout, (int group_id), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockLeAudioGroupStateMachineCallbacks); }; class StateMachineTest : public Test { diff --git a/system/bta/vc/vc_test.cc b/system/bta/vc/vc_test.cc index c4ccaa97d9..0e52d4a1be 100644 --- a/system/bta/vc/vc_test.cc +++ b/system/bta/vc/vc_test.cc @@ -66,6 +66,10 @@ RawAddress GetTestAddress(int index) { class MockVolumeControlCallbacks : public VolumeControlCallbacks { public: MockVolumeControlCallbacks() = default; + MockVolumeControlCallbacks(const MockVolumeControlCallbacks&) = delete; + MockVolumeControlCallbacks& operator=(const MockVolumeControlCallbacks&) = + delete; + ~MockVolumeControlCallbacks() override = default; MOCK_METHOD((void), OnConnectionState, @@ -75,9 +79,6 @@ class MockVolumeControlCallbacks : public VolumeControlCallbacks { (override)); MOCK_METHOD((void), OnGroupVolumeStateChanged, (int group_id, uint8_t volume, bool mute, bool isAutonomous), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockVolumeControlCallbacks); }; class VolumeControlTest : public ::testing::Test { diff --git a/system/common/message_loop_thread.h b/system/common/message_loop_thread.h index 7420dbcb26..ece1d0ffbc 100644 --- a/system/common/message_loop_thread.h +++ b/system/common/message_loop_thread.h @@ -48,6 +48,9 @@ class MessageLoopThread final { explicit MessageLoopThread(const std::string& thread_name); explicit MessageLoopThread(const std::string& thread_name, bool is_main); + MessageLoopThread(const MessageLoopThread&) = delete; + MessageLoopThread& operator=(const MessageLoopThread&) = delete; + /** * Destroys the message loop thread automatically when it goes out of scope */ @@ -199,8 +202,6 @@ class MessageLoopThread final { bool shutting_down_; bool is_main_; ::rust::Box<shim::rust::MessageLoopThread>* rust_thread_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(MessageLoopThread); }; inline std::ostream& operator<<(std::ostream& os, diff --git a/system/common/once_timer.h b/system/common/once_timer.h index ca7185d001..d708ed97d6 100644 --- a/system/common/once_timer.h +++ b/system/common/once_timer.h @@ -39,6 +39,9 @@ class MessageLoopThread; class OnceTimer final { public: OnceTimer() {} + OnceTimer(const OnceTimer&) = delete; + OnceTimer& operator=(const OnceTimer&) = delete; + ~OnceTimer(); /** @@ -84,8 +87,6 @@ class OnceTimer final { void CancelClosure(std::promise<void> promise); void RunTask(); - - DISALLOW_COPY_AND_ASSIGN(OnceTimer); }; } // namespace common diff --git a/system/common/repeating_timer.h b/system/common/repeating_timer.h index 24eae67d09..5c2c9e3169 100644 --- a/system/common/repeating_timer.h +++ b/system/common/repeating_timer.h @@ -39,6 +39,9 @@ class MessageLoopThread; class RepeatingTimer final { public: RepeatingTimer() : expected_time_next_task_us_(0) {} + RepeatingTimer(const RepeatingTimer&) = delete; + RepeatingTimer& operator=(const RepeatingTimer&) = delete; + ~RepeatingTimer(); /** @@ -85,8 +88,6 @@ class RepeatingTimer final { void CancelClosure(std::promise<void> promise); void RunTask(); - - DISALLOW_COPY_AND_ASSIGN(RepeatingTimer); }; } // namespace common diff --git a/system/gd/att/att_module.h b/system/gd/att/att_module.h index a04993c8b3..1322394e6e 100644 --- a/system/gd/att/att_module.h +++ b/system/gd/att/att_module.h @@ -25,6 +25,9 @@ namespace att { class AttModule : public bluetooth::Module { public: AttModule() = default; + AttModule(const AttModule&) = delete; + AttModule& operator=(const AttModule&) = delete; + ~AttModule() = default; static const ModuleFactory Factory; @@ -41,7 +44,6 @@ class AttModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - DISALLOW_COPY_AND_ASSIGN(AttModule); }; } // namespace att diff --git a/system/gd/btaa/activity_attribution.h b/system/gd/btaa/activity_attribution.h index e2861286d9..93f5549dd3 100644 --- a/system/gd/btaa/activity_attribution.h +++ b/system/gd/btaa/activity_attribution.h @@ -50,6 +50,9 @@ class ActivityAttributionCallback { class ActivityAttribution : public bluetooth::Module { public: ActivityAttribution() = default; + ActivityAttribution(const ActivityAttribution&) = delete; + ActivityAttribution& operator=(const ActivityAttribution&) = delete; + ~ActivityAttribution() = default; void Capture(const hal::HciPacket& packet, hal::SnoopLogger::PacketType type); @@ -71,8 +74,6 @@ class ActivityAttribution : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(ActivityAttribution); }; } // namespace activity_attribution diff --git a/system/gd/common/callback_list.h b/system/gd/common/callback_list.h index a3ad6b1f18..441a5fa3ef 100644 --- a/system/gd/common/callback_list.h +++ b/system/gd/common/callback_list.h @@ -68,6 +68,9 @@ class CallbackList<void(Args...)> : public base::internal::CallbackListBase<Call public: using CallbackType = CallbackWithHandler<void(Args...)>; CallbackList() = default; + CallbackList(const CallbackList&) = delete; + CallbackList& operator=(const CallbackList&) = delete; + template <typename... RunArgs> void Notify(RunArgs&&... args) { auto it = this->GetIterator(); @@ -76,9 +79,6 @@ class CallbackList<void(Args...)> : public base::internal::CallbackListBase<Call cb->handler->Post(base::Bind(cb->callback, args...)); } } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); }; } // namespace common diff --git a/system/gd/common/contextual_callback.h b/system/gd/common/contextual_callback.h index 539352945f..ba78ed6ba1 100644 --- a/system/gd/common/contextual_callback.h +++ b/system/gd/common/contextual_callback.h @@ -39,8 +39,8 @@ class ContextualOnceCallback<R(Args...)> { : callback_(std::move(callback)), context_(context) {} constexpr ContextualOnceCallback() = default; - - DISALLOW_COPY_AND_ASSIGN(ContextualOnceCallback); + ContextualOnceCallback(const ContextualOnceCallback&) = delete; + ContextualOnceCallback& operator=(const ContextualOnceCallback&) = delete; ContextualOnceCallback(ContextualOnceCallback&&) noexcept = default; ContextualOnceCallback& operator=(ContextualOnceCallback&&) noexcept = default; diff --git a/system/gd/hci/acl_manager.h b/system/gd/hci/acl_manager.h index 72426bdafa..9c008013bb 100644 --- a/system/gd/hci/acl_manager.h +++ b/system/gd/hci/acl_manager.h @@ -57,6 +57,9 @@ class AclManager : public Module { public: AclManager(); + AclManager(const AclManager&) = delete; + AclManager& operator=(const AclManager&) = delete; + // NOTE: It is necessary to forward declare a default destructor that overrides the base class one, because // "struct impl" is forwarded declared in .cc and compiler needs a concrete definition of "struct impl" when // compiling AclManager's destructor. Hence we need to forward declare the destructor for AclManager to delay @@ -148,8 +151,6 @@ private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(AclManager); }; } // namespace hci diff --git a/system/gd/hci/acl_manager/acl_connection.h b/system/gd/hci/acl_manager/acl_connection.h index c396b1833a..1347c8232a 100644 --- a/system/gd/hci/acl_manager/acl_connection.h +++ b/system/gd/hci/acl_manager/acl_connection.h @@ -28,6 +28,9 @@ namespace acl_manager { class AclConnection { public: AclConnection() : queue_up_end_(nullptr), handle_(0){}; + AclConnection(const AclConnection&) = delete; + AclConnection& operator=(const AclConnection&) = delete; + virtual ~AclConnection() = default; uint16_t GetHandle() const { @@ -47,7 +50,6 @@ class AclConnection { AclConnection(QueueUpEnd* queue_up_end, uint16_t handle) : queue_up_end_(queue_up_end), handle_(handle) {} QueueUpEnd* queue_up_end_; uint16_t handle_; - DISALLOW_COPY_AND_ASSIGN(AclConnection); }; } // namespace acl_manager diff --git a/system/gd/hci/acl_manager/classic_acl_connection.h b/system/gd/hci/acl_manager/classic_acl_connection.h index 328cbb1eb4..6870114e06 100644 --- a/system/gd/hci/acl_manager/classic_acl_connection.h +++ b/system/gd/hci/acl_manager/classic_acl_connection.h @@ -33,6 +33,9 @@ class ClassicAclConnection : public AclConnection { ClassicAclConnection(); ClassicAclConnection(std::shared_ptr<Queue> queue, AclConnectionInterface* acl_connection_interface, uint16_t handle, Address address); + ClassicAclConnection(const ClassicAclConnection&) = delete; + ClassicAclConnection& operator=(const ClassicAclConnection&) = delete; + ~ClassicAclConnection(); virtual Address GetAddress() const { @@ -86,7 +89,6 @@ class ClassicAclConnection : public AclConnection { private: struct impl; struct impl* pimpl_ = nullptr; - DISALLOW_COPY_AND_ASSIGN(ClassicAclConnection); }; } // namespace acl_manager diff --git a/system/gd/hci/acl_manager/le_acl_connection.h b/system/gd/hci/acl_manager/le_acl_connection.h index fd81111ba6..0fc14a9585 100644 --- a/system/gd/hci/acl_manager/le_acl_connection.h +++ b/system/gd/hci/acl_manager/le_acl_connection.h @@ -39,6 +39,9 @@ class LeAclConnection : public AclConnection { AddressWithType local_address, AddressWithType remote_address, Role role); + LeAclConnection(const LeAclConnection&) = delete; + LeAclConnection& operator=(const LeAclConnection&) = delete; + ~LeAclConnection(); virtual AddressWithType GetLocalAddress() const { @@ -84,7 +87,6 @@ class LeAclConnection : public AclConnection { AddressWithType local_address_; AddressWithType remote_address_; Role role_; - DISALLOW_COPY_AND_ASSIGN(LeAclConnection); }; } // namespace acl_manager diff --git a/system/gd/hci/command_interface.h b/system/gd/hci/command_interface.h index eba01dbe07..28fa6273f2 100644 --- a/system/gd/hci/command_interface.h +++ b/system/gd/hci/command_interface.h @@ -28,8 +28,10 @@ template <typename T> class CommandInterface { public: CommandInterface() = default; + CommandInterface(const CommandInterface&) = delete; + CommandInterface& operator=(const CommandInterface&) = delete; + virtual ~CommandInterface() = default; - DISALLOW_COPY_AND_ASSIGN(CommandInterface); virtual void EnqueueCommand(std::unique_ptr<T> command, common::ContextualOnceCallback<void(CommandCompleteView)> on_complete) = 0; diff --git a/system/gd/hci/controller.h b/system/gd/hci/controller.h index ea45aef729..573c695ad6 100644 --- a/system/gd/hci/controller.h +++ b/system/gd/hci/controller.h @@ -28,8 +28,10 @@ namespace hci { class Controller : public Module { public: Controller(); + Controller(const Controller&) = delete; + Controller& operator=(const Controller&) = delete; + virtual ~Controller(); - DISALLOW_COPY_AND_ASSIGN(Controller); using CompletedAclPacketsCallback = common::ContextualCallback<void(uint16_t /* handle */, uint16_t /* num_packets */)>; diff --git a/system/gd/hci/hci_layer.h b/system/gd/hci/hci_layer.h index 8ff74d3867..bde991508d 100644 --- a/system/gd/hci/hci_layer.h +++ b/system/gd/hci/hci_layer.h @@ -43,8 +43,10 @@ class HciLayer : public Module, public CommandInterface<CommandBuilder> { // LINT.IfChange public: HciLayer(); + HciLayer(const HciLayer&) = delete; + HciLayer& operator=(const HciLayer&) = delete; + virtual ~HciLayer(); - DISALLOW_COPY_AND_ASSIGN(HciLayer); void EnqueueCommand( std::unique_ptr<CommandBuilder> command, diff --git a/system/gd/hci/le_advertising_manager.h b/system/gd/hci/le_advertising_manager.h index 75040fbc1f..557b110d8d 100644 --- a/system/gd/hci/le_advertising_manager.h +++ b/system/gd/hci/le_advertising_manager.h @@ -102,6 +102,8 @@ class LeAdvertisingManager : public bluetooth::Module { static constexpr uint16_t kLeMaximumFragmentLength = 251; static constexpr FragmentPreference kFragment_preference = FragmentPreference::CONTROLLER_SHOULD_NOT; LeAdvertisingManager(); + LeAdvertisingManager(const LeAdvertisingManager&) = delete; + LeAdvertisingManager& operator=(const LeAdvertisingManager&) = delete; size_t GetNumberOfAdvertisingInstances() const; @@ -153,7 +155,6 @@ class LeAdvertisingManager : public bluetooth::Module { os::Handler* handler); struct impl; std::unique_ptr<impl> pimpl_; - DISALLOW_COPY_AND_ASSIGN(LeAdvertisingManager); }; } // namespace hci diff --git a/system/gd/hci/le_scanning_manager.h b/system/gd/hci/le_scanning_manager.h index ca2cf1369b..6d5c6ac6fa 100644 --- a/system/gd/hci/le_scanning_manager.h +++ b/system/gd/hci/le_scanning_manager.h @@ -42,6 +42,8 @@ class LeScanningManager : public bluetooth::Module { static constexpr uint8_t kNotPeriodicAdvertisement = 0x00; static constexpr ScannerId kInvalidScannerId = 0xFF; LeScanningManager(); + LeScanningManager(const LeScanningManager&) = delete; + LeScanningManager& operator=(const LeScanningManager&) = delete; virtual void RegisterScanner(const Uuid app_uuid); @@ -92,7 +94,6 @@ class LeScanningManager : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - DISALLOW_COPY_AND_ASSIGN(LeScanningManager); }; } // namespace hci diff --git a/system/gd/hci/vendor_specific_event_manager.h b/system/gd/hci/vendor_specific_event_manager.h index 7e0f3334dc..3dba563847 100644 --- a/system/gd/hci/vendor_specific_event_manager.h +++ b/system/gd/hci/vendor_specific_event_manager.h @@ -24,6 +24,8 @@ namespace hci { class VendorSpecificEventManager : public bluetooth::Module { public: VendorSpecificEventManager(); + VendorSpecificEventManager(const VendorSpecificEventManager&) = delete; + VendorSpecificEventManager& operator=(const VendorSpecificEventManager&) = delete; void RegisterEventHandler(VseSubeventCode event, common::ContextualCallback<void(VendorSpecificEventView)> handler); @@ -43,7 +45,6 @@ class VendorSpecificEventManager : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - DISALLOW_COPY_AND_ASSIGN(VendorSpecificEventManager); }; } // namespace hci diff --git a/system/gd/iso/iso_manager.h b/system/gd/iso/iso_manager.h index d38405c4e8..b40d6f5175 100644 --- a/system/gd/iso/iso_manager.h +++ b/system/gd/iso/iso_manager.h @@ -37,6 +37,9 @@ using IsoDataCallback = common::ContextualCallback<void(std::unique_ptr<hci::Iso */ class IsoManager { public: + IsoManager(const IsoManager&) = delete; + IsoManager& operator=(const IsoManager&) = delete; + friend class IsoModule; void RegisterIsoEstablishedCallback(CisEstablishedCallback cb); @@ -80,7 +83,6 @@ class IsoManager { private: os::Handler* iso_handler_ = nullptr; internal::IsoManagerImpl* iso_manager_impl_; - DISALLOW_COPY_AND_ASSIGN(IsoManager); }; } // namespace iso diff --git a/system/gd/iso/iso_module.h b/system/gd/iso/iso_module.h index 6db880c109..d767620b31 100644 --- a/system/gd/iso/iso_module.h +++ b/system/gd/iso/iso_module.h @@ -26,6 +26,9 @@ namespace iso { class IsoModule : public bluetooth::Module { public: IsoModule() = default; + IsoModule(const IsoModule&) = delete; + IsoModule& operator=(const IsoModule&) = delete; + ~IsoModule() = default; /** @@ -47,7 +50,6 @@ class IsoModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - DISALLOW_COPY_AND_ASSIGN(IsoModule); }; } // namespace iso diff --git a/system/gd/l2cap/classic/dynamic_channel_manager.h b/system/gd/l2cap/classic/dynamic_channel_manager.h index 66e3aeec58..ab240ff0d3 100644 --- a/system/gd/l2cap/classic/dynamic_channel_manager.h +++ b/system/gd/l2cap/classic/dynamic_channel_manager.h @@ -122,6 +122,9 @@ class DynamicChannelManager { friend class L2capClassicModule; + DynamicChannelManager(const DynamicChannelManager&) = delete; + DynamicChannelManager& operator=(const DynamicChannelManager&) = delete; + virtual ~DynamicChannelManager() = default; protected: @@ -139,7 +142,6 @@ class DynamicChannelManager { internal::DynamicChannelServiceManagerImpl* service_manager_ = nullptr; internal::LinkManager* link_manager_ = nullptr; os::Handler* l2cap_layer_handler_ = nullptr; - DISALLOW_COPY_AND_ASSIGN(DynamicChannelManager); }; } // namespace classic diff --git a/system/gd/l2cap/classic/dynamic_channel_service.h b/system/gd/l2cap/classic/dynamic_channel_service.h index f098db1a03..40ead1f6ad 100644 --- a/system/gd/l2cap/classic/dynamic_channel_service.h +++ b/system/gd/l2cap/classic/dynamic_channel_service.h @@ -32,6 +32,8 @@ class DynamicChannelServiceManagerImpl; class DynamicChannelService { public: DynamicChannelService() = default; + DynamicChannelService(const DynamicChannelService&) = delete; + DynamicChannelService& operator=(const DynamicChannelService&) = delete; using OnUnregisteredCallback = common::ContextualOnceCallback<void()>; @@ -59,7 +61,6 @@ class DynamicChannelService { Psm psm_ = kDefaultPsm; internal::DynamicChannelServiceManagerImpl* manager_ = nullptr; os::Handler* l2cap_layer_handler_; - DISALLOW_COPY_AND_ASSIGN(DynamicChannelService); }; } // namespace classic diff --git a/system/gd/l2cap/classic/fixed_channel_manager.h b/system/gd/l2cap/classic/fixed_channel_manager.h index a3285e7d3e..9c40bd1e54 100644 --- a/system/gd/l2cap/classic/fixed_channel_manager.h +++ b/system/gd/l2cap/classic/fixed_channel_manager.h @@ -129,6 +129,9 @@ class FixedChannelManager { virtual bool RegisterService(Cid cid, OnRegistrationCompleteCallback on_registration_complete, OnConnectionOpenCallback on_connection_open, os::Handler* handler); + FixedChannelManager(const FixedChannelManager&) = delete; + FixedChannelManager& operator=(const FixedChannelManager&) = delete; + virtual ~FixedChannelManager() = default; friend class L2capClassicModule; @@ -143,7 +146,6 @@ class FixedChannelManager { internal::FixedChannelServiceManagerImpl* service_manager_ = nullptr; internal::LinkManager* link_manager_ = nullptr; os::Handler* l2cap_layer_handler_ = nullptr; - DISALLOW_COPY_AND_ASSIGN(FixedChannelManager); }; } // namespace classic diff --git a/system/gd/l2cap/classic/fixed_channel_service.h b/system/gd/l2cap/classic/fixed_channel_service.h index d5d213b62a..447d3a80bd 100644 --- a/system/gd/l2cap/classic/fixed_channel_service.h +++ b/system/gd/l2cap/classic/fixed_channel_service.h @@ -32,6 +32,8 @@ class FixedChannelServiceManagerImpl; class FixedChannelService { public: FixedChannelService() = default; + FixedChannelService(const FixedChannelService&) = delete; + FixedChannelService& operator=(const FixedChannelService&) = delete; using OnUnregisteredCallback = common::OnceCallback<void()>; @@ -51,7 +53,6 @@ class FixedChannelService { Cid cid_ = kInvalidCid; internal::FixedChannelServiceManagerImpl* manager_ = nullptr; os::Handler* l2cap_layer_handler_; - DISALLOW_COPY_AND_ASSIGN(FixedChannelService); }; } // namespace classic diff --git a/system/gd/l2cap/classic/internal/fixed_channel_impl.h b/system/gd/l2cap/classic/internal/fixed_channel_impl.h index 4c4e9f17fb..37efa1db84 100644 --- a/system/gd/l2cap/classic/internal/fixed_channel_impl.h +++ b/system/gd/l2cap/classic/internal/fixed_channel_impl.h @@ -35,6 +35,9 @@ class FixedChannelImpl : public l2cap::internal::ChannelImpl { public: FixedChannelImpl(Cid cid, Link* link, os::Handler* l2cap_handler); + FixedChannelImpl(const FixedChannelImpl&) = delete; + FixedChannelImpl& operator=(const FixedChannelImpl&) = delete; + virtual ~FixedChannelImpl() = default; hci::Address GetDevice() const { @@ -96,8 +99,6 @@ class FixedChannelImpl : public l2cap::internal::ChannelImpl { static constexpr size_t kChannelQueueSize = 10; common::BidiQueue<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder> channel_queue_{ kChannelQueueSize}; - - DISALLOW_COPY_AND_ASSIGN(FixedChannelImpl); }; } // namespace internal diff --git a/system/gd/l2cap/classic/internal/link.h b/system/gd/l2cap/classic/internal/link.h index a5b17a9dc8..2b61aaebf0 100644 --- a/system/gd/l2cap/classic/internal/link.h +++ b/system/gd/l2cap/classic/internal/link.h @@ -51,6 +51,9 @@ class Link : public l2cap::internal::ILink, public hci::acl_manager::ConnectionM DynamicChannelServiceManagerImpl* dynamic_service_manager, FixedChannelServiceManagerImpl* fixed_service_manager, LinkManager* link_manager); + Link(const Link&) = delete; + Link& operator=(const Link&) = delete; + hci::AddressWithType GetDevice() const override { return {acl_connection_->GetAddress(), hci::AddressType::PUBLIC_DEVICE_ADDRESS}; } @@ -234,7 +237,6 @@ class Link : public l2cap::internal::ILink, public hci::acl_manager::ConnectionM bool has_requested_authentication_ = false; std::list<EncryptionChangeListener> encryption_change_listener_; std::atomic_int remaining_packets_to_be_sent_ = 0; - DISALLOW_COPY_AND_ASSIGN(Link); }; } // namespace internal diff --git a/system/gd/l2cap/classic/internal/link_manager.h b/system/gd/l2cap/classic/internal/link_manager.h index a81b0f5aad..4d327ea5bf 100644 --- a/system/gd/l2cap/classic/internal/link_manager.h +++ b/system/gd/l2cap/classic/internal/link_manager.h @@ -52,6 +52,9 @@ class LinkManager : public hci::acl_manager::ConnectionCallbacks { acl_manager_->RegisterCallbacks(this, l2cap_handler_); } + LinkManager(const LinkManager&) = delete; + LinkManager& operator=(const LinkManager&) = delete; + struct PendingFixedChannelConnection { os::Handler* handler_; FixedChannelManager::OnConnectionFailureCallback on_fail_callback_; @@ -147,8 +150,6 @@ class LinkManager : public hci::acl_manager::ConnectionCallbacks { os::Handler* link_property_callback_handler_ = nullptr; std::unordered_set<hci::Address> disconnected_links_; std::unordered_set<hci::Address> links_with_pending_packets_; - - DISALLOW_COPY_AND_ASSIGN(LinkManager); }; } // namespace internal diff --git a/system/gd/l2cap/classic/l2cap_classic_module.h b/system/gd/l2cap/classic/l2cap_classic_module.h index f22f039768..407de38dc4 100644 --- a/system/gd/l2cap/classic/l2cap_classic_module.h +++ b/system/gd/l2cap/classic/l2cap_classic_module.h @@ -36,6 +36,9 @@ namespace classic { class L2capClassicModule : public bluetooth::Module { public: L2capClassicModule(); + L2capClassicModule(const L2capClassicModule&) = delete; + L2capClassicModule& operator=(const L2capClassicModule&) = delete; + virtual ~L2capClassicModule(); /** @@ -86,8 +89,6 @@ class L2capClassicModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(L2capClassicModule); }; } // namespace classic diff --git a/system/gd/l2cap/internal/dynamic_channel_impl.h b/system/gd/l2cap/internal/dynamic_channel_impl.h index a012fff2de..4ae959f2e6 100644 --- a/system/gd/l2cap/internal/dynamic_channel_impl.h +++ b/system/gd/l2cap/internal/dynamic_channel_impl.h @@ -36,6 +36,9 @@ class DynamicChannelImpl : public l2cap::internal::ChannelImpl { public: DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, l2cap::internal::ILink* link, os::Handler* l2cap_handler); + DynamicChannelImpl(const DynamicChannelImpl&) = delete; + DynamicChannelImpl& operator=(const DynamicChannelImpl&) = delete; + virtual ~DynamicChannelImpl() = default; hci::AddressWithType GetDevice() const; @@ -90,8 +93,6 @@ class DynamicChannelImpl : public l2cap::internal::ChannelImpl { static constexpr size_t kChannelQueueSize = 5; common::BidiQueue<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder> channel_queue_{ kChannelQueueSize}; - - DISALLOW_COPY_AND_ASSIGN(DynamicChannelImpl); }; } // namespace internal diff --git a/system/gd/l2cap/le/dynamic_channel_manager.h b/system/gd/l2cap/le/dynamic_channel_manager.h index e5334ef13e..2d1b24f069 100644 --- a/system/gd/l2cap/le/dynamic_channel_manager.h +++ b/system/gd/l2cap/le/dynamic_channel_manager.h @@ -40,6 +40,9 @@ class DynamicChannelServiceManagerImpl; class DynamicChannelManager { public: + DynamicChannelManager(const DynamicChannelManager&) = delete; + DynamicChannelManager& operator=(const DynamicChannelManager&) = delete; + enum class ConnectionResultCode { SUCCESS = 0, FAIL_NO_SERVICE_REGISTERED = 1, // No service is registered @@ -138,7 +141,6 @@ class DynamicChannelManager { internal::DynamicChannelServiceManagerImpl* service_manager_ = nullptr; internal::LinkManager* link_manager_ = nullptr; os::Handler* l2cap_layer_handler_ = nullptr; - DISALLOW_COPY_AND_ASSIGN(DynamicChannelManager); }; } // namespace le diff --git a/system/gd/l2cap/le/dynamic_channel_service.h b/system/gd/l2cap/le/dynamic_channel_service.h index 898c885eca..4294e59aea 100644 --- a/system/gd/l2cap/le/dynamic_channel_service.h +++ b/system/gd/l2cap/le/dynamic_channel_service.h @@ -32,6 +32,8 @@ class DynamicChannelServiceManagerImpl; class DynamicChannelService { public: DynamicChannelService() = default; + DynamicChannelService(const DynamicChannelService&) = delete; + DynamicChannelService& operator=(const DynamicChannelService&) = delete; using OnUnregisteredCallback = common::OnceCallback<void()>; @@ -58,7 +60,6 @@ class DynamicChannelService { Psm psm_ = kDefaultPsm; internal::DynamicChannelServiceManagerImpl* manager_ = nullptr; os::Handler* l2cap_layer_handler_; - DISALLOW_COPY_AND_ASSIGN(DynamicChannelService); }; } // namespace le diff --git a/system/gd/l2cap/le/fixed_channel_manager.h b/system/gd/l2cap/le/fixed_channel_manager.h index 1b059ac342..9bd2c70cd8 100644 --- a/system/gd/l2cap/le/fixed_channel_manager.h +++ b/system/gd/l2cap/le/fixed_channel_manager.h @@ -36,6 +36,9 @@ class FixedChannelServiceManagerImpl; class FixedChannelManager { public: + FixedChannelManager(const FixedChannelManager&) = delete; + FixedChannelManager& operator=(const FixedChannelManager&) = delete; + enum class ConnectionResultCode { SUCCESS = 0, FAIL_NO_SERVICE_REGISTERED = 1, // No service is registered @@ -136,7 +139,6 @@ class FixedChannelManager { internal::FixedChannelServiceManagerImpl* service_manager_ = nullptr; internal::LinkManager* link_manager_ = nullptr; os::Handler* l2cap_layer_handler_ = nullptr; - DISALLOW_COPY_AND_ASSIGN(FixedChannelManager); }; } // namespace le diff --git a/system/gd/l2cap/le/fixed_channel_service.h b/system/gd/l2cap/le/fixed_channel_service.h index 0c4556e230..7660e31ec5 100644 --- a/system/gd/l2cap/le/fixed_channel_service.h +++ b/system/gd/l2cap/le/fixed_channel_service.h @@ -32,6 +32,8 @@ class FixedChannelServiceManagerImpl; class FixedChannelService { public: FixedChannelService() = default; + FixedChannelService(const FixedChannelService&) = delete; + FixedChannelService& operator=(const FixedChannelService&) = delete; using OnUnregisteredCallback = common::OnceCallback<void()>; @@ -51,7 +53,6 @@ class FixedChannelService { Cid cid_ = kInvalidCid; internal::FixedChannelServiceManagerImpl* manager_ = nullptr; os::Handler* l2cap_layer_handler_; - DISALLOW_COPY_AND_ASSIGN(FixedChannelService); }; } // namespace le diff --git a/system/gd/l2cap/le/internal/fixed_channel_impl.h b/system/gd/l2cap/le/internal/fixed_channel_impl.h index d4fb3a3708..59a68add89 100644 --- a/system/gd/l2cap/le/internal/fixed_channel_impl.h +++ b/system/gd/l2cap/le/internal/fixed_channel_impl.h @@ -36,6 +36,9 @@ class FixedChannelImpl : public l2cap::internal::ChannelImpl { public: FixedChannelImpl(Cid cid, Link* link, os::Handler* l2cap_handler); + FixedChannelImpl(const FixedChannelImpl&) = delete; + FixedChannelImpl& operator=(const FixedChannelImpl&) = delete; + virtual ~FixedChannelImpl() = default; hci::AddressWithType GetDevice() const { @@ -98,8 +101,6 @@ class FixedChannelImpl : public l2cap::internal::ChannelImpl { static constexpr size_t kChannelQueueSize = 10; common::BidiQueue<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder> channel_queue_{ kChannelQueueSize}; - - DISALLOW_COPY_AND_ASSIGN(FixedChannelImpl); }; } // namespace internal diff --git a/system/gd/l2cap/le/internal/link.h b/system/gd/l2cap/le/internal/link.h index 518793eb32..a17ea33b6d 100644 --- a/system/gd/l2cap/le/internal/link.h +++ b/system/gd/l2cap/le/internal/link.h @@ -49,6 +49,9 @@ class Link : public l2cap::internal::ILink, public hci::acl_manager::LeConnectio DynamicChannelServiceManagerImpl* dynamic_service_manager, FixedChannelServiceManagerImpl* fixed_service_manager, LinkManager* link_manager); + Link(const Link&) = delete; + Link& operator=(const Link&) = delete; + ~Link() = default; inline hci::AddressWithType GetDevice() const override { @@ -170,7 +173,6 @@ class Link : public l2cap::internal::ILink, public hci::acl_manager::LeConnectio uint16_t update_request_latency_; uint16_t update_request_supervision_timeout_; std::atomic_int remaining_packets_to_be_sent_ = 0; - DISALLOW_COPY_AND_ASSIGN(Link); // Received connection update complete from ACL manager. SignalId is bound to a valid number when we need to send a // response to remote. If SignalId is bound to an invalid number, we don't send a response to remote, because the diff --git a/system/gd/l2cap/le/internal/link_manager.h b/system/gd/l2cap/le/internal/link_manager.h index c6ec046ec4..836a3f6e8c 100644 --- a/system/gd/l2cap/le/internal/link_manager.h +++ b/system/gd/l2cap/le/internal/link_manager.h @@ -56,6 +56,9 @@ class LinkManager : public hci::acl_manager::LeConnectionCallbacks { acl_manager_->RegisterLeCallbacks(this, l2cap_handler_); } + LinkManager(const LinkManager&) = delete; + LinkManager& operator=(const LinkManager&) = delete; + struct PendingFixedChannelConnection { os::Handler* handler_; FixedChannelManager::OnConnectionFailureCallback on_fail_callback_; @@ -116,8 +119,6 @@ class LinkManager : public hci::acl_manager::LeConnectionCallbacks { LinkPropertyListener* link_property_listener_ = nullptr; std::unordered_set<hci::AddressWithType> disconnected_links_; std::unordered_set<hci::AddressWithType> links_with_pending_packets_; - - DISALLOW_COPY_AND_ASSIGN(LinkManager); }; } // namespace internal diff --git a/system/gd/l2cap/le/l2cap_le_module.h b/system/gd/l2cap/le/l2cap_le_module.h index 05cabd21ff..28352c0c68 100644 --- a/system/gd/l2cap/le/l2cap_le_module.h +++ b/system/gd/l2cap/le/l2cap_le_module.h @@ -39,6 +39,9 @@ namespace le { class L2capLeModule : public bluetooth::Module { public: L2capLeModule(); + L2capLeModule(const L2capLeModule&) = delete; + L2capLeModule& operator=(const L2capLeModule&) = delete; + virtual ~L2capLeModule(); /** @@ -81,8 +84,6 @@ class L2capLeModule : public bluetooth::Module { * This is not synchronized. */ virtual void SetLinkPropertyListener(os::Handler* handler, LinkPropertyListener* listener); - - DISALLOW_COPY_AND_ASSIGN(L2capLeModule); }; } // namespace le diff --git a/system/gd/neighbor/connectability.h b/system/gd/neighbor/connectability.h index eebf741104..00858059dd 100644 --- a/system/gd/neighbor/connectability.h +++ b/system/gd/neighbor/connectability.h @@ -29,6 +29,9 @@ class ConnectabilityModule : public bluetooth::Module { bool IsConnectable() const; ConnectabilityModule(); + ConnectabilityModule(const ConnectabilityModule&) = delete; + ConnectabilityModule& operator=(const ConnectabilityModule&) = delete; + ~ConnectabilityModule(); static const ModuleFactory Factory; @@ -44,8 +47,6 @@ class ConnectabilityModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(ConnectabilityModule); }; } // namespace neighbor diff --git a/system/gd/neighbor/discoverability.h b/system/gd/neighbor/discoverability.h index cce4b87965..4c118c293e 100644 --- a/system/gd/neighbor/discoverability.h +++ b/system/gd/neighbor/discoverability.h @@ -35,6 +35,9 @@ class DiscoverabilityModule : public bluetooth::Module { static const ModuleFactory Factory; DiscoverabilityModule(); + DiscoverabilityModule(const DiscoverabilityModule&) = delete; + DiscoverabilityModule& operator=(const DiscoverabilityModule&) = delete; + ~DiscoverabilityModule(); protected: @@ -48,8 +51,6 @@ class DiscoverabilityModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(DiscoverabilityModule); }; } // namespace neighbor diff --git a/system/gd/neighbor/inquiry.h b/system/gd/neighbor/inquiry.h index 1482af521a..5304be5327 100644 --- a/system/gd/neighbor/inquiry.h +++ b/system/gd/neighbor/inquiry.h @@ -67,6 +67,9 @@ class InquiryModule : public bluetooth::Module { static const ModuleFactory Factory; InquiryModule(); + InquiryModule(const InquiryModule&) = delete; + InquiryModule& operator=(const InquiryModule&) = delete; + ~InquiryModule(); protected: @@ -80,8 +83,6 @@ class InquiryModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(InquiryModule); }; } // namespace neighbor diff --git a/system/gd/neighbor/name.h b/system/gd/neighbor/name.h index 233757ddd4..48d8eadd2a 100644 --- a/system/gd/neighbor/name.h +++ b/system/gd/neighbor/name.h @@ -45,6 +45,9 @@ class NameModule : public bluetooth::Module { static const ModuleFactory Factory; NameModule(); + NameModule(const NameModule&) = delete; + NameModule& operator=(const NameModule&) = delete; + ~NameModule(); protected: @@ -58,8 +61,6 @@ class NameModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(NameModule); }; } // namespace neighbor diff --git a/system/gd/neighbor/name_db.h b/system/gd/neighbor/name_db.h index 1180cff9bb..5164f721dd 100644 --- a/system/gd/neighbor/name_db.h +++ b/system/gd/neighbor/name_db.h @@ -40,6 +40,9 @@ class NameDbModule : public bluetooth::Module { static const ModuleFactory Factory; NameDbModule(); + NameDbModule(const NameDbModule&) = delete; + NameDbModule& operator=(const NameDbModule&) = delete; + ~NameDbModule(); protected: @@ -53,8 +56,6 @@ class NameDbModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(NameDbModule); }; } // namespace neighbor diff --git a/system/gd/neighbor/page.h b/system/gd/neighbor/page.h index 14c3ae606b..19c55b9b92 100644 --- a/system/gd/neighbor/page.h +++ b/system/gd/neighbor/page.h @@ -43,6 +43,9 @@ class PageModule : public bluetooth::Module { static const ModuleFactory Factory; PageModule(); + PageModule(const PageModule&) = delete; + PageModule& operator=(const PageModule&) = delete; + ~PageModule(); protected: @@ -56,8 +59,6 @@ class PageModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(PageModule); }; } // namespace neighbor diff --git a/system/gd/neighbor/scan.h b/system/gd/neighbor/scan.h index e1699b4e05..6cea59595d 100644 --- a/system/gd/neighbor/scan.h +++ b/system/gd/neighbor/scan.h @@ -25,6 +25,9 @@ namespace neighbor { class ScanModule : public bluetooth::Module { public: ScanModule(); + ScanModule(const ScanModule&) = delete; + ScanModule& operator=(const ScanModule&) = delete; + ~ScanModule(); void SetInquiryScan(); @@ -48,8 +51,6 @@ class ScanModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(ScanModule); }; } // namespace neighbor diff --git a/system/gd/os/alarm.h b/system/gd/os/alarm.h index 773c36f4ac..4a689da48b 100644 --- a/system/gd/os/alarm.h +++ b/system/gd/os/alarm.h @@ -36,11 +36,12 @@ class Alarm { // Create and register a single-shot alarm on a given handler explicit Alarm(Handler* handler); + Alarm(const Alarm&) = delete; + Alarm& operator=(const Alarm&) = delete; + // Unregister this alarm from the thread and release resource ~Alarm(); - DISALLOW_COPY_AND_ASSIGN(Alarm); - // Schedule the alarm with given delay void Schedule(common::OnceClosure task, std::chrono::milliseconds delay); diff --git a/system/gd/os/handler.h b/system/gd/os/handler.h index a1ab389121..1dabbde7ff 100644 --- a/system/gd/os/handler.h +++ b/system/gd/os/handler.h @@ -38,11 +38,12 @@ class Handler : public common::IPostableContext { // Create and register a handler on given thread explicit Handler(Thread* thread); + Handler(const Handler&) = delete; + Handler& operator=(const Handler&) = delete; + // Unregister this handler from the thread and release resource. Unhandled events will be discarded and not executed. virtual ~Handler(); - DISALLOW_COPY_AND_ASSIGN(Handler); - // Enqueue a closure to the queue of this handler virtual void Post(common::OnceClosure closure) override; diff --git a/system/gd/os/linux_generic/reactive_semaphore.h b/system/gd/os/linux_generic/reactive_semaphore.h index 718666c69c..dd54b1a9dc 100644 --- a/system/gd/os/linux_generic/reactive_semaphore.h +++ b/system/gd/os/linux_generic/reactive_semaphore.h @@ -26,6 +26,10 @@ class ReactiveSemaphore { public: // Creates a new ReactiveSemaphore with an initial value of |value|. explicit ReactiveSemaphore(unsigned int value); + + ReactiveSemaphore(const ReactiveSemaphore&) = delete; + ReactiveSemaphore& operator=(const ReactiveSemaphore&) = delete; + ~ReactiveSemaphore(); // Decrements the value of |fd_|, this will cause a crash if |fd_| unreadable. void Decrease(); @@ -33,8 +37,6 @@ class ReactiveSemaphore { void Increase(); int GetFd(); - DISALLOW_COPY_AND_ASSIGN(ReactiveSemaphore); - private: int fd_; }; diff --git a/system/gd/os/reactor.h b/system/gd/os/reactor.h index 4a5c3772d3..c85625c339 100644 --- a/system/gd/os/reactor.h +++ b/system/gd/os/reactor.h @@ -44,11 +44,12 @@ class Reactor { // Construct a reactor on the current thread Reactor(); + Reactor(const Reactor&) = delete; + Reactor& operator=(const Reactor&) = delete; + // Destruct this reactor and release its resources ~Reactor(); - DISALLOW_COPY_AND_ASSIGN(Reactor); - // Start the reactor. The current thread will be blocked until Stop() is invoked and handled. void Run(); diff --git a/system/gd/os/repeating_alarm.h b/system/gd/os/repeating_alarm.h index 6b37162cf1..b261b5e7fd 100644 --- a/system/gd/os/repeating_alarm.h +++ b/system/gd/os/repeating_alarm.h @@ -36,11 +36,12 @@ class RepeatingAlarm { // Create and register a repeating alarm on a given handler explicit RepeatingAlarm(Handler* handler); + RepeatingAlarm(const RepeatingAlarm&) = delete; + RepeatingAlarm& operator=(const RepeatingAlarm&) = delete; + // Unregister this alarm from the thread and release resource ~RepeatingAlarm(); - DISALLOW_COPY_AND_ASSIGN(RepeatingAlarm); - // Schedule a repeating alarm with given period void Schedule(common::Closure task, std::chrono::milliseconds period); diff --git a/system/gd/os/thread.h b/system/gd/os/thread.h index d14d75ea21..4be792d3cc 100644 --- a/system/gd/os/thread.h +++ b/system/gd/os/thread.h @@ -43,11 +43,12 @@ class Thread { // priority: priority for kernel scheduler Thread(const std::string& name, Priority priority); + Thread(const Thread&) = delete; + Thread& operator=(const Thread&) = delete; + // Stop and destroy this thread ~Thread(); - DISALLOW_COPY_AND_ASSIGN(Thread); - // Stop this thread. Must be invoked from another thread. After this thread is stopped, it cannot be started again. bool Stop(); diff --git a/system/gd/security/facade_configuration_api.h b/system/gd/security/facade_configuration_api.h index d6bab79579..9feb8a4600 100644 --- a/system/gd/security/facade_configuration_api.h +++ b/system/gd/security/facade_configuration_api.h @@ -35,6 +35,9 @@ namespace security { */ class FacadeConfigurationApi { public: + FacadeConfigurationApi(const FacadeConfigurationApi&) = delete; + FacadeConfigurationApi& operator=(const FacadeConfigurationApi&) = delete; + friend class internal::SecurityManagerImpl; friend class SecurityModule; @@ -63,7 +66,6 @@ class FacadeConfigurationApi { private: os::Handler* security_handler_ = nullptr; internal::SecurityManagerImpl* security_manager_impl_; - DISALLOW_COPY_AND_ASSIGN(FacadeConfigurationApi); }; } // namespace security diff --git a/system/gd/security/security_manager.h b/system/gd/security/security_manager.h index 627cc2ac89..1842761187 100644 --- a/system/gd/security/security_manager.h +++ b/system/gd/security/security_manager.h @@ -36,6 +36,9 @@ namespace security { */ class SecurityManager : public UICallbacks { public: + SecurityManager(const SecurityManager&) = delete; + SecurityManager& operator=(const SecurityManager&) = delete; + friend class SecurityModule; /** @@ -133,7 +136,6 @@ class SecurityManager : public UICallbacks { private: os::Handler* security_handler_ = nullptr; internal::SecurityManagerImpl* security_manager_impl_; - DISALLOW_COPY_AND_ASSIGN(SecurityManager); }; } // namespace security diff --git a/system/gd/security/security_module.h b/system/gd/security/security_module.h index 889073388a..68ba2dacd1 100644 --- a/system/gd/security/security_module.h +++ b/system/gd/security/security_module.h @@ -27,6 +27,9 @@ namespace security { class SecurityModule : public bluetooth::Module { public: SecurityModule() = default; + SecurityModule(const SecurityModule&) = delete; + SecurityModule& operator=(const SecurityModule&) = delete; + ~SecurityModule() = default; /** @@ -55,7 +58,6 @@ class SecurityModule : public bluetooth::Module { private: struct impl; std::unique_ptr<impl> pimpl_; - DISALLOW_COPY_AND_ASSIGN(SecurityModule); }; } // namespace security diff --git a/system/gd/security/test/mocks.h b/system/gd/security/test/mocks.h index 3ddc909f4c..dc8d3254db 100644 --- a/system/gd/security/test/mocks.h +++ b/system/gd/security/test/mocks.h @@ -30,6 +30,9 @@ namespace security { class UIMock : public UI { public: UIMock() = default; + UIMock(const UIMock&) = delete; + UIMock& operator=(const UIMock&) = delete; + ~UIMock() = default; // Convert these to accept ConfirmationData @@ -40,9 +43,6 @@ class UIMock : public UI { MOCK_METHOD1(DisplayEnterPasskeyDialog, void(ConfirmationData)); MOCK_METHOD1(DisplayPasskey, void(ConfirmationData)); MOCK_METHOD1(DisplayEnterPinDialog, void(ConfirmationData)); - - private: - DISALLOW_COPY_AND_ASSIGN(UIMock); }; class LeSecurityInterfaceMock : public hci::LeSecurityInterface { diff --git a/system/gd/shim/dumpsys.h b/system/gd/shim/dumpsys.h index 35c1936d77..04be062793 100644 --- a/system/gd/shim/dumpsys.h +++ b/system/gd/shim/dumpsys.h @@ -36,6 +36,10 @@ class Dumpsys : public bluetooth::Module { os::Handler* GetGdShimHandler(); Dumpsys(const std::string& pre_bundled_schema); + + Dumpsys(const Dumpsys&) = delete; + Dumpsys& operator=(const Dumpsys&) = delete; + ~Dumpsys() = default; static const ModuleFactory Factory; @@ -51,7 +55,6 @@ class Dumpsys : public bluetooth::Module { struct impl; std::unique_ptr<impl> pimpl_; const dumpsys::ReflectionSchema reflection_schema_; - DISALLOW_COPY_AND_ASSIGN(Dumpsys); }; } // namespace shim diff --git a/system/gd/storage/config_cache.h b/system/gd/storage/config_cache.h index f0e1fe456b..44229e473d 100644 --- a/system/gd/storage/config_cache.h +++ b/system/gd/storage/config_cache.h @@ -52,10 +52,13 @@ class Mutation; class ConfigCache { public: ConfigCache(size_t temp_device_capacity, std::unordered_set<std::string_view> persistent_property_names); + + ConfigCache(const ConfigCache&) = delete; + ConfigCache& operator=(const ConfigCache&) = delete; + virtual ~ConfigCache() = default; // no copy - DISALLOW_COPY_AND_ASSIGN(ConfigCache); // can move ConfigCache(ConfigCache&& other) noexcept; diff --git a/system/gd/storage/storage_module.h b/system/gd/storage/storage_module.h index 8853a4e76f..ba41b1a5eb 100644 --- a/system/gd/storage/storage_module.h +++ b/system/gd/storage/storage_module.h @@ -47,6 +47,9 @@ class StorageModule : public bluetooth::Module { static const std::string kAdapterSection; + StorageModule(const StorageModule&) = delete; + StorageModule& operator=(const StorageModule&) = delete; + ~StorageModule(); static const ModuleFactory Factory; @@ -146,8 +149,6 @@ class StorageModule : public bluetooth::Module { bool is_restricted_mode_; bool is_single_user_mode_; static bool is_config_checksum_pass(int check_bit); - - DISALLOW_COPY_AND_ASSIGN(StorageModule); }; } // namespace storage diff --git a/system/main/shim/acl.h b/system/main/shim/acl.h index d156f85d46..f90e641455 100644 --- a/system/main/shim/acl.h +++ b/system/main/shim/acl.h @@ -43,6 +43,10 @@ class Acl : public hci::acl_manager::ConnectionCallbacks, public: Acl(os::Handler* handler, const acl_interface_t& acl_interface, uint8_t max_acceptlist_size, uint8_t max_address_resolution_size); + + Acl(const Acl&) = delete; + Acl& operator=(const Acl&) = delete; + ~Acl(); // hci::acl_manager::ConnectionCallbacks @@ -120,7 +124,6 @@ class Acl : public hci::acl_manager::ConnectionCallbacks, struct impl; std::unique_ptr<impl> pimpl_; - DISALLOW_COPY_AND_ASSIGN(Acl); }; } // namespace legacy diff --git a/system/main/shim/stack.h b/system/main/shim/stack.h index b105866b18..f32db434a1 100644 --- a/system/main/shim/stack.h +++ b/system/main/shim/stack.h @@ -39,6 +39,9 @@ class Stack { static Stack* GetInstance(); Stack() = default; + Stack(const Stack&) = delete; + Stack& operator=(const Stack&) = delete; + ~Stack() = default; // Idle mode, config is loaded, but controller is not enabled @@ -64,8 +67,6 @@ class Stack { return rust_controller_; } - DISALLOW_COPY_AND_ASSIGN(Stack); - private: mutable std::recursive_mutex mutex_; StackManager stack_manager_; diff --git a/system/packet/avrcp/avrcp_browse_packet.h b/system/packet/avrcp/avrcp_browse_packet.h index 038f576426..f6bd72e225 100644 --- a/system/packet/avrcp/avrcp_browse_packet.h +++ b/system/packet/avrcp/avrcp_browse_packet.h @@ -17,7 +17,6 @@ #pragma once #include <base/logging.h> -#include <base/macros.h> #include <iostream> #include "hardware/avrcp/avrcp_common.h" @@ -52,6 +51,9 @@ class BrowsePacketBuilder : public ::bluetooth::PacketBuilder { class BrowsePacket : public ::bluetooth::Packet { public: + BrowsePacket(const BrowsePacket&) = delete; + BrowsePacket& operator=(const BrowsePacket&) = delete; + virtual ~BrowsePacket() = default; static std::shared_ptr<BrowsePacket> Parse( @@ -76,8 +78,7 @@ class BrowsePacket : public ::bluetooth::Packet { private: virtual std::pair<size_t, size_t> GetPayloadIndecies() const override; - DISALLOW_COPY_AND_ASSIGN(BrowsePacket); }; } // namespace avrcp -} // namespace bluetooth
\ No newline at end of file +} // namespace bluetooth diff --git a/system/packet/avrcp/avrcp_packet.h b/system/packet/avrcp/avrcp_packet.h index ee0e0d5ad1..7a44dc57bb 100644 --- a/system/packet/avrcp/avrcp_packet.h +++ b/system/packet/avrcp/avrcp_packet.h @@ -17,7 +17,6 @@ #pragma once #include <base/logging.h> -#include <base/macros.h> #include <iostream> #include "hardware/avrcp/avrcp_common.h" @@ -62,6 +61,9 @@ class PacketBuilder : public ::bluetooth::PacketBuilder { class Packet : public ::bluetooth::Packet { public: + Packet(const Packet&) = delete; + Packet& operator=(const Packet&) = delete; + virtual ~Packet() = default; // TODO (apanicke): Right now we can use this to build an AvrcpPacket from @@ -104,7 +106,6 @@ class Packet : public ::bluetooth::Packet { private: virtual std::pair<size_t, size_t> GetPayloadIndecies() const override; - DISALLOW_COPY_AND_ASSIGN(Packet); }; } // namespace avrcp diff --git a/system/profile/avrcp/connection_handler.h b/system/profile/avrcp/connection_handler.h index 5320b63a47..67445a8df5 100644 --- a/system/profile/avrcp/connection_handler.h +++ b/system/profile/avrcp/connection_handler.h @@ -158,6 +158,9 @@ class ConnectionHandler { tAVRC_MSG* p_msg); ConnectionHandler() : weak_ptr_factory_(this){}; + ConnectionHandler(const ConnectionHandler&) = delete; + ConnectionHandler& operator=(const ConnectionHandler&) = delete; + virtual ~ConnectionHandler() = default; // Callback for when sending a response to a device @@ -165,7 +168,6 @@ class ConnectionHandler { std::unique_ptr<::bluetooth::PacketBuilder> message); base::WeakPtrFactory<ConnectionHandler> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ConnectionHandler); }; } // namespace avrcp diff --git a/system/profile/avrcp/device.h b/system/profile/avrcp/device.h index fc5d7364b0..07e1cac7d2 100644 --- a/system/profile/avrcp/device.h +++ b/system/profile/avrcp/device.h @@ -65,6 +65,10 @@ class Device { std::unique_ptr<::bluetooth::PacketBuilder> message)> send_msg_cb, uint16_t ctrl_mtu, uint16_t browse_mtu); + + Device(const Device&) = delete; + Device& operator=(const Device&) = delete; + virtual ~Device() = default; /** @@ -339,7 +343,6 @@ class Device { std::set<uint8_t> active_labels_; int8_t volume_ = -1; - DISALLOW_COPY_AND_ASSIGN(Device); }; } // namespace avrcp diff --git a/system/service/a2dp_sink.h b/system/service/a2dp_sink.h index 7bf59026ac..7b6f3ce7e0 100644 --- a/system/service/a2dp_sink.h +++ b/system/service/a2dp_sink.h @@ -16,8 +16,6 @@ #pragma once -#include <base/macros.h> - #include <atomic> #include <mutex> #include <string> @@ -47,6 +45,9 @@ class A2dpSink : public BluetoothInstance, virtual ~Delegate() = default; }; + A2dpSink(const A2dpSink&) = delete; + A2dpSink& operator=(const A2dpSink&) = delete; + ~A2dpSink() override; void SetDelegate(Delegate* delegate); @@ -84,21 +85,19 @@ class A2dpSink : public BluetoothInstance, std::mutex mutex_; std::mutex delegate_mutex_; Delegate* delegate_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(A2dpSink); }; class A2dpSinkFactory : public BluetoothInstanceFactory { public: A2dpSinkFactory(); + A2dpSinkFactory(const A2dpSinkFactory&) = delete; + A2dpSinkFactory& operator=(const A2dpSinkFactory&) = delete; + ~A2dpSinkFactory() override; // BluetoothInstanceFactory override: bool RegisterInstance(const Uuid& uuid, const RegisterCallback& callback) override; - - private: - DISALLOW_COPY_AND_ASSIGN(A2dpSinkFactory); }; } // namespace bluetooth diff --git a/system/service/a2dp_source.h b/system/service/a2dp_source.h index 801393f4d1..5b1b554606 100644 --- a/system/service/a2dp_source.h +++ b/system/service/a2dp_source.h @@ -16,8 +16,6 @@ #pragma once -#include <base/macros.h> - #include <atomic> #include <mutex> #include <string> @@ -50,6 +48,9 @@ class A2dpSource : public BluetoothInstance, virtual ~Delegate() = default; }; + A2dpSource(const A2dpSource&) = delete; + A2dpSource& operator=(const A2dpSource&) = delete; + ~A2dpSource() override; void SetDelegate(Delegate* delegate); @@ -99,21 +100,19 @@ class A2dpSource : public BluetoothInstance, // delegate function which attempts to take 'clock'. std::mutex delegate_mutex_; Delegate* delegate_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(A2dpSource); }; class A2dpSourceFactory : public BluetoothInstanceFactory { public: A2dpSourceFactory(); + A2dpSourceFactory(const A2dpSourceFactory&) = delete; + A2dpSourceFactory& operator=(const A2dpSourceFactory&) = delete; + ~A2dpSourceFactory() override; // BluetoothInstanceFactory override: bool RegisterInstance(const Uuid& uuid, const RegisterCallback& callback) override; - - private: - DISALLOW_COPY_AND_ASSIGN(A2dpSourceFactory); }; } // namespace bluetooth diff --git a/system/service/adapter.cc b/system/service/adapter.cc index 9c0468899a..19e7400a62 100644 --- a/system/service/adapter.cc +++ b/system/service/adapter.cc @@ -215,6 +215,9 @@ class AdapterImpl : public Adapter, public hal::BluetoothInterface::Observer { hal::BluetoothInterface::Get()->GetHALInterface()->get_adapter_properties(); } + AdapterImpl(const AdapterImpl&) = delete; + AdapterImpl& operator=(const AdapterImpl&) = delete; + ~AdapterImpl() override { hal::BluetoothInterface::Get()->RemoveObserver(this); } @@ -800,8 +803,6 @@ class AdapterImpl : public Adapter, public hal::BluetoothInterface::Observer { // Factory used to create per-app GattServer instances. std::unique_ptr<GattServerFactory> gatt_server_factory_; - - DISALLOW_COPY_AND_ASSIGN(AdapterImpl); }; // static diff --git a/system/service/adapter.h b/system/service/adapter.h index a4e517c2cc..e3fa306cf1 100644 --- a/system/service/adapter.h +++ b/system/service/adapter.h @@ -20,8 +20,6 @@ #include <string> #include <vector> -#include <base/macros.h> - #include "service/common/bluetooth/adapter_state.h" #include "service/common/bluetooth/remote_device_props.h" @@ -102,6 +100,9 @@ class Adapter { // in tests; use MockAdapter instead. static std::unique_ptr<Adapter> Create(); + Adapter(const Adapter&) = delete; + Adapter& operator=(const Adapter&) = delete; + virtual ~Adapter() = default; // Add or remove an observer. @@ -221,9 +222,6 @@ class Adapter { protected: Adapter() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(Adapter); }; } // namespace bluetooth diff --git a/system/service/avrcp_control.h b/system/service/avrcp_control.h index eef36f8927..47950e335d 100644 --- a/system/service/avrcp_control.h +++ b/system/service/avrcp_control.h @@ -19,7 +19,6 @@ #include <atomic> #include <mutex> -#include "base/macros.h" #include "bluetooth/uuid.h" #include "service/bluetooth_instance.h" #include "service/common/bluetooth/avrcp_media_attr.h" @@ -50,6 +49,9 @@ class AvrcpControl : public BluetoothInstance, virtual ~Delegate() = default; }; + AvrcpControl(const AvrcpControl&) = delete; + AvrcpControl& operator=(const AvrcpControl&) = delete; + // The destructor automatically unregisters this instance from the stack. ~AvrcpControl() override; @@ -106,8 +108,6 @@ class AvrcpControl : public BluetoothInstance, // Raw handle to the Delegate, which must outlive this AvrcpControl instance. std::mutex delegate_mutex_; Delegate* delegate_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(AvrcpControl); }; // AvrcpControlFactory is used to register and obtain a per-application @@ -121,6 +121,9 @@ class AvrcpControlFactory // Don't construct/destruct directly except in tests. Instead, obtain a handle // from an Adapter instance. AvrcpControlFactory(); + AvrcpControlFactory(const AvrcpControlFactory&) = delete; + AvrcpControlFactory& operator=(const AvrcpControlFactory&) = delete; + ~AvrcpControlFactory() override; // BluetoothInstanceFactory override: @@ -129,7 +132,6 @@ class AvrcpControlFactory private: std::atomic<int> next_control_id_{0}; - DISALLOW_COPY_AND_ASSIGN(AvrcpControlFactory); }; } // namespace bluetooth diff --git a/system/service/avrcp_target.cc b/system/service/avrcp_target.cc index f5d21b72a5..9a39b412f4 100644 --- a/system/service/avrcp_target.cc +++ b/system/service/avrcp_target.cc @@ -23,7 +23,6 @@ #include "array_utils.h" #include "base/logging.h" -#include "base/macros.h" #include "base/memory/ptr_util.h" #include "service/logging_helpers.h" #include "stack/include/avrc_defs.h" diff --git a/system/service/avrcp_target.h b/system/service/avrcp_target.h index e0ee57bb5a..76c5be0db8 100644 --- a/system/service/avrcp_target.h +++ b/system/service/avrcp_target.h @@ -20,7 +20,6 @@ #include <string> #include <vector> -#include "base/macros.h" #include "service/bluetooth_instance.h" #include "service/common/bluetooth/avrcp_int_value.h" #include "service/common/bluetooth/avrcp_register_notification_response.h" @@ -68,6 +67,9 @@ class AvrcpTarget : public BluetoothInstance, virtual ~Delegate() = default; }; + AvrcpTarget(const AvrcpTarget&) = delete; + AvrcpTarget& operator=(const AvrcpTarget&) = delete; + // The destructor automatically unregisters this instance from the stack. ~AvrcpTarget() override; @@ -150,8 +152,6 @@ class AvrcpTarget : public BluetoothInstance, // Raw handle to the Delegate, which must outlive this AvrcpTarget instance. std::mutex delegate_mutex_; Delegate* delegate_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(AvrcpTarget); }; // AvrcpTargetFactory is used to register and obtain a per-application @@ -165,14 +165,14 @@ class AvrcpTargetFactory // Don't construct/destruct directly except in tests. Instead, obtain a handle // from an Adapter instance. AvrcpTargetFactory(); + AvrcpTargetFactory(const AvrcpTargetFactory&) = delete; + AvrcpTargetFactory& operator=(const AvrcpTargetFactory&) = delete; + ~AvrcpTargetFactory() override; // BluetoothInstanceFactory override: bool RegisterInstance(const Uuid& uuid, const RegisterCallback& callback) override; - - private: - DISALLOW_COPY_AND_ASSIGN(AvrcpTargetFactory); }; } // namespace bluetooth diff --git a/system/service/bluetooth_instance.h b/system/service/bluetooth_instance.h index d0146c585a..5728d5e02b 100644 --- a/system/service/bluetooth_instance.h +++ b/system/service/bluetooth_instance.h @@ -19,7 +19,6 @@ #include <functional> #include <memory> -#include <base/macros.h> #include <bluetooth/uuid.h> #include "service/common/bluetooth/low_energy_constants.h" @@ -31,6 +30,9 @@ namespace bluetooth { // stack-assigned integer "instance_id" ID associated with it. class BluetoothInstance { public: + BluetoothInstance(const BluetoothInstance&) = delete; + BluetoothInstance& operator=(const BluetoothInstance&) = delete; + virtual ~BluetoothInstance() = default; // Returns the app-specific unique ID used while registering this instance. @@ -43,9 +45,6 @@ class BluetoothInstance { // Constructor shouldn't be called directly as instances are meant to be // obtained from the factory. BluetoothInstance() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(BluetoothInstance); }; // A BluetoothInstanceFactory provides a common interface for factory @@ -54,6 +53,9 @@ class BluetoothInstance { class BluetoothInstanceFactory { public: BluetoothInstanceFactory() = default; + BluetoothInstanceFactory(const BluetoothInstanceFactory&) = delete; + BluetoothInstanceFactory& operator=(const BluetoothInstanceFactory&) = delete; + virtual ~BluetoothInstanceFactory() = default; // Callback invoked as a result of a call to RegisterInstance. @@ -67,9 +69,6 @@ class BluetoothInstanceFactory { // the case of an error, the pointer will contain nullptr. virtual bool RegisterInstance(const Uuid& app_uuid, const RegisterCallback& callback) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(BluetoothInstanceFactory); }; } // namespace bluetooth diff --git a/system/service/client/main.cc b/system/service/client/main.cc index b4ab06e382..b08136997a 100644 --- a/system/service/client/main.cc +++ b/system/service/client/main.cc @@ -20,7 +20,6 @@ #include <base/at_exit.h> #include <base/command_line.h> #include <base/logging.h> -#include <base/macros.h> #include <base/strings/string_number_conversions.h> #include <base/strings/string_split.h> #include <base/strings/string_util.h> @@ -147,6 +146,8 @@ inline void EndAsyncOut() { class CLIBluetoothCallback : public android::bluetooth::BnBluetoothCallback { public: CLIBluetoothCallback() = default; + CLIBluetoothCallback(const CLIBluetoothCallback&) = delete; + CLIBluetoothCallback& operator=(const CLIBluetoothCallback&) = delete; ~CLIBluetoothCallback() override = default; // IBluetoothCallback overrides: @@ -216,15 +217,15 @@ class CLIBluetoothCallback : public android::bluetooth::BnBluetoothCallback { // no-op return Status::ok(); } - - private: - DISALLOW_COPY_AND_ASSIGN(CLIBluetoothCallback); }; class CLIBluetoothLowEnergyCallback : public android::bluetooth::BnBluetoothLowEnergyCallback { public: CLIBluetoothLowEnergyCallback() = default; + CLIBluetoothLowEnergyCallback(const CLIBluetoothLowEnergyCallback&) = delete; + CLIBluetoothLowEnergyCallback& operator=( + const CLIBluetoothLowEnergyCallback&) = delete; ~CLIBluetoothLowEnergyCallback() override = default; // IBluetoothLowEnergyCallback overrides: @@ -262,15 +263,16 @@ class CLIBluetoothLowEnergyCallback EndAsyncOut(); return Status::ok(); } - - private: - DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLowEnergyCallback); }; class CLIBluetoothLeAdvertiserCallback : public android::bluetooth::BnBluetoothLeAdvertiserCallback { public: CLIBluetoothLeAdvertiserCallback() = default; + CLIBluetoothLeAdvertiserCallback(const CLIBluetoothLeAdvertiserCallback&) = + delete; + CLIBluetoothLeAdvertiserCallback& operator=( + const CLIBluetoothLeAdvertiserCallback&) = delete; ~CLIBluetoothLeAdvertiserCallback() override = default; // IBluetoothLowEnergyCallback overrides: @@ -299,15 +301,15 @@ class CLIBluetoothLeAdvertiserCallback EndAsyncOut(); return Status::ok(); } - - private: - DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLeAdvertiserCallback); }; class CLIBluetoothLeScannerCallback : public android::bluetooth::BnBluetoothLeScannerCallback { public: CLIBluetoothLeScannerCallback() = default; + CLIBluetoothLeScannerCallback(const CLIBluetoothLeScannerCallback&) = delete; + CLIBluetoothLeScannerCallback& operator=( + const CLIBluetoothLeScannerCallback&) = delete; ~CLIBluetoothLeScannerCallback() override = default; // IBluetoothLowEnergyCallback overrides: @@ -341,15 +343,14 @@ class CLIBluetoothLeScannerCallback EndAsyncOut(); return Status::ok(); } - - private: - DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLeScannerCallback); }; class CLIGattClientCallback : public android::bluetooth::BnBluetoothGattClientCallback { public: CLIGattClientCallback() = default; + CLIGattClientCallback(const CLIGattClientCallback&) = delete; + CLIGattClientCallback& operator=(const CLIGattClientCallback&) = delete; ~CLIGattClientCallback() override = default; // IBluetoothGattClientCallback overrides: @@ -367,9 +368,6 @@ class CLIGattClientCallback gatt_registering = false; return Status::ok(); } - - private: - DISALLOW_COPY_AND_ASSIGN(CLIGattClientCallback); }; void PrintCommandStatus(bool status) { PrintOpStatus("Command", status); } @@ -1051,6 +1049,8 @@ bool ExecuteCommand(const sp<IBluetooth>& bt_iface, std::string& command) { class BluetoothDeathRecipient : public android::IBinder::DeathRecipient { public: BluetoothDeathRecipient() = default; + BluetoothDeathRecipient(const BluetoothDeathRecipient&) = delete; + BluetoothDeathRecipient& operator=(const BluetoothDeathRecipient&) = delete; ~BluetoothDeathRecipient() override = default; // android::IBinder::DeathRecipient override: @@ -1063,9 +1063,6 @@ class BluetoothDeathRecipient : public android::IBinder::DeathRecipient { android::IPCThreadState::self()->stopProcess(); should_exit = true; } - - private: - DISALLOW_COPY_AND_ASSIGN(BluetoothDeathRecipient); }; int main(int argc, char* argv[]) { diff --git a/system/service/common/bluetooth/advertise_data.h b/system/service/common/bluetooth/advertise_data.h index bae83ee334..796f7dcc15 100644 --- a/system/service/common/bluetooth/advertise_data.h +++ b/system/service/common/bluetooth/advertise_data.h @@ -20,8 +20,6 @@ #include <vector> -#include <base/macros.h> - namespace bluetooth { // Represents a data packet for Bluetooth Low Energy advertisements. This is the diff --git a/system/service/common/bluetooth/advertise_settings.h b/system/service/common/bluetooth/advertise_settings.h index 4aff4c92dd..e4aee5377a 100644 --- a/system/service/common/bluetooth/advertise_settings.h +++ b/system/service/common/bluetooth/advertise_settings.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <base/time/time.h> namespace bluetooth { diff --git a/system/service/common/bluetooth/util/atomic_string.h b/system/service/common/bluetooth/util/atomic_string.h index 46d4588ed2..f5ed1c3ba4 100644 --- a/system/service/common/bluetooth/util/atomic_string.h +++ b/system/service/common/bluetooth/util/atomic_string.h @@ -19,14 +19,16 @@ #include <mutex> #include <string> -#include <base/macros.h> - namespace util { // A simple atomic container class for std::string. class AtomicString final { public: explicit AtomicString(const std::string& str); + + AtomicString(const AtomicString&) = delete; + AtomicString& operator=(const AtomicString&) = delete; + ~AtomicString() = default; std::string Get() const; @@ -35,8 +37,6 @@ class AtomicString final { private: std::mutex lock_; std::string str_; - - DISALLOW_COPY_AND_ASSIGN(AtomicString); }; } // namespace util diff --git a/system/service/daemon.cc b/system/service/daemon.cc index 4cd384285b..11bfae1722 100644 --- a/system/service/daemon.cc +++ b/system/service/daemon.cc @@ -42,6 +42,9 @@ class DaemonImpl : public Daemon, public ipc::IPCManager::Delegate { public: DaemonImpl() : initialized_(false) {} + DaemonImpl(const DaemonImpl&) = delete; + DaemonImpl& operator=(const DaemonImpl&) = delete; + ~DaemonImpl() override { if (!initialized_) return; @@ -161,8 +164,6 @@ class DaemonImpl : public Daemon, public ipc::IPCManager::Delegate { std::unique_ptr<Settings> settings_; std::unique_ptr<Adapter> adapter_; std::unique_ptr<ipc::IPCManager> ipc_manager_; - - DISALLOW_COPY_AND_ASSIGN(DaemonImpl); }; } // namespace diff --git a/system/service/daemon.h b/system/service/daemon.h index 06afe91008..a1f26a07e2 100644 --- a/system/service/daemon.h +++ b/system/service/daemon.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include "abstract_message_loop.h" namespace ipc { @@ -62,13 +61,14 @@ class Daemon { protected: Daemon() = default; + Daemon(const Daemon&) = delete; + Daemon& operator=(const Daemon&) = delete; + virtual ~Daemon() = default; private: // Internal instance helper called by Initialize(). virtual bool Init() = 0; - - DISALLOW_COPY_AND_ASSIGN(Daemon); }; } // namespace bluetooth diff --git a/system/service/example/heart_rate/heart_rate_server.cc b/system/service/example/heart_rate/heart_rate_server.cc index 170042a70f..9777c203f8 100644 --- a/system/service/example/heart_rate/heart_rate_server.cc +++ b/system/service/example/heart_rate/heart_rate_server.cc @@ -41,6 +41,11 @@ class CLIBluetoothLeAdvertiserCallback android::sp<android::bluetooth::IBluetooth> bt) : bt_(bt) {} + CLIBluetoothLeAdvertiserCallback(const CLIBluetoothLeAdvertiserCallback&) = + delete; + CLIBluetoothLeAdvertiserCallback& operator=( + const CLIBluetoothLeAdvertiserCallback&) = delete; + // IBluetoothLeAdvertiserCallback overrides: Status OnAdvertiserRegistered(int status, int advertiser_id) { if (status != bluetooth::BLE_STATUS_SUCCESS) { @@ -90,7 +95,6 @@ class CLIBluetoothLeAdvertiserCallback private: android::sp<android::bluetooth::IBluetooth> bt_; - DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLeAdvertiserCallback); }; HeartRateServer::HeartRateServer( diff --git a/system/service/example/heart_rate/heart_rate_server.h b/system/service/example/heart_rate/heart_rate_server.h index e78c58aecf..1b716fd193 100644 --- a/system/service/example/heart_rate/heart_rate_server.h +++ b/system/service/example/heart_rate/heart_rate_server.h @@ -19,7 +19,6 @@ #include <mutex> #include <unordered_map> -#include <base/macros.h> #include <base/memory/ref_counted.h> #include <base/memory/weak_ptr.h> #if BASE_VER < 930627 @@ -44,6 +43,9 @@ class HeartRateServer HeartRateServer(android::sp<android::bluetooth::IBluetooth> bluetooth, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, bool advertise); + HeartRateServer(const HeartRateServer&) = delete; + HeartRateServer& operator=(const HeartRateServer&) = delete; + ~HeartRateServer() override; // Set up the server and register the GATT services with the stack. This @@ -141,8 +143,6 @@ class HeartRateServer // Note: This should remain the last member so that it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<HeartRateServer> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(HeartRateServer); }; } // namespace heart_rate diff --git a/system/service/gatt_client.h b/system/service/gatt_client.h index 5a0322d2da..4ed1143e4e 100644 --- a/system/service/gatt_client.h +++ b/system/service/gatt_client.h @@ -19,7 +19,6 @@ #include <mutex> #include <unordered_map> -#include <base/macros.h> #include <bluetooth/uuid.h> #include "service/bluetooth_instance.h" @@ -32,6 +31,9 @@ namespace bluetooth { // obtained through the factory. class GattClient : public BluetoothInstance { public: + GattClient(const GattClient&) = delete; + GattClient& operator=(const GattClient&) = delete; + ~GattClient() override; // BluetoothClientInstace overrides: @@ -48,8 +50,6 @@ class GattClient : public BluetoothInstance { // See getters above for documentation. Uuid app_identifier_; int client_id_; - - DISALLOW_COPY_AND_ASSIGN(GattClient); }; // GattClientFactory is used to register and obtain a per-application GattClient @@ -61,6 +61,9 @@ class GattClientFactory : public BluetoothInstanceFactory, // Don't construct/destruct directly except in tests. Instead, obtain a handle // from an Adapter instance. GattClientFactory(); + GattClientFactory(const GattClientFactory&) = delete; + GattClientFactory& operator=(const GattClientFactory&) = delete; + ~GattClientFactory() override; // BluetoothInstanceFactory override: @@ -76,8 +79,6 @@ class GattClientFactory : public BluetoothInstanceFactory, // Map of pending calls to register. std::mutex pending_calls_lock_; std::unordered_map<Uuid, RegisterCallback> pending_calls_; - - DISALLOW_COPY_AND_ASSIGN(GattClientFactory); }; } // namespace bluetooth diff --git a/system/service/gatt_server.h b/system/service/gatt_server.h index c46e8d00c4..7d670aed91 100644 --- a/system/service/gatt_server.h +++ b/system/service/gatt_server.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <bluetooth/uuid.h> #include <deque> @@ -45,6 +44,9 @@ class GattServer : public BluetoothInstance, class Delegate { public: Delegate() = default; + Delegate(const Delegate&) = delete; + Delegate& operator=(const Delegate&) = delete; + virtual ~Delegate() = default; // Called when there is an incoming read request for the characteristic with @@ -104,12 +106,12 @@ class GattServer : public BluetoothInstance, virtual void OnConnectionStateChanged(GattServer* gatt_server, const std::string& device_addres, bool connected) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(Delegate); }; // The desctructor automatically unregisters this instance from the stack. + GattServer(const GattServer&) = delete; + GattServer& operator=(const GattServer&) = delete; + ~GattServer() override; // Assigns a delegate to this instance. |delegate| must out-live this @@ -262,8 +264,6 @@ class GattServer : public BluetoothInstance, // Raw handle to the Delegate, which must outlive this GattServer instance. Delegate* delegate_; - - DISALLOW_COPY_AND_ASSIGN(GattServer); }; // GattServerFactory is used to register and obtain a per-application GattServer @@ -275,6 +275,9 @@ class GattServerFactory : public BluetoothInstanceFactory, // Don't construct/destruct directly except in tests. Instead, obtain a handle // from an Adapter instance. GattServerFactory(); + GattServerFactory(const GattServerFactory&) = delete; + GattServerFactory& operator=(const GattServerFactory&) = delete; + ~GattServerFactory() override; // BluetoothInstanceFactory override: @@ -290,8 +293,6 @@ class GattServerFactory : public BluetoothInstanceFactory, // Map of pending calls to register. std::mutex pending_calls_lock_; std::unordered_map<Uuid, RegisterCallback> pending_calls_; - - DISALLOW_COPY_AND_ASSIGN(GattServerFactory); }; } // namespace bluetooth diff --git a/system/service/hal/bluetooth_av_interface.cc b/system/service/hal/bluetooth_av_interface.cc index e4a759dd9f..beabd968f2 100644 --- a/system/service/hal/bluetooth_av_interface.cc +++ b/system/service/hal/bluetooth_av_interface.cc @@ -147,6 +147,9 @@ btav_sink_callbacks_t av_sink_callbacks = { class BluetoothAvInterfaceImpl : public BluetoothAvInterface { public: BluetoothAvInterfaceImpl() = default; + BluetoothAvInterfaceImpl(const BluetoothAvInterfaceImpl&) = delete; + BluetoothAvInterfaceImpl& operator=(const BluetoothAvInterfaceImpl&) = delete; + ~BluetoothAvInterfaceImpl() override { A2dpSinkDisable(); A2dpSourceDisable(); @@ -274,8 +277,6 @@ class BluetoothAvInterfaceImpl : public BluetoothAvInterface { bool source_enabled_ = false; bool sink_enabled_ = false; - - DISALLOW_COPY_AND_ASSIGN(BluetoothAvInterfaceImpl); }; namespace { diff --git a/system/service/hal/bluetooth_av_interface.h b/system/service/hal/bluetooth_av_interface.h index 2b444b2b67..4f0b4773e8 100644 --- a/system/service/hal/bluetooth_av_interface.h +++ b/system/service/hal/bluetooth_av_interface.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <hardware/bluetooth.h> #include <hardware/bt_av.h> @@ -90,10 +89,10 @@ class BluetoothAvInterface { protected: BluetoothAvInterface() = default; - virtual ~BluetoothAvInterface() = default; + BluetoothAvInterface(const BluetoothAvInterface&) = delete; + BluetoothAvInterface& operator=(const BluetoothAvInterface&) = delete; - private: - DISALLOW_COPY_AND_ASSIGN(BluetoothAvInterface); + virtual ~BluetoothAvInterface() = default; }; } // namespace hal diff --git a/system/service/hal/bluetooth_avrcp_interface.cc b/system/service/hal/bluetooth_avrcp_interface.cc index 42ac0a6372..cbb0317041 100644 --- a/system/service/hal/bluetooth_avrcp_interface.cc +++ b/system/service/hal/bluetooth_avrcp_interface.cc @@ -490,6 +490,10 @@ class BluetoothAvrcpInterfaceImpl : public BluetoothAvrcpInterface { public: BluetoothAvrcpInterfaceImpl() : control_iface_(nullptr) {} + BluetoothAvrcpInterfaceImpl(const BluetoothAvrcpInterfaceImpl&) = delete; + BluetoothAvrcpInterfaceImpl& operator=(const BluetoothAvrcpInterfaceImpl&) = + delete; + ~BluetoothAvrcpInterfaceImpl() override { if (control_iface_) control_iface_->cleanup(); } @@ -614,8 +618,6 @@ class BluetoothAvrcpInterfaceImpl : public BluetoothAvrcpInterface { bool control_enabled_ = false; bool target_enabled_ = false; - - DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpInterfaceImpl); }; namespace { diff --git a/system/service/hal/bluetooth_avrcp_interface.h b/system/service/hal/bluetooth_avrcp_interface.h index fc67c3c41f..4646880169 100644 --- a/system/service/hal/bluetooth_avrcp_interface.h +++ b/system/service/hal/bluetooth_avrcp_interface.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <hardware/bluetooth.h> #include <hardware/bt_rc.h> @@ -130,6 +129,9 @@ class BluetoothAvrcpInterface { uint8_t status); }; + BluetoothAvrcpInterface(const BluetoothAvrcpInterface&) = delete; + BluetoothAvrcpInterface& operator=(const BluetoothAvrcpInterface&) = delete; + // Initialize and clean up the BluetoothInterface singleton. Returns false if // the underlying HAL interface failed to initialize, and true on success. static bool Initialize(); @@ -172,9 +174,6 @@ class BluetoothAvrcpInterface { protected: BluetoothAvrcpInterface() = default; virtual ~BluetoothAvrcpInterface() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpInterface); }; } // namespace hal diff --git a/system/service/hal/bluetooth_gatt_interface.cc b/system/service/hal/bluetooth_gatt_interface.cc index c9d165b0c3..76cf5c9361 100644 --- a/system/service/hal/bluetooth_gatt_interface.cc +++ b/system/service/hal/bluetooth_gatt_interface.cc @@ -443,6 +443,10 @@ class BluetoothGattInterfaceImpl : public BluetoothGattInterface { public: BluetoothGattInterfaceImpl() : hal_iface_(nullptr) {} + BluetoothGattInterfaceImpl(const BluetoothGattInterfaceImpl&) = delete; + BluetoothGattInterfaceImpl& operator=(const BluetoothGattInterfaceImpl&) = + delete; + ~BluetoothGattInterfaceImpl() override { if (hal_iface_) hal_iface_->cleanup(); } @@ -536,8 +540,6 @@ class BluetoothGattInterfaceImpl : public BluetoothGattInterface { // The HAL handle obtained from the shared library. We hold a weak reference // to this since the actual data resides in the shared Bluetooth library. const btgatt_interface_t* hal_iface_; - - DISALLOW_COPY_AND_ASSIGN(BluetoothGattInterfaceImpl); }; namespace { diff --git a/system/service/hal/bluetooth_gatt_interface.h b/system/service/hal/bluetooth_gatt_interface.h index 471dfc4d03..ad3f851554 100644 --- a/system/service/hal/bluetooth_gatt_interface.h +++ b/system/service/hal/bluetooth_gatt_interface.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <hardware/bluetooth.h> #include <hardware/bt_gatt.h> @@ -254,14 +253,15 @@ class BluetoothGattInterface { protected: BluetoothGattInterface() = default; + BluetoothGattInterface(const BluetoothGattInterface&) = delete; + BluetoothGattInterface& operator=(const BluetoothGattInterface&) = delete; + virtual ~BluetoothGattInterface() = default; private: // Used to keep a reference count for the different BLE scan clients. std::mutex scan_clients_lock_; std::unordered_set<int> scan_client_set_; - - DISALLOW_COPY_AND_ASSIGN(BluetoothGattInterface); }; } // namespace hal diff --git a/system/service/hal/bluetooth_interface.cc b/system/service/hal/bluetooth_interface.cc index ba09119e74..f4746b74c6 100644 --- a/system/service/hal/bluetooth_interface.cc +++ b/system/service/hal/bluetooth_interface.cc @@ -296,6 +296,9 @@ class BluetoothInterfaceImpl : public BluetoothInterface { public: BluetoothInterfaceImpl() : hal_iface_(nullptr) {} + BluetoothInterfaceImpl(const BluetoothInterfaceImpl&) = delete; + BluetoothInterfaceImpl& operator=(const BluetoothInterfaceImpl&) = delete; + ~BluetoothInterfaceImpl() override { if (hal_iface_) hal_iface_->cleanup(); } @@ -357,8 +360,6 @@ class BluetoothInterfaceImpl : public BluetoothInterface { // The HAL handle obtained from the shared library. We hold a weak reference // to this since the actual data resides in the shared Bluetooth library. const bt_interface_t* hal_iface_; - - DISALLOW_COPY_AND_ASSIGN(BluetoothInterfaceImpl); }; namespace { diff --git a/system/service/hal/bluetooth_interface.h b/system/service/hal/bluetooth_interface.h index 0eaf8d80a4..da68c9ce09 100644 --- a/system/service/hal/bluetooth_interface.h +++ b/system/service/hal/bluetooth_interface.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <hardware/bluetooth.h> #include "types/raw_address.h" @@ -126,10 +125,10 @@ class BluetoothInterface { protected: BluetoothInterface() = default; - virtual ~BluetoothInterface() = default; + BluetoothInterface(const BluetoothInterface&) = delete; + BluetoothInterface& operator=(const BluetoothInterface&) = delete; - private: - DISALLOW_COPY_AND_ASSIGN(BluetoothInterface); + virtual ~BluetoothInterface() = default; }; } // namespace hal diff --git a/system/service/hal/fake_bluetooth_av_interface.h b/system/service/hal/fake_bluetooth_av_interface.h index c97c9a3180..e4a45ceeed 100644 --- a/system/service/hal/fake_bluetooth_av_interface.h +++ b/system/service/hal/fake_bluetooth_av_interface.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <base/observer_list.h> #include "abstract_observer_list.h" @@ -56,6 +55,10 @@ class FakeBluetoothAvInterface : public BluetoothAvInterface { std::shared_ptr<TestA2dpSourceHandler> a2dp_source_handler); FakeBluetoothAvInterface( std::shared_ptr<TestA2dpSinkHandler> a2dp_sink_handler); + + FakeBluetoothAvInterface(const FakeBluetoothAvInterface&) = delete; + FakeBluetoothAvInterface& operator=(const FakeBluetoothAvInterface&) = delete; + ~FakeBluetoothAvInterface(); // The methods below can be used to notify observers with certain events and @@ -92,8 +95,6 @@ class FakeBluetoothAvInterface : public BluetoothAvInterface { private: btbase::AbstractObserverList<A2dpSourceObserver> a2dp_source_observers_; btbase::AbstractObserverList<A2dpSinkObserver> a2dp_sink_observers_; - - DISALLOW_COPY_AND_ASSIGN(FakeBluetoothAvInterface); }; } // namespace hal diff --git a/system/service/hal/fake_bluetooth_gatt_interface.h b/system/service/hal/fake_bluetooth_gatt_interface.h index d6e917fb9b..eb3b9bf342 100644 --- a/system/service/hal/fake_bluetooth_gatt_interface.h +++ b/system/service/hal/fake_bluetooth_gatt_interface.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <base/observer_list.h> #include <vector> @@ -75,6 +74,11 @@ class FakeBluetoothGattInterface : public BluetoothGattInterface { std::shared_ptr<BleScannerInterface> scanner_handler, std::shared_ptr<TestClientHandler> client_handler, std::shared_ptr<TestServerHandler> server_handler); + + FakeBluetoothGattInterface(const FakeBluetoothGattInterface&) = delete; + FakeBluetoothGattInterface& operator=(const FakeBluetoothGattInterface&) = + delete; + ~FakeBluetoothGattInterface(); // The methods below can be used to notify observers with certain events and @@ -148,8 +152,6 @@ class FakeBluetoothGattInterface : public BluetoothGattInterface { std::shared_ptr<BleScannerInterface> scanner_handler_; std::shared_ptr<TestClientHandler> client_handler_; std::shared_ptr<TestServerHandler> server_handler_; - - DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattInterface); }; } // namespace hal diff --git a/system/service/hal/fake_bluetooth_interface.h b/system/service/hal/fake_bluetooth_interface.h index 9ea99b50c4..08f189a737 100644 --- a/system/service/hal/fake_bluetooth_interface.h +++ b/system/service/hal/fake_bluetooth_interface.h @@ -14,7 +14,6 @@ // limitations under the License. // -#include <base/macros.h> #include <base/observer_list.h> #include "abstract_observer_list.h" @@ -44,6 +43,9 @@ class FakeBluetoothInterface : public BluetoothInterface { static Manager* GetManager(); FakeBluetoothInterface() = default; + FakeBluetoothInterface(const FakeBluetoothInterface&) = delete; + FakeBluetoothInterface& operator=(const FakeBluetoothInterface&) = delete; + ~FakeBluetoothInterface() override = default; // Notifies the observers that the adapter state changed to |state|. @@ -70,8 +72,6 @@ class FakeBluetoothInterface : public BluetoothInterface { private: btbase::AbstractObserverList<Observer> observers_; - - DISALLOW_COPY_AND_ASSIGN(FakeBluetoothInterface); }; } // namespace hal diff --git a/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h b/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h index e18af54788..f54733cfa0 100644 --- a/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h +++ b/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h @@ -19,8 +19,6 @@ #include <map> #include <string> -#include <base/macros.h> - #include <android/bluetooth/BnBluetoothA2dpSink.h> #include <android/bluetooth/IBluetoothA2dpSinkCallback.h> @@ -40,6 +38,10 @@ class BluetoothA2dpSinkBinderServer public bluetooth::A2dpSink::Delegate { public: explicit BluetoothA2dpSinkBinderServer(bluetooth::Adapter* adapter); + BluetoothA2dpSinkBinderServer(const BluetoothA2dpSinkBinderServer&) = delete; + BluetoothA2dpSinkBinderServer& operator=( + const BluetoothA2dpSinkBinderServer&) = delete; + ~BluetoothA2dpSinkBinderServer() override = default; // IBluetoothA2dpSink implementation: @@ -78,8 +80,6 @@ class BluetoothA2dpSinkBinderServer bluetooth::BluetoothInstance* instance) override; bluetooth::Adapter* adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothA2dpSinkBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h b/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h index 160a38adc1..3800a962ec 100644 --- a/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h +++ b/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h @@ -20,8 +20,6 @@ #include <string> #include <vector> -#include <base/macros.h> - #include <android/bluetooth/BnBluetoothA2dpSource.h> #include <android/bluetooth/IBluetoothA2dpSourceCallback.h> @@ -41,6 +39,11 @@ class BluetoothA2dpSourceBinderServer public bluetooth::A2dpSource::Delegate { public: explicit BluetoothA2dpSourceBinderServer(bluetooth::Adapter* adapter); + BluetoothA2dpSourceBinderServer(const BluetoothA2dpSourceBinderServer&) = + delete; + BluetoothA2dpSourceBinderServer& operator=( + const BluetoothA2dpSourceBinderServer&) = delete; + ~BluetoothA2dpSourceBinderServer() override; bool HasInstance(); @@ -87,8 +90,6 @@ class BluetoothA2dpSourceBinderServer bluetooth::BluetoothInstance* instance) override; bluetooth::Adapter* const adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothA2dpSourceBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h b/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h index 11cf1f3d3e..00b5921b8e 100644 --- a/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h +++ b/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h @@ -19,8 +19,6 @@ #include <map> #include <string> -#include "base/macros.h" - #include "android/bluetooth/BnBluetoothAvrcpControl.h" #include "android/bluetooth/IBluetoothAvrcpControlCallback.h" @@ -40,6 +38,11 @@ class BluetoothAvrcpControlBinderServer public bluetooth::AvrcpControl::Delegate { public: explicit BluetoothAvrcpControlBinderServer(bluetooth::Adapter* adapter); + BluetoothAvrcpControlBinderServer(const BluetoothAvrcpControlBinderServer&) = + delete; + BluetoothAvrcpControlBinderServer& operator=( + const BluetoothAvrcpControlBinderServer&) = delete; + ~BluetoothAvrcpControlBinderServer() override = default; // IBluetoothAvrcpControl implementation: @@ -81,8 +84,6 @@ class BluetoothAvrcpControlBinderServer std::shared_ptr<bluetooth::AvrcpControl> GetAvrcpControl(int id); bluetooth::Adapter* adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpControlBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h b/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h index 9d2bba03c3..aeab315978 100644 --- a/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h +++ b/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h @@ -20,8 +20,6 @@ #include <string> #include <vector> -#include "base/macros.h" - #include "android/bluetooth/BnBluetoothAvrcpTarget.h" #include "android/bluetooth/IBluetoothAvrcpTargetCallback.h" @@ -41,6 +39,11 @@ class BluetoothAvrcpTargetBinderServer public bluetooth::AvrcpTarget::Delegate { public: explicit BluetoothAvrcpTargetBinderServer(bluetooth::Adapter* adapter); + BluetoothAvrcpTargetBinderServer(const BluetoothAvrcpTargetBinderServer&) = + delete; + BluetoothAvrcpTargetBinderServer& operator=( + const BluetoothAvrcpTargetBinderServer&) = delete; + ~BluetoothAvrcpTargetBinderServer() override; bool HasInstance(); @@ -123,8 +126,6 @@ class BluetoothAvrcpTargetBinderServer std::shared_ptr<bluetooth::AvrcpTarget> GetAvrcpTarget(); bluetooth::Adapter* const adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpTargetBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_binder_server.h b/system/service/ipc/binder/bluetooth_binder_server.h index 7131e8b430..a389d3f6af 100644 --- a/system/service/ipc/binder/bluetooth_binder_server.h +++ b/system/service/ipc/binder/bluetooth_binder_server.h @@ -19,7 +19,6 @@ #include <string> #include <vector> -#include <base/macros.h> #include <utils/String16.h> #include <utils/Vector.h> @@ -66,6 +65,10 @@ class BluetoothBinderServer : public BnBluetooth, public bluetooth::Adapter::Observer { public: explicit BluetoothBinderServer(bluetooth::Adapter* adapter); + + BluetoothBinderServer(const BluetoothBinderServer&) = delete; + BluetoothBinderServer& operator=(const BluetoothBinderServer&) = delete; + ~BluetoothBinderServer() override; // IBluetooth overrides: @@ -188,8 +191,6 @@ class BluetoothBinderServer : public BnBluetooth, // The IBluetoothAvrcpTarget interface handle. This is lazily initialized on // the first call to GetAvrcpTargetInterface(). android::sp<BluetoothAvrcpTargetBinderServer> avrcp_target_interface_; - - DISALLOW_COPY_AND_ASSIGN(BluetoothBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h b/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h index 65b8b60e82..28fa325545 100644 --- a/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h +++ b/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h @@ -16,8 +16,6 @@ #pragma once -#include <base/macros.h> - #include <android/bluetooth/BnBluetoothGattClient.h> #include <android/bluetooth/IBluetoothGattClientCallback.h> @@ -41,6 +39,12 @@ class BluetoothGattClientBinderServer : public BnBluetoothGattClient, public InterfaceWithInstancesBase { public: explicit BluetoothGattClientBinderServer(bluetooth::Adapter* adapter); + + BluetoothGattClientBinderServer(const BluetoothGattClientBinderServer&) = + delete; + BluetoothGattClientBinderServer& operator=( + const BluetoothGattClientBinderServer&) = delete; + ~BluetoothGattClientBinderServer() override = default; // IBluetoothGattClient overrides: @@ -67,8 +71,6 @@ class BluetoothGattClientBinderServer : public BnBluetoothGattClient, bluetooth::BluetoothInstance* instance) override; bluetooth::Adapter* adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothGattClientBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h b/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h index 925339af17..34fb7c5843 100644 --- a/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h +++ b/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h @@ -16,8 +16,6 @@ #pragma once -#include <base/macros.h> - #include <android/bluetooth/BnBluetoothGattServer.h> #include <android/bluetooth/IBluetoothGattServerCallback.h> @@ -42,6 +40,12 @@ class BluetoothGattServerBinderServer : public BnBluetoothGattServer, public bluetooth::GattServer::Delegate { public: explicit BluetoothGattServerBinderServer(bluetooth::Adapter* adapter); + + BluetoothGattServerBinderServer(const BluetoothGattServerBinderServer&) = + delete; + BluetoothGattServerBinderServer& operator=( + const BluetoothGattServerBinderServer&) = delete; + ~BluetoothGattServerBinderServer() override = default; // IBluetoothGattServer overrides: @@ -109,8 +113,6 @@ class BluetoothGattServerBinderServer : public BnBluetoothGattServer, bluetooth::BluetoothInstance* instance) override; bluetooth::Adapter* adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothGattServerBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h b/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h index 6602f5afb9..a8fca24d42 100644 --- a/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h +++ b/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h @@ -18,8 +18,6 @@ #include <memory> -#include <base/macros.h> - #include <android/bluetooth/IBluetoothLeAdvertiserCallback.h> #include "android/bluetooth/BnBluetoothLeAdvertiser.h" @@ -45,6 +43,12 @@ class BluetoothLeAdvertiserBinderServer : public BnBluetoothLeAdvertiser, public InterfaceWithInstancesBase { public: explicit BluetoothLeAdvertiserBinderServer(bluetooth::Adapter* adapter); + + BluetoothLeAdvertiserBinderServer(const BluetoothLeAdvertiserBinderServer&) = + delete; + BluetoothLeAdvertiserBinderServer& operator=( + const BluetoothLeAdvertiserBinderServer&) = delete; + ~BluetoothLeAdvertiserBinderServer() override; // IBluetoothLowEnergy overrides: @@ -77,8 +81,6 @@ class BluetoothLeAdvertiserBinderServer : public BnBluetoothLeAdvertiser, bluetooth::BluetoothInstance* instance) override; bluetooth::Adapter* adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothLeAdvertiserBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h b/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h index 0cc3ae94a6..3288a4cc93 100644 --- a/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h +++ b/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h @@ -18,8 +18,6 @@ #include <memory> -#include <base/macros.h> - #include <android/bluetooth/IBluetoothLeScannerCallback.h> #include "android/bluetooth/BnBluetoothLeScanner.h" @@ -47,6 +45,11 @@ class BluetoothLeScannerBinderServer public bluetooth::LowEnergyScanner::Delegate { public: explicit BluetoothLeScannerBinderServer(bluetooth::Adapter* adapter); + BluetoothLeScannerBinderServer(const BluetoothLeScannerBinderServer&) = + delete; + BluetoothLeScannerBinderServer& operator=( + const BluetoothLeScannerBinderServer&) = delete; + ~BluetoothLeScannerBinderServer() override; // IBluetoothLowEnergy overrides: @@ -79,8 +82,6 @@ class BluetoothLeScannerBinderServer bluetooth::BluetoothInstance* instance) override; bluetooth::Adapter* adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothLeScannerBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/bluetooth_low_energy_binder_server.h b/system/service/ipc/binder/bluetooth_low_energy_binder_server.h index 4508b3497f..0db2312fb8 100644 --- a/system/service/ipc/binder/bluetooth_low_energy_binder_server.h +++ b/system/service/ipc/binder/bluetooth_low_energy_binder_server.h @@ -18,8 +18,6 @@ #include <memory> -#include <base/macros.h> - #include <android/bluetooth/IBluetoothLowEnergyCallback.h> #include "android/bluetooth/BnBluetoothLowEnergy.h" @@ -47,6 +45,11 @@ class BluetoothLowEnergyBinderServer public bluetooth::LowEnergyClient::Delegate { public: explicit BluetoothLowEnergyBinderServer(bluetooth::Adapter* adapter); + BluetoothLowEnergyBinderServer(const BluetoothLowEnergyBinderServer&) = + delete; + BluetoothLowEnergyBinderServer& operator=( + const BluetoothLowEnergyBinderServer&) = delete; + ~BluetoothLowEnergyBinderServer() override; // IBluetoothLowEnergy overrides: @@ -83,8 +86,6 @@ class BluetoothLowEnergyBinderServer bluetooth::BluetoothInstance* instance) override; bluetooth::Adapter* adapter_; // weak - - DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyBinderServer); }; } // namespace binder diff --git a/system/service/ipc/binder/interface_with_instances_base.h b/system/service/ipc/binder/interface_with_instances_base.h index 05f2817b1f..4501b00456 100644 --- a/system/service/ipc/binder/interface_with_instances_base.h +++ b/system/service/ipc/binder/interface_with_instances_base.h @@ -19,8 +19,6 @@ #include <memory> #include <unordered_map> -#include <base/macros.h> - #include "bluetooth/uuid.h" #include "service/bluetooth_instance.h" #include "service/ipc/binder/remote_callback_map.h" @@ -40,6 +38,10 @@ class InterfaceWithInstancesBase virtual public android::RefBase { public: InterfaceWithInstancesBase() = default; + InterfaceWithInstancesBase(const InterfaceWithInstancesBase&) = delete; + InterfaceWithInstancesBase& operator=(const InterfaceWithInstancesBase&) = + delete; + ~InterfaceWithInstancesBase() override = default; protected: @@ -99,8 +101,6 @@ class InterfaceWithInstancesBase RemoteCallbackMap<int, IInterface> id_to_cb_; std::unordered_map<int, std::shared_ptr<bluetooth::BluetoothInstance>> id_to_instance_; - - DISALLOW_COPY_AND_ASSIGN(InterfaceWithInstancesBase); }; } // namespace binder diff --git a/system/service/ipc/binder/ipc_handler_binder.h b/system/service/ipc/binder/ipc_handler_binder.h index 2edd323d87..e59aef4765 100644 --- a/system/service/ipc/binder/ipc_handler_binder.h +++ b/system/service/ipc/binder/ipc_handler_binder.h @@ -16,8 +16,6 @@ #pragma once -#include <base/macros.h> - #include "service/ipc/ipc_handler.h" #include "service/ipc/ipc_manager.h" @@ -27,6 +25,10 @@ namespace ipc { class IPCHandlerBinder : public IPCHandler { public: IPCHandlerBinder(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate); + + IPCHandlerBinder(const IPCHandlerBinder&) = delete; + IPCHandlerBinder& operator=(const IPCHandlerBinder&) = delete; + ~IPCHandlerBinder() override; // IPCHandler overrides: @@ -38,8 +40,6 @@ class IPCHandlerBinder : public IPCHandler { // Notify the delegate that IPC has started. void NotifyStarted(); - - DISALLOW_COPY_AND_ASSIGN(IPCHandlerBinder); }; } // namespace ipc diff --git a/system/service/ipc/binder/remote_callback_list.h b/system/service/ipc/binder/remote_callback_list.h index e25e550593..f78bc60855 100644 --- a/system/service/ipc/binder/remote_callback_list.h +++ b/system/service/ipc/binder/remote_callback_list.h @@ -21,7 +21,6 @@ #include <unordered_map> #include <base/logging.h> -#include <base/macros.h> #include <binder/IBinder.h> #include <binder/IInterface.h> @@ -53,6 +52,9 @@ template <typename T> class RemoteCallbackList final { public: RemoteCallbackList() = default; + RemoteCallbackList(const RemoteCallbackList&) = delete; + RemoteCallbackList& operator=(const RemoteCallbackList&) = delete; + ~RemoteCallbackList(); // Register and unregister a callback interface. Registering will @@ -91,8 +93,6 @@ class RemoteCallbackList final { std::mutex map_lock_; CallbackMap callbacks_; - - DISALLOW_COPY_AND_ASSIGN(RemoteCallbackList); }; // Template Implementation details below diff --git a/system/service/ipc/binder/remote_callback_map.h b/system/service/ipc/binder/remote_callback_map.h index 7f31b5390a..96a717b7f0 100644 --- a/system/service/ipc/binder/remote_callback_map.h +++ b/system/service/ipc/binder/remote_callback_map.h @@ -20,7 +20,6 @@ #include <unordered_map> #include <base/logging.h> -#include <base/macros.h> #include <binder/IBinder.h> #include <binder/IInterface.h> @@ -38,6 +37,9 @@ template <typename K, typename V> class RemoteCallbackMap final { public: RemoteCallbackMap() = default; + RemoteCallbackMap(const RemoteCallbackMap&) = delete; + RemoteCallbackMap& operator=(const RemoteCallbackMap&) = delete; + ~RemoteCallbackMap(); // The Delegate interface is used to notify when a registered callback is @@ -104,8 +106,6 @@ class RemoteCallbackMap final { std::mutex map_lock_; CallbackMap map_; - - DISALLOW_COPY_AND_ASSIGN(RemoteCallbackMap); }; // Template Implementation details below diff --git a/system/service/ipc/dbus/ipc_handler_dbus.h b/system/service/ipc/dbus/ipc_handler_dbus.h index 2a83369cf8..4c0a7e9fea 100644 --- a/system/service/ipc/dbus/ipc_handler_dbus.h +++ b/system/service/ipc/dbus/ipc_handler_dbus.h @@ -29,6 +29,10 @@ namespace ipc { class IPCHandlerDBus : public IPCHandler { public: IPCHandlerDBus(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate); + + IPCHandlerDBus(const IPCHandlerDBus&) = delete; + IPCHandlerDBus& operator=(const IPCHandlerDBus&) = delete; + ~IPCHandlerDBus() override; void InitDbus(); @@ -41,8 +45,6 @@ class IPCHandlerDBus : public IPCHandler { base::Thread* dbus_thread_; IPCHandlerDBus() = default; - - DISALLOW_COPY_AND_ASSIGN(IPCHandlerDBus); }; } // namespace ipc diff --git a/system/service/ipc/ipc_handler.h b/system/service/ipc/ipc_handler.h index 9b7994cf37..473d6e0f31 100644 --- a/system/service/ipc/ipc_handler.h +++ b/system/service/ipc/ipc_handler.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <base/memory/ref_counted.h> #include "service/ipc/ipc_manager.h" @@ -32,6 +31,10 @@ namespace ipc { class IPCHandler : public base::RefCountedThreadSafe<IPCHandler> { public: IPCHandler(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate); + + IPCHandler(const IPCHandler&) = delete; + IPCHandler& operator=(const IPCHandler&) = delete; + virtual ~IPCHandler(); // Initializes and runs the IPC mechanism. Returns true on success, false @@ -55,8 +58,6 @@ class IPCHandler : public base::RefCountedThreadSafe<IPCHandler> { // The delegate that is interested in notifications from us. IPCManager::Delegate* delegate_; - - DISALLOW_COPY_AND_ASSIGN(IPCHandler); }; } // namespace ipc diff --git a/system/service/ipc/ipc_handler_linux.h b/system/service/ipc/ipc_handler_linux.h index 7cd6efabee..765dda2e21 100644 --- a/system/service/ipc/ipc_handler_linux.h +++ b/system/service/ipc/ipc_handler_linux.h @@ -19,7 +19,6 @@ #include <atomic> #include <base/files/file_path.h> #include <base/files/scoped_file.h> -#include <base/macros.h> #include <base/threading/thread.h> #include "service/ipc/ipc_handler.h" @@ -35,6 +34,10 @@ namespace ipc { class IPCHandlerLinux : public IPCHandler { public: IPCHandlerLinux(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate); + + IPCHandlerLinux(const IPCHandlerLinux&) = delete; + IPCHandlerLinux& operator=(const IPCHandlerLinux&) = delete; + ~IPCHandlerLinux() override; // IPCHandler overrides: @@ -81,8 +84,6 @@ class IPCHandlerLinux : public IPCHandler { // The origin thread's task runner. scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_; - - DISALLOW_COPY_AND_ASSIGN(IPCHandlerLinux); }; } // namespace ipc diff --git a/system/service/ipc/ipc_manager.h b/system/service/ipc/ipc_manager.h index ee960ba6f5..bc5a104e3b 100644 --- a/system/service/ipc/ipc_manager.h +++ b/system/service/ipc/ipc_manager.h @@ -18,7 +18,6 @@ #include <memory> -#include <base/macros.h> #include <base/memory/ref_counted.h> namespace bluetooth { @@ -47,6 +46,9 @@ class IPCManager { class Delegate { public: Delegate() = default; + Delegate(const Delegate&) = delete; + Delegate& operator=(const Delegate&) = delete; + virtual ~Delegate() = default; // Called when an IPC mechanism has successfully started and is ready for @@ -56,12 +58,12 @@ class IPCManager { // Called when an IPC mechanism has stopped. This may happen due to an error // in initialization or due to a regular shut down routine. virtual void OnIPCHandlerStopped(Type type) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(Delegate); }; explicit IPCManager(bluetooth::Adapter* adapter); + IPCManager(const IPCManager&) = delete; + IPCManager& operator=(const IPCManager&) = delete; + ~IPCManager(); // Initialize the underlying IPC handler based on |type|, if that type has not @@ -96,8 +98,6 @@ class IPCManager { // The Bluetooth adapter instance. This is owned by Daemon so we keep a raw // pointer to it. bluetooth::Adapter* adapter_; - - DISALLOW_COPY_AND_ASSIGN(IPCManager); }; } // namespace ipc diff --git a/system/service/low_energy_advertiser.h b/system/service/low_energy_advertiser.h index ec0dd748b0..46d5316965 100644 --- a/system/service/low_energy_advertiser.h +++ b/system/service/low_energy_advertiser.h @@ -21,7 +21,6 @@ #include <map> #include <mutex> -#include <base/macros.h> #include <bluetooth/uuid.h> #include "service/bluetooth_instance.h" @@ -42,6 +41,9 @@ class Adapter; // should be obtained through the factory. class LowEnergyAdvertiser : public BluetoothInstance { public: + LowEnergyAdvertiser(const LowEnergyAdvertiser&) = delete; + LowEnergyAdvertiser& operator=(const LowEnergyAdvertiser&) = delete; + // The destructor automatically unregisters this client instance from the // stack. ~LowEnergyAdvertiser() override; @@ -107,8 +109,6 @@ class LowEnergyAdvertiser : public BluetoothInstance { std::atomic_bool adv_started_; std::unique_ptr<StatusCallback> adv_start_callback_; std::unique_ptr<StatusCallback> adv_stop_callback_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiser); }; // LowEnergyAdvertiserFactory is used to register and obtain a per-application @@ -121,6 +121,10 @@ class LowEnergyAdvertiserFactory : public BluetoothInstanceFactory { // Don't construct/destruct directly except in tests. Instead, obtain a handle // from an Adapter instance. explicit LowEnergyAdvertiserFactory(); + LowEnergyAdvertiserFactory(const LowEnergyAdvertiserFactory&) = delete; + LowEnergyAdvertiserFactory& operator=(const LowEnergyAdvertiserFactory&) = + delete; + ~LowEnergyAdvertiserFactory() override; // BluetoothInstanceFactory override: @@ -138,8 +142,6 @@ class LowEnergyAdvertiserFactory : public BluetoothInstanceFactory { // Map of pending calls to register. std::mutex pending_calls_lock_; std::unordered_set<Uuid> pending_calls_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiserFactory); }; } // namespace bluetooth diff --git a/system/service/low_energy_client.h b/system/service/low_energy_client.h index a4b60c61e0..ba39357fe7 100644 --- a/system/service/low_energy_client.h +++ b/system/service/low_energy_client.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <bluetooth/uuid.h> #include <atomic> @@ -53,6 +52,9 @@ class LowEnergyClient : private hal::BluetoothGattInterface::ClientObserver, class Delegate { public: Delegate() = default; + Delegate(const Delegate&) = delete; + Delegate& operator=(const Delegate&) = delete; + virtual ~Delegate() = default; // Called asynchronously to notify the delegate of connection state change @@ -62,11 +64,11 @@ class LowEnergyClient : private hal::BluetoothGattInterface::ClientObserver, // Called asynchronously to notify the delegate of mtu change virtual void OnMtuChanged(LowEnergyClient* client, int status, const char* address, int mtu) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(Delegate); }; + LowEnergyClient(const LowEnergyClient&) = delete; + LowEnergyClient& operator=(const LowEnergyClient&) = delete; + // The destructor automatically unregisters this client instance from the // stack. ~LowEnergyClient() override; @@ -134,8 +136,6 @@ class LowEnergyClient : private hal::BluetoothGattInterface::ClientObserver, // Maps bluetooth address to connection id // TODO(jpawlowski): change type to bimap std::map<const RawAddress, int, ConnComparator> connection_ids_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyClient); }; // LowEnergyClientFactory is used to register and obtain a per-application @@ -149,6 +149,9 @@ class LowEnergyClientFactory // Don't construct/destruct directly except in tests. Instead, obtain a handle // from an Adapter instance. explicit LowEnergyClientFactory(Adapter& adapter); + LowEnergyClientFactory(const LowEnergyClientFactory&) = delete; + LowEnergyClientFactory& operator=(const LowEnergyClientFactory&) = delete; + ~LowEnergyClientFactory() override; // BluetoothInstanceFactory override: @@ -169,8 +172,6 @@ class LowEnergyClientFactory // Raw pointer to the Adapter that owns this factory. Adapter& adapter_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyClientFactory); }; } // namespace bluetooth diff --git a/system/service/low_energy_scanner.h b/system/service/low_energy_scanner.h index 6325c41cf2..627f287f83 100644 --- a/system/service/low_energy_scanner.h +++ b/system/service/low_energy_scanner.h @@ -16,7 +16,6 @@ #pragma once -#include <base/macros.h> #include <bluetooth/uuid.h> #include <atomic> @@ -49,17 +48,20 @@ class LowEnergyScanner : private hal::BluetoothGattInterface::ScannerObserver, class Delegate { public: Delegate() = default; + Delegate(const Delegate&) = delete; + Delegate& operator=(const Delegate&) = delete; + virtual ~Delegate() = default; // Called asynchronously to notify the delegate of nearby BLE advertisers // found during a device scan. virtual void OnScanResult(LowEnergyScanner* client, const ScanResult& scan_result) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(Delegate); }; + LowEnergyScanner(const LowEnergyScanner&) = delete; + LowEnergyScanner& operator=(const LowEnergyScanner&) = delete; + // The destructor automatically unregisters this client instance from the // stack. ~LowEnergyScanner() override; @@ -120,8 +122,6 @@ class LowEnergyScanner : private hal::BluetoothGattInterface::ScannerObserver, // instance. std::mutex delegate_mutex_; Delegate* delegate_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyScanner); }; // LowEnergyScannerFactory is used to register and obtain a per-application @@ -135,6 +135,9 @@ class LowEnergyScannerFactory // Don't construct/destruct directly except in tests. Instead, obtain a handle // from an Adapter instance. explicit LowEnergyScannerFactory(Adapter& adapter); + LowEnergyScannerFactory(const LowEnergyScannerFactory&) = delete; + LowEnergyScannerFactory& operator=(const LowEnergyScannerFactory&) = delete; + ~LowEnergyScannerFactory() override; // BluetoothInstanceFactory override: @@ -155,8 +158,6 @@ class LowEnergyScannerFactory // Raw pointer to the Adapter that owns this factory. Adapter& adapter_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyScannerFactory); }; } // namespace bluetooth diff --git a/system/service/settings.h b/system/service/settings.h index 1f298d6c0e..38e5ca98b2 100644 --- a/system/service/settings.h +++ b/system/service/settings.h @@ -19,7 +19,6 @@ #include <string> #include <base/files/file_path.h> -#include <base/macros.h> namespace bluetooth { @@ -32,6 +31,9 @@ class Settings { static const char kHelp[]; Settings(); + Settings(const Settings&) = delete; + Settings& operator=(const Settings&) = delete; + ~Settings(); // TODO(armansito): Write an instance method for storing things into a file. @@ -67,8 +69,6 @@ class Settings { bool enable_on_start_; std::string android_ipc_socket_suffix_; base::FilePath create_ipc_socket_path_; - - DISALLOW_COPY_AND_ASSIGN(Settings); }; } // namespace bluetooth diff --git a/system/service/test/a2dp_sink_unittest.cc b/system/service/test/a2dp_sink_unittest.cc index f51e11292d..69545c29c8 100644 --- a/system/service/test/a2dp_sink_unittest.cc +++ b/system/service/test/a2dp_sink_unittest.cc @@ -32,15 +32,15 @@ class MockA2dpSinkHandler : public hal::FakeBluetoothAvInterface::TestA2dpSinkHandler { public: MockA2dpSinkHandler() = default; + MockA2dpSinkHandler(const MockA2dpSinkHandler&) = delete; + MockA2dpSinkHandler& operator=(const MockA2dpSinkHandler&) = delete; + ~MockA2dpSinkHandler() override = default; MOCK_METHOD1(Connect, bt_status_t(RawAddress)); MOCK_METHOD1(Disconnect, bt_status_t(RawAddress)); MOCK_METHOD1(SetAudioFocusState, void(int)); MOCK_METHOD1(SetAudioTrackGain, void(float)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockA2dpSinkHandler); }; class TestDelegate : public A2dpSink::Delegate { @@ -89,6 +89,9 @@ class TestDelegate : public A2dpSink::Delegate { class A2dpSinkTest : public ::testing::Test { public: A2dpSinkTest() = default; + A2dpSinkTest(const A2dpSinkTest&) = delete; + A2dpSinkTest& operator=(const A2dpSinkTest&) = delete; + ~A2dpSinkTest() override = default; void SetUp() override { @@ -107,14 +110,14 @@ class A2dpSinkTest : public ::testing::Test { hal::FakeBluetoothAvInterface* fake_hal_av_iface_; std::shared_ptr<MockA2dpSinkHandler> mock_handler_; std::unique_ptr<A2dpSinkFactory> factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(A2dpSinkTest); }; class A2dpSinkPostRegisterTest : public A2dpSinkTest { public: A2dpSinkPostRegisterTest() = default; + A2dpSinkPostRegisterTest(const A2dpSinkPostRegisterTest&) = delete; + A2dpSinkPostRegisterTest& operator=(const A2dpSinkPostRegisterTest&) = delete; + ~A2dpSinkPostRegisterTest() override = default; void SetUp() override { @@ -160,9 +163,6 @@ class A2dpSinkPostRegisterTest : public A2dpSinkTest { } std::unique_ptr<A2dpSink> a2dp_sink_; - - private: - DISALLOW_COPY_AND_ASSIGN(A2dpSinkPostRegisterTest); }; TEST_F(A2dpSinkTest, RegisterA2dpSink) { diff --git a/system/service/test/a2dp_source_unittest.cc b/system/service/test/a2dp_source_unittest.cc index 5aede818fb..b29172754c 100644 --- a/system/service/test/a2dp_source_unittest.cc +++ b/system/service/test/a2dp_source_unittest.cc @@ -32,13 +32,13 @@ class MockA2dpSourceHandler : public hal::FakeBluetoothAvInterface::TestA2dpSourceHandler { public: MockA2dpSourceHandler() = default; + MockA2dpSourceHandler(const MockA2dpSourceHandler&) = delete; + MockA2dpSourceHandler& operator=(const MockA2dpSourceHandler&) = delete; + ~MockA2dpSourceHandler() override = default; MOCK_METHOD1(Connect, bt_status_t(RawAddress)); MOCK_METHOD1(Disconnect, bt_status_t(RawAddress)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockA2dpSourceHandler); }; class TestDelegate : public A2dpSource::Delegate { @@ -86,6 +86,9 @@ class TestDelegate : public A2dpSource::Delegate { class A2dpSourceTest : public ::testing::Test { public: A2dpSourceTest() = default; + A2dpSourceTest(const A2dpSourceTest&) = delete; + A2dpSourceTest& operator=(const A2dpSourceTest&) = delete; + ~A2dpSourceTest() override = default; void SetUp() override { @@ -104,14 +107,15 @@ class A2dpSourceTest : public ::testing::Test { hal::FakeBluetoothAvInterface* fake_hal_av_iface_; std::shared_ptr<MockA2dpSourceHandler> mock_handler_; std::unique_ptr<A2dpSourceFactory> factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(A2dpSourceTest); }; class A2dpSourcePostRegisterTest : public A2dpSourceTest { public: A2dpSourcePostRegisterTest() = default; + A2dpSourcePostRegisterTest(const A2dpSourcePostRegisterTest&) = delete; + A2dpSourcePostRegisterTest& operator=(const A2dpSourcePostRegisterTest&) = + delete; + ~A2dpSourcePostRegisterTest() override = default; void SetUp() override { @@ -157,9 +161,6 @@ class A2dpSourcePostRegisterTest : public A2dpSourceTest { } std::unique_ptr<A2dpSource> a2dp_source_; - - private: - DISALLOW_COPY_AND_ASSIGN(A2dpSourcePostRegisterTest); }; TEST_F(A2dpSourceTest, RegisterA2dpSource) { diff --git a/system/service/test/adapter_unittest.cc b/system/service/test/adapter_unittest.cc index 37b0abbeb5..6c736097dc 100644 --- a/system/service/test/adapter_unittest.cc +++ b/system/service/test/adapter_unittest.cc @@ -16,7 +16,6 @@ #include "service/adapter.h" -#include <base/macros.h> #include <gtest/gtest.h> #include "service/hal/fake_bluetooth_gatt_interface.h" @@ -30,6 +29,9 @@ namespace { class AdapterTest : public ::testing::Test { public: AdapterTest() = default; + AdapterTest(const AdapterTest&) = delete; + AdapterTest& operator=(const AdapterTest&) = delete; + ~AdapterTest() override = default; void SetUp() override { @@ -55,9 +57,6 @@ class AdapterTest : public ::testing::Test { hal::FakeBluetoothInterface* fake_hal_iface_; hal::FakeBluetoothInterface::Manager* fake_hal_manager_; std::unique_ptr<Adapter> adapter_; - - private: - DISALLOW_COPY_AND_ASSIGN(AdapterTest); }; class TestObserver final : public bluetooth::Adapter::Observer { @@ -71,6 +70,9 @@ class TestObserver final : public bluetooth::Adapter::Observer { adapter_->AddObserver(this); } + TestObserver(const TestObserver&) = delete; + TestObserver& operator=(const TestObserver&) = delete; + ~TestObserver() override { adapter_->RemoveObserver(this); } bluetooth::AdapterState prev_state() const { return prev_state_; } @@ -106,8 +108,6 @@ class TestObserver final : public bluetooth::Adapter::Observer { bluetooth::AdapterState prev_state_, cur_state_; std::string last_connection_state_address_; bool last_device_connected_state_; - - DISALLOW_COPY_AND_ASSIGN(TestObserver); }; TEST_F(AdapterTest, IsEnabled) { diff --git a/system/service/test/gatt_client_unittest.cc b/system/service/test/gatt_client_unittest.cc index 71850cdea9..c7c02091a8 100644 --- a/system/service/test/gatt_client_unittest.cc +++ b/system/service/test/gatt_client_unittest.cc @@ -16,7 +16,6 @@ #include "service/gatt_client.h" -#include <base/macros.h> #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -33,6 +32,9 @@ class MockGattHandler : public hal::FakeBluetoothGattInterface::TestClientHandler { public: MockGattHandler() = default; + MockGattHandler(const MockGattHandler&) = delete; + MockGattHandler& operator=(const MockGattHandler&) = delete; + ~MockGattHandler() override = default; MOCK_METHOD2(RegisterClient, @@ -41,14 +43,14 @@ class MockGattHandler MOCK_METHOD1(Scan, bt_status_t(bool)); MOCK_METHOD4(Connect, bt_status_t(int, const RawAddress&, bool, int)); MOCK_METHOD3(Disconnect, bt_status_t(int, const RawAddress&, int)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockGattHandler); }; class GattClientTest : public ::testing::Test { public: GattClientTest() = default; + GattClientTest(const GattClientTest&) = delete; + GattClientTest& operator=(const GattClientTest&) = delete; + ~GattClientTest() override = default; void SetUp() override { @@ -74,9 +76,6 @@ class GattClientTest : public ::testing::Test { hal::FakeBluetoothGattInterface* fake_hal_gatt_iface_; std::shared_ptr<MockGattHandler> mock_handler_; std::unique_ptr<GattClientFactory> factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(GattClientTest); }; TEST_F(GattClientTest, RegisterInstance) { diff --git a/system/service/test/gatt_server_unittest.cc b/system/service/test/gatt_server_unittest.cc index 467100c170..f0e6f98d33 100644 --- a/system/service/test/gatt_server_unittest.cc +++ b/system/service/test/gatt_server_unittest.cc @@ -32,6 +32,9 @@ class MockGattHandler : public hal::FakeBluetoothGattInterface::TestServerHandler { public: MockGattHandler() = default; + MockGattHandler(const MockGattHandler&) = delete; + MockGattHandler& operator=(const MockGattHandler&) = delete; + ~MockGattHandler() override = default; MOCK_METHOD2(RegisterServer, @@ -47,9 +50,6 @@ class MockGattHandler bt_status_t(int, int, int, int, std::vector<uint8_t>)); MOCK_METHOD4(SendResponse, bt_status_t(int, int, int, const btgatt_response_t&)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockGattHandler); }; class TestDelegate : public GattServer::Delegate { @@ -179,6 +179,9 @@ class TestDelegate : public GattServer::Delegate { class GattServerTest : public ::testing::Test { public: GattServerTest() = default; + GattServerTest(const GattServerTest&) = delete; + GattServerTest& operator=(const GattServerTest&) = delete; + ~GattServerTest() override = default; void SetUp() override { @@ -201,9 +204,6 @@ class GattServerTest : public ::testing::Test { hal::FakeBluetoothGattInterface* fake_hal_gatt_iface_; std::shared_ptr<MockGattHandler> mock_handler_; std::unique_ptr<GattServerFactory> factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(GattServerTest); }; const int kDefaultServerId = 4; @@ -211,6 +211,10 @@ const int kDefaultServerId = 4; class GattServerPostRegisterTest : public GattServerTest { public: GattServerPostRegisterTest() = default; + GattServerPostRegisterTest(const GattServerPostRegisterTest&) = delete; + GattServerPostRegisterTest& operator=(const GattServerPostRegisterTest&) = + delete; + ~GattServerPostRegisterTest() override = default; void SetUp() override { @@ -295,9 +299,6 @@ class GattServerPostRegisterTest : public GattServerTest { uint16_t srvc_handle_; uint16_t char_handle_; uint16_t desc_handle_; - - private: - DISALLOW_COPY_AND_ASSIGN(GattServerPostRegisterTest); }; TEST_F(GattServerTest, RegisterServer) { diff --git a/system/service/test/ipc_linux_unittest.cc b/system/service/test/ipc_linux_unittest.cc index 176cd6a320..0c3ab31b7d 100644 --- a/system/service/test/ipc_linux_unittest.cc +++ b/system/service/test/ipc_linux_unittest.cc @@ -22,7 +22,6 @@ #include <base/at_exit.h> #include <base/command_line.h> #include <base/files/scoped_file.h> -#include <base/macros.h> #include <base/run_loop.h> #include <base/strings/stringprintf.h> #include <gtest/gtest.h> @@ -45,6 +44,9 @@ const char kTestSocketPath[] = "test_socket_path"; class IPCLinuxTest : public ::testing::Test { public: IPCLinuxTest() = default; + IPCLinuxTest(const IPCLinuxTest&) = delete; + IPCLinuxTest& operator=(const IPCLinuxTest&) = delete; + ~IPCLinuxTest() override = default; void SetUp() override { @@ -109,13 +111,14 @@ class IPCLinuxTest : public ::testing::Test { std::unique_ptr<bluetooth::Adapter> adapter_; std::unique_ptr<ipc::IPCManager> ipc_manager_; base::ScopedFD client_fd_; - - DISALLOW_COPY_AND_ASSIGN(IPCLinuxTest); }; class IPCLinuxTestDisabled : public IPCLinuxTest { public: IPCLinuxTestDisabled() = default; + IPCLinuxTestDisabled(const IPCLinuxTestDisabled&) = delete; + IPCLinuxTestDisabled& operator=(const IPCLinuxTestDisabled&) = delete; + ~IPCLinuxTestDisabled() override = default; void SetUpCommandLine() override { @@ -123,9 +126,6 @@ class IPCLinuxTestDisabled : public IPCLinuxTest { const base::CommandLine::CharType* argv[] = {"program"}; base::CommandLine::Init(ARRAY_SIZE(argv), argv); } - - private: - DISALLOW_COPY_AND_ASSIGN(IPCLinuxTestDisabled); }; class TestDelegate : public ipc::IPCManager::Delegate, @@ -133,6 +133,9 @@ class TestDelegate : public ipc::IPCManager::Delegate, public: TestDelegate() : started_count_(0), stopped_count_(0) {} + TestDelegate(const TestDelegate&) = delete; + TestDelegate& operator=(const TestDelegate&) = delete; + void OnIPCHandlerStarted(ipc::IPCManager::Type type) override { ASSERT_EQ(ipc::IPCManager::TYPE_LINUX, type); started_count_++; @@ -151,8 +154,6 @@ class TestDelegate : public ipc::IPCManager::Delegate, private: int started_count_; int stopped_count_; - - DISALLOW_COPY_AND_ASSIGN(TestDelegate); }; TEST_F(IPCLinuxTestDisabled, StartWithNoSocketPath) { diff --git a/system/service/test/low_energy_advertiser_unittest.cc b/system/service/test/low_energy_advertiser_unittest.cc index 751eb2b596..aa6c07cc78 100644 --- a/system/service/test/low_energy_advertiser_unittest.cc +++ b/system/service/test/low_energy_advertiser_unittest.cc @@ -14,7 +14,6 @@ // limitations under the License. // -#include <base/macros.h> #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -43,6 +42,9 @@ namespace { class MockAdvertiserHandler : public BleAdvertiserInterface { public: MockAdvertiserHandler() {} + MockAdvertiserHandler(const MockAdvertiserHandler&) = delete; + MockAdvertiserHandler& operator=(const MockAdvertiserHandler&) = delete; + ~MockAdvertiserHandler() override = default; MOCK_METHOD1(RegisterAdvertiser, void(IdStatusCallback)); @@ -71,14 +73,14 @@ class MockAdvertiserHandler : public BleAdvertiserInterface { void(int, std::vector<uint8_t>, StatusCallback)); MOCK_METHOD3(SetPeriodicAdvertisingEnable, void(int, bool, StatusCallback)); MOCK_METHOD1(RegisterCallbacks, void(AdvertisingCallbacks* callbacks)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockAdvertiserHandler); }; class LowEnergyAdvertiserTest : public ::testing::Test { public: LowEnergyAdvertiserTest() = default; + LowEnergyAdvertiserTest(const LowEnergyAdvertiserTest&) = delete; + LowEnergyAdvertiserTest& operator=(const LowEnergyAdvertiserTest&) = delete; + ~LowEnergyAdvertiserTest() override = default; void SetUp() override { @@ -99,15 +101,17 @@ class LowEnergyAdvertiserTest : public ::testing::Test { protected: std::shared_ptr<MockAdvertiserHandler> mock_handler_; std::unique_ptr<LowEnergyAdvertiserFactory> ble_advertiser_factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiserTest); }; // Used for tests that operate on a pre-registered advertiser. class LowEnergyAdvertiserPostRegisterTest : public LowEnergyAdvertiserTest { public: LowEnergyAdvertiserPostRegisterTest() : next_client_id_(0) {} + LowEnergyAdvertiserPostRegisterTest( + const LowEnergyAdvertiserPostRegisterTest&) = delete; + LowEnergyAdvertiserPostRegisterTest& operator=( + const LowEnergyAdvertiserPostRegisterTest&) = delete; + ~LowEnergyAdvertiserPostRegisterTest() override = default; void SetUp() override { @@ -201,8 +205,6 @@ class LowEnergyAdvertiserPostRegisterTest : public LowEnergyAdvertiserTest { private: int next_client_id_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiserPostRegisterTest); }; TEST_F(LowEnergyAdvertiserTest, RegisterInstance) { diff --git a/system/service/test/low_energy_client_unittest.cc b/system/service/test/low_energy_client_unittest.cc index 389d758237..f2669ba085 100644 --- a/system/service/test/low_energy_client_unittest.cc +++ b/system/service/test/low_energy_client_unittest.cc @@ -16,7 +16,6 @@ #include "service/low_energy_client.h" -#include <base/macros.h> #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -40,6 +39,9 @@ class MockGattHandler : public hal::FakeBluetoothGattInterface::TestClientHandler { public: MockGattHandler(){}; + MockGattHandler(const MockGattHandler&) = delete; + MockGattHandler& operator=(const MockGattHandler&) = delete; + ~MockGattHandler() override = default; MOCK_METHOD2(RegisterClient, @@ -47,15 +49,15 @@ class MockGattHandler MOCK_METHOD1(UnregisterClient, bt_status_t(int)); MOCK_METHOD4(Connect, bt_status_t(int, const RawAddress&, bool, int)); MOCK_METHOD3(Disconnect, bt_status_t(int, const RawAddress&, int)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockGattHandler); }; class TestDelegate : public LowEnergyClient::Delegate { public: TestDelegate() : connection_state_count_(0), last_mtu_(0) {} + TestDelegate(const TestDelegate&) = delete; + TestDelegate& operator=(const TestDelegate&) = delete; + ~TestDelegate() override = default; int connection_state_count() const { return connection_state_count_; } @@ -76,13 +78,14 @@ class TestDelegate : public LowEnergyClient::Delegate { int connection_state_count_; int last_mtu_; - - DISALLOW_COPY_AND_ASSIGN(TestDelegate); }; class LowEnergyClientTest : public ::testing::Test { public: LowEnergyClientTest() = default; + LowEnergyClientTest(const LowEnergyClientTest&) = delete; + LowEnergyClientTest& operator=(const LowEnergyClientTest&) = delete; + ~LowEnergyClientTest() override = default; void SetUp() override { @@ -107,15 +110,18 @@ class LowEnergyClientTest : public ::testing::Test { testing::MockAdapter mock_adapter_; std::shared_ptr<MockGattHandler> mock_handler_; std::unique_ptr<LowEnergyClientFactory> ble_factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(LowEnergyClientTest); }; // Used for tests that operate on a pre-registered client. class LowEnergyClientPostRegisterTest : public LowEnergyClientTest { public: LowEnergyClientPostRegisterTest() : next_client_id_(0) {} + + LowEnergyClientPostRegisterTest(const LowEnergyClientPostRegisterTest&) = + delete; + LowEnergyClientPostRegisterTest& operator=( + const LowEnergyClientPostRegisterTest&) = delete; + ~LowEnergyClientPostRegisterTest() override = default; void SetUp() override { @@ -164,8 +170,6 @@ class LowEnergyClientPostRegisterTest : public LowEnergyClientTest { private: int next_client_id_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyClientPostRegisterTest); }; TEST_F(LowEnergyClientTest, RegisterInstance) { diff --git a/system/service/test/low_energy_scanner_unittest.cc b/system/service/test/low_energy_scanner_unittest.cc index 4c59925e44..7d9a3b21cc 100644 --- a/system/service/test/low_energy_scanner_unittest.cc +++ b/system/service/test/low_energy_scanner_unittest.cc @@ -16,7 +16,6 @@ #include "service/low_energy_scanner.h" -#include <base/macros.h> #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -103,6 +102,9 @@ class TestDelegate : public LowEnergyScanner::Delegate { public: TestDelegate() : scan_result_count_(0) {} + TestDelegate(const TestDelegate&) = delete; + TestDelegate& operator=(const TestDelegate&) = delete; + ~TestDelegate() override = default; int scan_result_count() const { return scan_result_count_; } @@ -118,13 +120,14 @@ class TestDelegate : public LowEnergyScanner::Delegate { private: int scan_result_count_; ScanResult last_scan_result_; - - DISALLOW_COPY_AND_ASSIGN(TestDelegate); }; class LowEnergyScannerTest : public ::testing::Test { public: LowEnergyScannerTest() = default; + LowEnergyScannerTest(const LowEnergyScannerTest&) = delete; + LowEnergyScannerTest& operator=(const LowEnergyScannerTest&) = delete; + ~LowEnergyScannerTest() override = default; void SetUp() override { @@ -147,15 +150,18 @@ class LowEnergyScannerTest : public ::testing::Test { testing::MockAdapter mock_adapter_; std::shared_ptr<MockScannerHandler> mock_handler_; std::unique_ptr<LowEnergyScannerFactory> ble_factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(LowEnergyScannerTest); }; // Used for tests that operate on a pre-registered scanner. class LowEnergyScannerPostRegisterTest : public LowEnergyScannerTest { public: LowEnergyScannerPostRegisterTest() : next_scanner_id_(0) {} + + LowEnergyScannerPostRegisterTest(const LowEnergyScannerPostRegisterTest&) = + delete; + LowEnergyScannerPostRegisterTest& operator=( + const LowEnergyScannerPostRegisterTest&) = delete; + ~LowEnergyScannerPostRegisterTest() override = default; void SetUp() override { @@ -203,8 +209,6 @@ class LowEnergyScannerPostRegisterTest : public LowEnergyScannerTest { private: int next_scanner_id_; - - DISALLOW_COPY_AND_ASSIGN(LowEnergyScannerPostRegisterTest); }; TEST_F(LowEnergyScannerTest, RegisterInstance) { diff --git a/system/service/test/mock_adapter.h b/system/service/test/mock_adapter.h index b652026858..4042f6a975 100644 --- a/system/service/test/mock_adapter.h +++ b/system/service/test/mock_adapter.h @@ -26,6 +26,9 @@ namespace testing { class MockAdapter : public Adapter { public: MockAdapter() = default; + MockAdapter(const MockAdapter&) = delete; + MockAdapter& operator=(const MockAdapter&) = delete; + ~MockAdapter() override = default; MOCK_METHOD1(AddObserver, void(Observer*)); @@ -60,9 +63,6 @@ class MockAdapter : public Adapter { MOCK_CONST_METHOD0(GetLeScannerFactory, LowEnergyScannerFactory*()); MOCK_CONST_METHOD0(GetGattClientFactory, GattClientFactory*()); MOCK_CONST_METHOD0(GetGattServerFactory, GattServerFactory*()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockAdapter); }; } // namespace testing diff --git a/system/service/test/mock_daemon.h b/system/service/test/mock_daemon.h index 1c026221d2..410b962b52 100644 --- a/system/service/test/mock_daemon.h +++ b/system/service/test/mock_daemon.h @@ -27,15 +27,15 @@ namespace testing { class MockDaemon : public Daemon { public: MockDaemon() = default; + MockDaemon(const MockDaemon&) = delete; + MockDaemon& operator=(const MockDaemon&) = delete; + ~MockDaemon() override = default; MOCK_CONST_METHOD0(GetSettings, Settings*()); MOCK_CONST_METHOD0(GetMessageLoop, btbase::AbstractMessageLoop*()); MOCK_METHOD0(StartMainLoop, void()); MOCK_METHOD0(Init, bool()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockDaemon); }; } // namespace testing diff --git a/system/service/test/settings_unittest.cc b/system/service/test/settings_unittest.cc index 60d372e375..31baaaaad8 100644 --- a/system/service/test/settings_unittest.cc +++ b/system/service/test/settings_unittest.cc @@ -16,7 +16,6 @@ #include <base/at_exit.h> #include <base/command_line.h> -#include <base/macros.h> #include <gtest/gtest.h> #include "array_utils.h" @@ -31,6 +30,8 @@ namespace { class SettingsTest : public ::testing::Test { public: SettingsTest() = default; + SettingsTest(const SettingsTest&) = delete; + SettingsTest& operator=(const SettingsTest&) = delete; void SetUp() override { base::CommandLine::Reset(); } @@ -39,9 +40,6 @@ class SettingsTest : public ::testing::Test { protected: base::AtExitManager exit_manager_; Settings settings_; - - private: - DISALLOW_COPY_AND_ASSIGN(SettingsTest); }; TEST_F(SettingsTest, EmptyCommandLine) { diff --git a/system/stack/eatt/eatt.h b/system/stack/eatt/eatt.h index d2071ab7a1..2eac63118d 100644 --- a/system/stack/eatt/eatt.h +++ b/system/stack/eatt/eatt.h @@ -99,6 +99,9 @@ class EattChannel { class EattExtension { public: EattExtension(); + EattExtension(const EattExtension&) = delete; + EattExtension& operator=(const EattExtension&) = delete; + virtual ~EattExtension(); static EattExtension* GetInstance() { @@ -277,8 +280,6 @@ class EattExtension { private: struct impl; std::unique_ptr<impl> pimpl_; - - DISALLOW_COPY_AND_ASSIGN(EattExtension); }; } // namespace eatt diff --git a/system/stack/test/ble_advertiser_test.cc b/system/stack/test/ble_advertiser_test.cc index b4a8b851b0..35855168f8 100644 --- a/system/stack/test/ble_advertiser_test.cc +++ b/system/stack/test/ble_advertiser_test.cc @@ -89,6 +89,9 @@ constexpr uint8_t COMPLETE = 0x03; // Complete extended advertising data class AdvertiserHciMock : public BleAdvertiserHciInterface { public: AdvertiserHciMock() = default; + AdvertiserHciMock(const AdvertiserHciMock&) = delete; + AdvertiserHciMock& operator=(const AdvertiserHciMock&) = delete; + ~AdvertiserHciMock() override = default; MOCK_METHOD1(ReadInstanceCount, @@ -133,9 +136,6 @@ class AdvertiserHciMock : public BleAdvertiserHciInterface { }; bool QuirkAdvertiserZeroHandle() override { return false; } - - private: - DISALLOW_COPY_AND_ASSIGN(AdvertiserHciMock); }; } // namespace diff --git a/system/stack/test/btm_iso_test.cc b/system/stack/test/btm_iso_test.cc index 94e77fceba..98c2ca28c0 100644 --- a/system/stack/test/btm_iso_test.cc +++ b/system/stack/test/btm_iso_test.cc @@ -69,6 +69,9 @@ namespace { class MockCigCallbacks : public bluetooth::hci::iso_manager::CigCallbacks { public: MockCigCallbacks() = default; + MockCigCallbacks(const MockCigCallbacks&) = delete; + MockCigCallbacks& operator=(const MockCigCallbacks&) = delete; + ~MockCigCallbacks() override = default; MOCK_METHOD((void), OnSetupIsoDataPath, @@ -86,14 +89,14 @@ class MockCigCallbacks : public bluetooth::hci::iso_manager::CigCallbacks { MOCK_METHOD((void), OnCisEvent, (uint8_t event, void* data), (override)); MOCK_METHOD((void), OnCigEvent, (uint8_t event, void* data), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockCigCallbacks); }; class MockBigCallbacks : public bluetooth::hci::iso_manager::BigCallbacks { public: MockBigCallbacks() = default; + MockBigCallbacks(const MockBigCallbacks&) = delete; + MockBigCallbacks& operator=(const MockBigCallbacks&) = delete; + ~MockBigCallbacks() override = default; MOCK_METHOD((void), OnSetupIsoDataPath, @@ -104,9 +107,6 @@ class MockBigCallbacks : public bluetooth::hci::iso_manager::BigCallbacks { (override)); MOCK_METHOD((void), OnBigEvent, (uint8_t event, void* data), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockBigCallbacks); }; } // namespace diff --git a/system/stack/test/common/mock_eatt.h b/system/stack/test/common/mock_eatt.h index 8b5d9d58ca..a7b6c5f867 100644 --- a/system/stack/test/common/mock_eatt.h +++ b/system/stack/test/common/mock_eatt.h @@ -27,6 +27,9 @@ using bluetooth::eatt::EattExtension; class MockEattExtension : public EattExtension { public: MockEattExtension() = default; + MockEattExtension(const MockEattExtension&) = delete; + MockEattExtension& operator=(const MockEattExtension&) = delete; + ~MockEattExtension() override = default; static MockEattExtension* GetInstance(); @@ -65,7 +68,4 @@ class MockEattExtension : public EattExtension { MOCK_METHOD((void), Start, ()); MOCK_METHOD((void), Stop, ()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockEattExtension); }; diff --git a/system/test/suite/adapter/bluetooth_test.h b/system/test/suite/adapter/bluetooth_test.h index 44f52c80da..6b50be9f95 100644 --- a/system/test/suite/adapter/bluetooth_test.h +++ b/system/test/suite/adapter/bluetooth_test.h @@ -41,6 +41,9 @@ class BluetoothTest : public ::testing::Test, public bluetooth::hal::BluetoothInterface::Observer { protected: BluetoothTest() = default; + BluetoothTest(const BluetoothTest&) = delete; + BluetoothTest& operator=(const BluetoothTest&) = delete; + virtual ~BluetoothTest() = default; // Getter for the bt_interface @@ -115,8 +118,6 @@ class BluetoothTest : public ::testing::Test, bt_discovery_state_t discovery_state_; bt_acl_state_t acl_state_; bt_bond_state_t bond_state_; - - DISALLOW_COPY_AND_ASSIGN(BluetoothTest); }; } // bttest diff --git a/system/test/suite/gatt/gatt_test.h b/system/test/suite/gatt/gatt_test.h index 1fcea738bd..da0d6d218c 100644 --- a/system/test/suite/gatt/gatt_test.h +++ b/system/test/suite/gatt/gatt_test.h @@ -31,6 +31,9 @@ class GattTest : public BluetoothTest, public bluetooth::hal::BluetoothGattInterface::ServerObserver { protected: GattTest() = default; + GattTest(const GattTest&) = delete; + GattTest& operator=(const GattTest&) = delete; + virtual ~GattTest() = default; // Gets the gatt_scanner_interface @@ -125,8 +128,6 @@ class GattTest : public BluetoothTest, // The status of the last callback. Is BT_STATUS_SUCCESS if no issues. int status_; - - DISALLOW_COPY_AND_ASSIGN(GattTest); }; } // bttest |