From 75bc80b132e729e7180b246485a6da13147472d5 Mon Sep 17 00:00:00 2001 From: tangfan <1824525929@qq.com> Date: Mon, 21 Mar 2022 21:05:21 +0800 Subject: [PATCH 1/2] fix code style Signed-off-by: tangfan <1824525929@qq.com> --- common/log/include/distributed_hardware_log.h | 6 ++-- common/utils/include/constants.h | 6 ++-- common/utils/include/device_type.h | 6 ++-- .../include/distributed_hardware_errno.h | 4 +-- common/utils/include/idistributed_hardware.h | 6 ++-- .../include/idistributed_hardware_manager.h | 6 ++-- .../include/idistributed_hardware_sink.h | 6 ++-- .../include/idistributed_hardware_source.h | 6 ++-- common/utils/include/ihardware_handler.h | 6 ++-- common/utils/include/single_instance.h | 6 ++-- .../include/accessmanager/access_manager.h | 4 +-- .../distributed_hardware_manager_factory.h | 6 ++-- .../include/distributed_hardware_service.h | 6 ++-- .../include/distributed_hardware_stub.h | 4 +-- .../src/accessmanager/access_manager.cpp | 10 +++++-- .../distributed_hardware_manager_factory.cpp | 4 +-- .../src/distributed_hardware_service.cpp | 4 +-- .../src/distributed_hardware_stub.cpp | 4 +-- .../accessmanager/access_manager_test.cpp | 4 +-- .../componentloader/component_loader.h | 4 +-- .../componentmanager/component_disable.h | 4 +-- .../componentmanager/component_enable.h | 4 +-- .../componentmanager/component_manager.h | 4 +-- .../include/distributed_hardware_manager.h | 6 ++-- .../include/distributed_hardware_proxy.h | 4 +-- .../local_hardware_manager.h | 4 +-- .../include/resourcemanager/capability_info.h | 4 +-- .../resourcemanager/capability_info_event.h | 7 +++-- .../resourcemanager/capability_info_manager.h | 6 ++-- .../resourcemanager/capability_utils.h | 4 +-- .../include/resourcemanager/db_adapter.h | 6 ++-- .../include/task/disable_task.h | 6 ++-- .../include/task/enable_task.h | 6 ++-- .../include/task/offline_task.h | 4 +-- .../include/task/online_task.h | 6 ++-- .../include/task/task.h | 6 ++-- .../include/task/task_board.h | 6 ++-- .../include/task/task_executor.h | 6 ++-- .../include/task/task_factory.h | 6 ++-- .../include/utils/dh_context.h | 6 ++-- .../include/utils/impl_utils.h | 6 ++-- .../include/versionmanager/version_manager.h | 6 ++-- .../src/componentloader/component_loader.cpp | 4 +-- .../componentmanager/component_disable.cpp | 4 +-- .../src/componentmanager/component_enable.cpp | 4 +-- .../componentmanager/component_manager.cpp | 4 +-- .../src/distributed_hardware_manager.cpp | 4 +-- .../src/distributed_hardware_proxy.cpp | 4 +-- .../local_hardware_manager.cpp | 4 +-- .../src/resourcemanager/capability_info.cpp | 4 +-- .../capability_info_manager.cpp | 10 +++++-- .../src/resourcemanager/capability_utils.cpp | 4 +-- .../src/resourcemanager/db_adapter.cpp | 4 +-- .../src/task/disable_task.cpp | 4 +-- .../src/task/enable_task.cpp | 4 +-- .../src/task/offline_task.cpp | 4 +-- .../src/task/online_task.cpp | 4 +-- .../src/task/task.cpp | 4 +-- .../src/task/task_board.cpp | 4 +-- .../src/task/task_executor.cpp | 4 +-- .../src/task/task_factory.cpp | 4 +-- .../src/utils/dh_context.cpp | 4 +-- .../src/versionmanager/version_manager.cpp | 4 +-- .../include/component_loader_test.h | 6 ++-- .../src/component_loader_test.cpp | 4 +-- .../include/component_manager_test.h | 6 ++-- .../include/mock_idistributed_hardware_sink.h | 6 ++-- .../mock_idistributed_hardware_source.h | 6 ++-- .../src/component_manager_test.cpp | 4 +-- .../distributed_hardware_manager_test.cpp | 4 +-- .../distributed_hardware_manager_test.h | 6 ++-- .../include/resource_manager_test.h | 4 +-- .../src/resource_manager_test.cpp | 4 +-- .../common/task/include/mock_disable_task.h | 6 ++-- .../common/task/include/mock_enable_task.h | 6 ++-- .../common/task/include/mock_offline_task.h | 6 ++-- .../common/task/include/mock_online_task.h | 6 ++-- .../common/task/include/mock_task_factory.h | 6 ++-- .../common/task/include/mock_task_utils.h | 6 ++-- .../unittest/common/task/include/task_test.h | 6 ++-- .../common/task/src/mock_disable_task.cpp | 4 +-- .../common/task/src/mock_enable_task.cpp | 4 +-- .../common/task/src/mock_offline_task.cpp | 4 +-- .../common/task/src/mock_online_task.cpp | 4 +-- .../common/task/src/mock_task_factory.cpp | 4 +-- .../unittest/common/task/src/task_test.cpp | 4 +-- .../include/version_manager_test.h | 6 ++-- .../src/version_manager_test.cpp | 4 +-- utils/include/anonymous_string.h | 6 ++-- utils/include/dh_utils_tool.h | 6 ++-- utils/include/eventbus/event.h | 8 ++--- utils/include/eventbus/event_bus.h | 18 +++++++---- utils/include/eventbus/event_registration.h | 6 ++-- utils/include/eventbus/event_sender.h | 6 ++-- utils/include/eventbus/eventbus_handler.h | 6 ++-- utils/include/log/dh_log.h | 4 +-- utils/src/anonymous_string.cpp | 4 +-- utils/src/dh_utils_tool.cpp | 4 +-- utils/src/log/dh_log.cpp | 4 +-- utils/test/unittest/common/eventbus/BUILD.gn | 1 + .../common/eventbus/event_bus_test.cpp | 30 +++++++++++++++---- .../unittest/common/eventbus/event_bus_test.h | 6 ++-- .../common/utilstool/utils_tool_test.cpp | 4 +-- .../common/utilstool/utils_tool_test.h | 6 ++-- 104 files changed, 298 insertions(+), 262 deletions(-) diff --git a/common/log/include/distributed_hardware_log.h b/common/log/include/distributed_hardware_log.h index 0a2bdfda..51c06a56 100644 --- a/common/log/include/distributed_hardware_log.h +++ b/common/log/include/distributed_hardware_log.h @@ -33,6 +33,6 @@ namespace DistributedHardware { #define DHLOGE(fmt, ...) DHLog(DH_LOG_ERROR, \ (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/common/utils/include/constants.h b/common/utils/include/constants.h index a6aefea5..37b1dfa6 100644 --- a/common/utils/include/constants.h +++ b/common/utils/include/constants.h @@ -42,6 +42,6 @@ namespace DistributedHardware { const std::string DH_COMPONENT_TYPE = "dhType"; const std::string DH_COMPONENT_SINK_VER = "version"; const std::string DH_COMPONENT_DEFAULT_VERSION = "1.0"; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/common/utils/include/device_type.h b/common/utils/include/device_type.h index f4b8a9cc..03a4f819 100644 --- a/common/utils/include/device_type.h +++ b/common/utils/include/device_type.h @@ -44,6 +44,6 @@ struct DeviceInfo { explicit DeviceInfo(std::string uuid, std::string deviceId, std::string deviceName, uint16_t deviceType) : uuid(uuid), deviceId(deviceId), deviceName(deviceName), deviceType(deviceType) {} }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/common/utils/include/distributed_hardware_errno.h b/common/utils/include/distributed_hardware_errno.h index beb2e542..2bab9497 100644 --- a/common/utils/include/distributed_hardware_errno.h +++ b/common/utils/include/distributed_hardware_errno.h @@ -88,6 +88,6 @@ namespace DistributedHardware { constexpr int32_t ERR_DH_FWK_ACCESS_UNINIT_DM_FAILED = -10901; constexpr int32_t ERR_DH_FWK_ACCESS_REGISTER_DM_FAILED = -10902; constexpr int32_t ERR_DH_FWK_ACCESS_UNREGISTER_DM_FAILED = -10903; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/common/utils/include/idistributed_hardware.h b/common/utils/include/idistributed_hardware.h index 16a6181c..c0db4318 100644 --- a/common/utils/include/idistributed_hardware.h +++ b/common/utils/include/idistributed_hardware.h @@ -35,6 +35,6 @@ public: QUERY_SINK_VERSION = 1 }; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/common/utils/include/idistributed_hardware_manager.h b/common/utils/include/idistributed_hardware_manager.h index 016689be..aed2954f 100644 --- a/common/utils/include/idistributed_hardware_manager.h +++ b/common/utils/include/idistributed_hardware_manager.h @@ -25,7 +25,7 @@ namespace OHOS { namespace DistributedHardware { class IDistributedHardwareManager { public: - virtual ~IDistributedHardwareManager() {}; + virtual ~IDistributedHardwareManager() {} virtual int32_t Initialize() = 0; virtual int32_t Release() = 0; virtual int32_t SendOnLineEvent(const std::string &networkId, const std::string &uuid, @@ -35,6 +35,6 @@ public: virtual size_t GetOnLineCount() = 0; virtual int32_t GetComponentVersion(std::unordered_map &versionMap) = 0; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/common/utils/include/idistributed_hardware_sink.h b/common/utils/include/idistributed_hardware_sink.h index 1947022f..0b36e0f5 100644 --- a/common/utils/include/idistributed_hardware_sink.h +++ b/common/utils/include/idistributed_hardware_sink.h @@ -34,6 +34,6 @@ public: virtual int32_t UnsubscribeLocalHardware(const std::string &dhId) = 0; }; extern "C" __attribute__((visibility("default"))) IDistributedHardwareSink* GetSinkHardwareHandler(); -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/common/utils/include/idistributed_hardware_source.h b/common/utils/include/idistributed_hardware_source.h index 00a32685..8a9b0354 100644 --- a/common/utils/include/idistributed_hardware_source.h +++ b/common/utils/include/idistributed_hardware_source.h @@ -51,6 +51,6 @@ public: const std::string &value) = 0; }; extern "C" __attribute__((visibility("default"))) IDistributedHardwareSource* GetSourceHardwareHandler(); -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/common/utils/include/ihardware_handler.h b/common/utils/include/ihardware_handler.h index 3f8f0cf7..e98caf3c 100644 --- a/common/utils/include/ihardware_handler.h +++ b/common/utils/include/ihardware_handler.h @@ -44,6 +44,6 @@ public: virtual void RegisterPluginListener(std::shared_ptr listener) = 0; }; extern "C" __attribute__((visibility("default"))) IHardwareHandler* GetHardwareHandler(); -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/common/utils/include/single_instance.h b/common/utils/include/single_instance.h index 5cf87255..78da97ce 100644 --- a/common/utils/include/single_instance.h +++ b/common/utils/include/single_instance.h @@ -39,6 +39,6 @@ className & className::GetInstance() \ static className instance; \ return instance; \ } -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkservice/include/accessmanager/access_manager.h b/services/distributedhardwarefwkservice/include/accessmanager/access_manager.h index 8d670a44..5156dcbb 100644 --- a/services/distributedhardwarefwkservice/include/accessmanager/access_manager.h +++ b/services/distributedhardwarefwkservice/include/accessmanager/access_manager.h @@ -60,6 +60,6 @@ private: std::mutex accessMutex_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkservice/include/distributed_hardware_manager_factory.h b/services/distributedhardwarefwkservice/include/distributed_hardware_manager_factory.h index 850a5f27..7c9ba448 100644 --- a/services/distributedhardwarefwkservice/include/distributed_hardware_manager_factory.h +++ b/services/distributedhardwarefwkservice/include/distributed_hardware_manager_factory.h @@ -43,6 +43,6 @@ private: IDistributedHardwareManager *distributedHardwareMgrPtr_ { nullptr }; std::mutex mutex_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkservice/include/distributed_hardware_service.h b/services/distributedhardwarefwkservice/include/distributed_hardware_service.h index fe82313c..8f91391a 100644 --- a/services/distributedhardwarefwkservice/include/distributed_hardware_service.h +++ b/services/distributedhardwarefwkservice/include/distributed_hardware_service.h @@ -47,6 +47,6 @@ private: bool registerToService_ = false; ServiceRunningState state_ = ServiceRunningState::STATE_NOT_START; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkservice/include/distributed_hardware_stub.h b/services/distributedhardwarefwkservice/include/distributed_hardware_stub.h index 464e5f13..80d1d268 100644 --- a/services/distributedhardwarefwkservice/include/distributed_hardware_stub.h +++ b/services/distributedhardwarefwkservice/include/distributed_hardware_stub.h @@ -26,5 +26,5 @@ public: private: std::string ToJson(const std::unordered_map &versionMap) const; }; -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkservice/src/accessmanager/access_manager.cpp b/services/distributedhardwarefwkservice/src/accessmanager/access_manager.cpp index 26a2e012..e9ecf2eb 100644 --- a/services/distributedhardwarefwkservice/src/accessmanager/access_manager.cpp +++ b/services/distributedhardwarefwkservice/src/accessmanager/access_manager.cpp @@ -39,7 +39,11 @@ AccessManager::~AccessManager() std::shared_ptr AccessManager::GetInstance() { - static std::shared_ptr instance(new AccessManager); + static std::shared_ptr instance(new(std::nothrow) AccessManager); + if (instance == nullptr) { + DHLOGE("instance is nullptr, because applying memory fail!"); + return nullptr; + } return instance; } @@ -162,5 +166,5 @@ void AccessManager::SendTrustedDeviceOnline() DistributedHardwareManagerFactory::GetInstance().SendOnLineEvent(networkId, uuid, deviceInfo.deviceTypeId); } } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp index 0a4dda09..dea13812 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp @@ -186,5 +186,5 @@ int32_t DistributedHardwareManagerFactory::GetComponentVersion(std::unordered_ma } return distributedHardwareMgrPtr_->GetComponentVersion(versionMap); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp index cc28e1f8..773c2434 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp @@ -82,5 +82,5 @@ int32_t DistributedHardwareService::QuerySinkVersion(std::unordered_map compHandlerMap_; std::atomic isLocalVersionInit_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_disable.h b/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_disable.h index 5301d0d6..a59b0da4 100644 --- a/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_disable.h +++ b/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_disable.h @@ -37,6 +37,6 @@ private: std::mutex mutex_; std::condition_variable conVar_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_enable.h b/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_enable.h index 83a0602c..4569ecfe 100644 --- a/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_enable.h +++ b/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_enable.h @@ -37,6 +37,6 @@ private: std::mutex mutex_; std::condition_variable conVar_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_manager.h b/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_manager.h index 463f123f..706f0e21 100644 --- a/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_manager.h +++ b/services/distributedhardwarefwkserviceimpl/include/componentmanager/component_manager.h @@ -73,6 +73,6 @@ private: std::unordered_map> sinkVersions_; std::mutex sinkVersionMutex_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_manager.h b/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_manager.h index 07bec4f8..77f92f6d 100644 --- a/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_manager.h +++ b/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_manager.h @@ -32,6 +32,6 @@ public: size_t GetOnLineCount() override; int32_t GetComponentVersion(std::unordered_map &versionMap) override; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_proxy.h b/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_proxy.h index d362558e..13bea7e2 100644 --- a/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_proxy.h +++ b/services/distributedhardwarefwkserviceimpl/include/distributed_hardware_proxy.h @@ -39,6 +39,6 @@ private: static inline BrokerDelegator delegator_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/localhardwaremanager/local_hardware_manager.h b/services/distributedhardwarefwkserviceimpl/include/localhardwaremanager/local_hardware_manager.h index d12c3e03..0c90ba55 100644 --- a/services/distributedhardwarefwkserviceimpl/include/localhardwaremanager/local_hardware_manager.h +++ b/services/distributedhardwarefwkserviceimpl/include/localhardwaremanager/local_hardware_manager.h @@ -47,6 +47,6 @@ private: private: std::map compToolFuncsMap_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info.h b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info.h index 6a461ab1..4bad0825 100644 --- a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info.h +++ b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info.h @@ -86,6 +86,6 @@ void ToJson(nlohmann::json &jsonObject, const CapabilityInfo &capability); void FromJson(const nlohmann::json &jsonObject, CapabilityInfo &capability); using CapabilityInfoMap = std::map>; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_event.h b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_event.h index ba61aa14..762e2962 100644 --- a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_event.h +++ b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_event.h @@ -26,6 +26,7 @@ namespace OHOS { namespace DistributedHardware { class CapabilityInfoEvent : public Event { TYPEINDENT(CapabilityInfoEvent) + public: enum class EventType : uint32_t { UNDEFINED = 0, @@ -33,7 +34,7 @@ public: }; public: - CapabilityInfoEvent(EventSender &sender) : Event(sender) + explicit CapabilityInfoEvent(EventSender &sender) : Event(sender) { action_ = EventType::UNDEFINED; } @@ -50,6 +51,6 @@ public: private: EventType action_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_manager.h b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_manager.h index c9154d17..bbbd9c26 100644 --- a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_manager.h +++ b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_info_manager.h @@ -104,6 +104,6 @@ private: std::shared_ptr dbAdapterPtr_; CapabilityInfoMap globalCapInfoMap_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h index 7bac49dd..03ba810c 100644 --- a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h +++ b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h @@ -37,6 +37,6 @@ public: static std::string GetCapabilityKey(const std::string &deviceId, const std::string &dhId); static bool IsCapKeyMatchDeviceId(const std::string &key, const std::string &deviceId); }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h index cc7ff2fb..6a27272c 100644 --- a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h +++ b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h @@ -84,6 +84,6 @@ private: std::mutex dbAdapterMutex_; std::unordered_map manualSyncCountMap_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/disable_task.h b/services/distributedhardwarefwkserviceimpl/include/task/disable_task.h index 83276ac7..5298235b 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/disable_task.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/disable_task.h @@ -32,6 +32,6 @@ private: int32_t UnRegisterHardware(); void DoTaskInner(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/enable_task.h b/services/distributedhardwarefwkserviceimpl/include/task/enable_task.h index 8c2aae99..55842ce3 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/enable_task.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/enable_task.h @@ -32,6 +32,6 @@ private: int32_t RegisterHardware(); void DoTaskInner(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h b/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h index cfcd34a4..adb2ecdc 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h @@ -48,6 +48,6 @@ private: std::mutex unFinishTaskMtx_; std::set unFinishChildrenTasks_; }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/online_task.h b/services/distributedhardwarefwkserviceimpl/include/task/online_task.h index d21d47b6..6e9eead8 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/online_task.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/online_task.h @@ -31,6 +31,6 @@ private: void DoSyncInfo(); void CreateEnableTask(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/task.h b/services/distributedhardwarefwkserviceimpl/include/task/task.h index de9117c2..65a007ce 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/task.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/task.h @@ -65,6 +65,6 @@ private: TaskState taskState_ { TaskState::INIT }; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/task_board.h b/services/distributedhardwarefwkserviceimpl/include/task/task_board.h index 3a88cc22..d7ffaace 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/task_board.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/task_board.h @@ -43,6 +43,6 @@ private: std::mutex tasksMtx_; std::unordered_map> tasks_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/task_executor.h b/services/distributedhardwarefwkserviceimpl/include/task/task_executor.h index 08fae4a2..08a07192 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/task_executor.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/task_executor.h @@ -42,6 +42,6 @@ private: std::condition_variable condVar_; bool taskThreadFlag_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/task/task_factory.h b/services/distributedhardwarefwkserviceimpl/include/task/task_factory.h index 957d820e..90f519c4 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/task_factory.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/task_factory.h @@ -29,6 +29,6 @@ public: std::shared_ptr CreateTask(TaskType taskType, const std::string &networkId, const std::string &uuid, const std::string &dhId, std::shared_ptr fatherTask); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/utils/dh_context.h b/services/distributedhardwarefwkserviceimpl/include/utils/dh_context.h index 42b1c825..d9132b93 100644 --- a/services/distributedhardwarefwkserviceimpl/include/utils/dh_context.h +++ b/services/distributedhardwarefwkserviceimpl/include/utils/dh_context.h @@ -57,6 +57,6 @@ private: std::unordered_map deviceIdUUIDMap_; std::shared_mutex onlineDevMutex_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/utils/impl_utils.h b/services/distributedhardwarefwkserviceimpl/include/utils/impl_utils.h index c29fd75c..ff549114 100644 --- a/services/distributedhardwarefwkserviceimpl/include/utils/impl_utils.h +++ b/services/distributedhardwarefwkserviceimpl/include/utils/impl_utils.h @@ -60,6 +60,6 @@ struct DHVersion { std::string dhVersion; std::unordered_map compVersions; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/include/versionmanager/version_manager.h b/services/distributedhardwarefwkserviceimpl/include/versionmanager/version_manager.h index 4071074a..0626567a 100644 --- a/services/distributedhardwarefwkserviceimpl/include/versionmanager/version_manager.h +++ b/services/distributedhardwarefwkserviceimpl/include/versionmanager/version_manager.h @@ -47,6 +47,6 @@ private: std::unordered_map dhVersions_; std::mutex versionMutex_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp index 9d262bbb..10d940b1 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp @@ -318,5 +318,5 @@ bool ComponentLoader::IsDHTypeExist(DHType dhType) } return true; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp index 008cec9c..9c53fab5 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp @@ -72,5 +72,5 @@ int32_t ComponentDisable::OnUnregisterResult(const std::string &networkId, const conVar_.notify_all(); return status_; } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp index 051bf009..c5a3b433 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp @@ -72,5 +72,5 @@ int32_t ComponentEnable::OnRegisterResult(const std::string &networkId, const st conVar_.notify_all(); return status_; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp index 0e4271a9..6df99ba6 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp @@ -384,5 +384,5 @@ sptr ComponentManager::GetRemoteDHMS(const std::string &ne } return iface_cast(object); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_manager.cpp index cce91398..0e205d3e 100644 --- a/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_manager.cpp @@ -160,5 +160,5 @@ int32_t DistributedHardwareManager::GetComponentVersion(std::unordered_map DistributedHardwareProxy::FromJson(const { return nlohmann::json::parse(json).get>(); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp index c8459979..7b6f0f5d 100644 --- a/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp @@ -97,5 +97,5 @@ void LocalHardwareManager::AddLocalCapabilityInfo(const std::vector &dhI } CapabilityInfoManager::GetInstance()->AddCapability(capabilityInfos); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info.cpp b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info.cpp index 31782244..e5109319 100644 --- a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info.cpp @@ -151,5 +151,5 @@ void FromJson(const nlohmann::json &jsonObject, CapabilityInfo &capability) capability.SetDHAttrs(jsonObject.at(DH_ATTRS).get()); } } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp index bfe9077f..d70a9270 100644 --- a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp @@ -43,7 +43,11 @@ CapabilityInfoManager::~CapabilityInfoManager() std::shared_ptr CapabilityInfoManager::GetInstance() { - static std::shared_ptr instance(new CapabilityInfoManager); + static std::shared_ptr instance(new(std::nothrow) CapabilityInfoManager); + if (instance == nullptr) { + DHLOGE("instance is nullptr, because applying memory fail!"); + return nullptr; + } return instance; } @@ -508,5 +512,5 @@ int32_t CapabilityInfoManager::GetDataByKeyPrefix(const std::string &keyPrefix, } return DH_FWK_SUCCESS; } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp index c70f713a..450df0e9 100644 --- a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp @@ -46,5 +46,5 @@ bool CapabilityUtils::IsCapKeyMatchDeviceId(const std::string &key, const std::s std::string keyDevId = key.substr(0, separatorPos); return keyDevId.compare(deviceId) == 0; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp index 02e738e9..092d2dab 100644 --- a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp @@ -397,5 +397,5 @@ int32_t DBAdapter::RemoveDataByKey(const std::string &key) DHLOGD("Remove data by key success"); return DH_FWK_SUCCESS; } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/disable_task.cpp b/services/distributedhardwarefwkserviceimpl/src/task/disable_task.cpp index c852ad28..11a23449 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/disable_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/disable_task.cpp @@ -73,5 +73,5 @@ int32_t DisableTask::UnRegisterHardware() GetId().c_str(), GetAnonyString(GetUUID()).c_str(), GetDhId().c_str()); return result; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp b/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp index cd120a76..536986d9 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp @@ -62,5 +62,5 @@ int32_t EnableTask::RegisterHardware() GetId().c_str(), GetAnonyString(GetUUID()).c_str(), GetDhId().c_str()); return result; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/offline_task.cpp b/services/distributedhardwarefwkserviceimpl/src/task/offline_task.cpp index c0c43148..a7875fb1 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/offline_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/offline_task.cpp @@ -130,5 +130,5 @@ void OffLineTask::AddChildrenTask(std::shared_ptr childrenTask) std::lock_guard lock(unFinishTaskMtx_); this->unFinishChildrenTasks_.insert(childrenTask->GetId()); } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/online_task.cpp b/services/distributedhardwarefwkserviceimpl/src/task/online_task.cpp index 52f9b540..0b4b5db1 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/online_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/online_task.cpp @@ -99,5 +99,5 @@ void OnLineTask::CreateEnableTask() TaskExecutor::GetInstance().PushTask(task); } } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/task.cpp b/services/distributedhardwarefwkserviceimpl/src/task/task.cpp index 349f645c..d5f78965 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/task.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/task.cpp @@ -100,5 +100,5 @@ void Task::SetFatherTask(std::shared_ptr fatherTask) { this->fatherTask_ = fatherTask; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/task_board.cpp b/services/distributedhardwarefwkserviceimpl/src/task/task_board.cpp index 1d9decae..93ba6f0d 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/task_board.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/task_board.cpp @@ -85,5 +85,5 @@ void TaskBoard::RemoveTaskInner(std::string taskId) tasks_.erase(taskId); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/task_executor.cpp b/services/distributedhardwarefwkserviceimpl/src/task/task_executor.cpp index aa2c6007..45316ea5 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/task_executor.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/task_executor.cpp @@ -87,5 +87,5 @@ void TaskExecutor::TriggerTask() DHContext::GetInstance().GetEventBus()->PostTask(taskFunc, task->GetId()); } } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/task/task_factory.cpp b/services/distributedhardwarefwkserviceimpl/src/task/task_factory.cpp index ba13f0f3..bb84623c 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/task_factory.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/task_factory.cpp @@ -66,5 +66,5 @@ std::shared_ptr TaskFactory::CreateTask(TaskType taskType, const std::stri return task; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp b/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp index 06e71cd1..63f6eb49 100644 --- a/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp @@ -97,5 +97,5 @@ std::string DHContext::GetUUIDByDeviceId(const std::string &deviceId) } return deviceIdUUIDMap_[deviceId]; } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/src/versionmanager/version_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/versionmanager/version_manager.cpp index febd7d55..c965b413 100644 --- a/services/distributedhardwarefwkserviceimpl/src/versionmanager/version_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/versionmanager/version_manager.cpp @@ -112,5 +112,5 @@ std::string VersionManager::GetLocalDeviceVersion() { return DH_LOCAL_VERSION; } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/include/component_loader_test.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/include/component_loader_test.h index a5b422ce..a606eca7 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/include/component_loader_test.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/include/component_loader_test.h @@ -27,6 +27,6 @@ public: void SetUp(); void TearDown(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/src/component_loader_test.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/src/component_loader_test.cpp index 4b47f1fb..6e7c8589 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/src/component_loader_test.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentloader/src/component_loader_test.cpp @@ -148,5 +148,5 @@ HWTEST_F(ComponentLoaderTest, component_loader_test_007, TestSize.Level0) EXPECT_TRUE(ComponentLoader::GetInstance().compHandlerMap_[iter.first].sinkHandler == nullptr); } } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/component_manager_test.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/component_manager_test.h index 50046e78..2caeca7a 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/component_manager_test.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/component_manager_test.h @@ -29,6 +29,6 @@ public: int32_t Enable(int32_t timeout, int32_t status); int32_t Disable(int32_t timeout, int32_t status); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_sink.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_sink.h index 350aa760..d61ebacb 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_sink.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_sink.h @@ -39,6 +39,6 @@ public: return 0; } }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_source.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_source.h index cd7a35c9..1d6cb662 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_source.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/include/mock_idistributed_hardware_source.h @@ -39,6 +39,6 @@ public: return 0; } }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/src/component_manager_test.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/src/component_manager_test.cpp index 9c7714cf..b279b506 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/src/component_manager_test.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/componentmanager/src/component_manager_test.cpp @@ -339,5 +339,5 @@ HWTEST_F(ComponentManagerTest, disable_test_004, TestSize.Level0) thread5.join(); thread6.join(); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.cpp index c01bae52..34c6bf24 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.cpp @@ -168,5 +168,5 @@ HWTEST_F(DistributedHardwareManagerTest, sendOffLineEvent_test_003, TestSize.Lev ASSERT_EQ(DH_FWK_SUCCESS, TaskBoard::GetInstance().WaitForALLTaskFinish()); ASSERT_TRUE(TaskBoard::GetInstance().IsAllTaskFinish()); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.h index 20fd1dd6..9d90f9ea 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/distributed_hardware_manager_test.h @@ -27,6 +27,6 @@ public: void SetUp(); void TearDown(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/include/resource_manager_test.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/include/resource_manager_test.h index 63fecacc..7bcef973 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/include/resource_manager_test.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/include/resource_manager_test.h @@ -27,6 +27,6 @@ public: void SetUp(); void TearDown(); }; -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/src/resource_manager_test.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/src/resource_manager_test.cpp index 5a68c343..86c4c544 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/src/resource_manager_test.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/resourcemanager/src/resource_manager_test.cpp @@ -356,5 +356,5 @@ HWTEST_F(ResourceManagerTest, resource_manager_test_013, TestSize.Level0) DH_FWK_SUCCESS); EXPECT_EQ(capMap.size(), TEST_SIZE_10); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_disable_task.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_disable_task.h index 39c45b34..20d894df 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_disable_task.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_disable_task.h @@ -29,6 +29,6 @@ private: /* synchronous function for unregister distributed hardware, return on asynchronous unregister finish */ int32_t UnRegisterHardware(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_enable_task.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_enable_task.h index abb35352..de782365 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_enable_task.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_enable_task.h @@ -29,6 +29,6 @@ private: /* synchronous function for register distributed hardware, return on asynchronous register finish */ int32_t RegisterHardware(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_offline_task.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_offline_task.h index 8f99e846..1ed33d2b 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_offline_task.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_offline_task.h @@ -35,6 +35,6 @@ private: std::vector offLineDevInfos; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_online_task.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_online_task.h index 47cda491..ea5351b8 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_online_task.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_online_task.h @@ -35,6 +35,6 @@ private: std::vector onLineDevInfos; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_factory.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_factory.h index f97b9f9c..f0e86128 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_factory.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_factory.h @@ -29,6 +29,6 @@ public: std::shared_ptr CreateTask(TaskType taskType, const std::string &networkId, const std::string &uuid, const std::string &dhId, std::shared_ptr fatherTask); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_utils.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_utils.h index 36fa6036..04b3da8b 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_utils.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/mock_task_utils.h @@ -25,6 +25,6 @@ struct MockDevInfo { std::string uuid; std::string dhId; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/task_test.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/task_test.h index dc872f85..45edd92a 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/task_test.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/include/task_test.h @@ -27,6 +27,6 @@ public: void SetUp(); void TearDown(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp index 35a54724..9beec548 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp @@ -33,5 +33,5 @@ int32_t MockDisableTask::UnRegisterHardware() std::this_thread::sleep_for(200ms); return DH_FWK_SUCCESS; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp index dea92cc5..58e6586a 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp @@ -32,5 +32,5 @@ int32_t MockEnableTask::RegisterHardware() std::this_thread::sleep_for(300ms); return DH_FWK_SUCCESS; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp index db577a7f..d514c646 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp @@ -48,5 +48,5 @@ void MockOffLineTask::SetOffLineDevInfos(std::vector offLineDevInfo { this->offLineDevInfos = offLineDevInfos; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp index 815b00e4..310ce682 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp @@ -50,5 +50,5 @@ void MockOnLineTask::SetOnLineDevInfos(std::vector devInfos) { this->onLineDevInfos = devInfos; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_task_factory.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_task_factory.cpp index d0a9d08c..479adaca 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_task_factory.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_task_factory.cpp @@ -60,5 +60,5 @@ std::shared_ptr MockTaskFactory::CreateTask(TaskType taskType, const std:: return task; } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/task_test.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/task_test.cpp index e5ee6567..6f99d654 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/task_test.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/task_test.cpp @@ -154,5 +154,5 @@ HWTEST_F(TaskTest, task_test_004, TestSize.Level0) ASSERT_EQ(DH_FWK_SUCCESS, TaskBoard::GetInstance().WaitForALLTaskFinish()); ASSERT_TRUE(TaskBoard::GetInstance().IsAllTaskFinish()); } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/include/version_manager_test.h b/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/include/version_manager_test.h index 5a53290f..ac3e715a 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/include/version_manager_test.h +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/include/version_manager_test.h @@ -30,6 +30,6 @@ public: void SetUp(); void TearDown(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/src/version_manager_test.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/src/version_manager_test.cpp index 12b68af1..874900c8 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/src/version_manager_test.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/versionmanager/src/version_manager_test.cpp @@ -154,5 +154,5 @@ HWTEST_F(VersionManagerTest, version_manager_test_005, TestSize.Level0) ret = VersionManager::GetInstance().RemoveDHVersion(TEST_DEVICE_ID_1); EXPECT_EQ(DH_FWK_SUCCESS, ret); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/include/anonymous_string.h b/utils/include/anonymous_string.h index f2a88e03..87fefb75 100644 --- a/utils/include/anonymous_string.h +++ b/utils/include/anonymous_string.h @@ -22,6 +22,6 @@ namespace OHOS { namespace DistributedHardware { std::string GetAnonyString(const std::string &value); std::string GetAnonyInt32(const int32_t value); -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/include/dh_utils_tool.h b/utils/include/dh_utils_tool.h index 0fdf5b9e..cfcaf413 100644 --- a/utils/include/dh_utils_tool.h +++ b/utils/include/dh_utils_tool.h @@ -39,6 +39,6 @@ DeviceInfo GetLocalDeviceInfo(); /* Convert uuid to deviceId by sha256 encode */ std::string GetDeviceIdByUUID(const std::string &uuid); -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/include/eventbus/event.h b/utils/include/eventbus/event.h index 8c907534..879e9e99 100644 --- a/utils/include/eventbus/event.h +++ b/utils/include/eventbus/event.h @@ -32,7 +32,7 @@ class Event { TYPEINDENT(Event) public: - Event(EventSender &sender) : sender_(sender) {} + explicit Event(EventSender &sender) : sender_(sender) {} virtual ~Event() = default; @@ -44,6 +44,6 @@ public: private: EventSender &sender_; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/include/eventbus/event_bus.h b/utils/include/eventbus/event_bus.h index 2d1a9774..4a4840dc 100644 --- a/utils/include/eventbus/event_bus.h +++ b/utils/include/eventbus/event_bus.h @@ -63,7 +63,11 @@ public: Registrations *registrations = handlers[typeId]; if (registrations == nullptr) { - registrations = new EventRegistration::Registrations(); + registrations = new(std::nothrow) EventRegistration::Registrations(); + if (registrations == nullptr) { + ULOGE("registrations is null, because applying memory fail!"); + return nullptr; + } handlers[typeId] = registrations; } @@ -88,7 +92,11 @@ public: Registrations *registrations = handlers[typeId]; if (registrations == nullptr) { - registrations = new EventRegistration::Registrations(); + registrations = new(std::nothrow) EventRegistration::Registrations(); + if (registrations == nullptr) { + ULOGE("registrations is null, because applying memory fail!"); + return nullptr; + } handlers[typeId] = registrations; } @@ -201,6 +209,6 @@ private: using TypeMap = std::unordered_map> *>; TypeMap handlers; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/include/eventbus/event_registration.h b/utils/include/eventbus/event_registration.h index 623835ab..d726389f 100644 --- a/utils/include/eventbus/event_registration.h +++ b/utils/include/eventbus/event_registration.h @@ -45,6 +45,6 @@ private: void * const handler; EventSender * const sender; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/include/eventbus/event_sender.h b/utils/include/eventbus/event_sender.h index 1aeaf29f..72f3bc59 100644 --- a/utils/include/eventbus/event_sender.h +++ b/utils/include/eventbus/event_sender.h @@ -22,6 +22,6 @@ class EventSender { public: virtual ~EventSender() = default; }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/include/eventbus/eventbus_handler.h b/utils/include/eventbus/eventbus_handler.h index fb99b04c..c7b702e0 100644 --- a/utils/include/eventbus/eventbus_handler.h +++ b/utils/include/eventbus/eventbus_handler.h @@ -34,6 +34,6 @@ public: OnEvent(e); } }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/include/log/dh_log.h b/utils/include/log/dh_log.h index 94a39137..0b38bb6e 100644 --- a/utils/include/log/dh_log.h +++ b/utils/include/log/dh_log.h @@ -38,6 +38,6 @@ void DHLog(DHLogLevel logLevel, const char *fmt, ...); #define ULOGE(fmt, ...) DHLog(DH_LOG_ERROR, \ (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) -} -} +} // namespace DistributedHardware +} // namespace OHOS #endif diff --git a/utils/src/anonymous_string.cpp b/utils/src/anonymous_string.cpp index 68597d7b..291fd9e9 100644 --- a/utils/src/anonymous_string.cpp +++ b/utils/src/anonymous_string.cpp @@ -64,5 +64,5 @@ std::string GetAnonyInt32(const int32_t value) std::string tempString(tempBuffer); return tempString; } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/src/dh_utils_tool.cpp b/utils/src/dh_utils_tool.cpp index ab5c3aec..e6e9f928 100644 --- a/utils/src/dh_utils_tool.cpp +++ b/utils/src/dh_utils_tool.cpp @@ -115,5 +115,5 @@ DeviceInfo GetLocalDeviceInfo() devInfo.deviceType = info->deviceTypeId; return devInfo; } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/src/log/dh_log.cpp b/utils/src/log/dh_log.cpp index 16eb7c5f..1ea885b6 100644 --- a/utils/src/log/dh_log.cpp +++ b/utils/src/log/dh_log.cpp @@ -83,5 +83,5 @@ void DHLog(DHLogLevel logLevel, const char *fmt, ...) } DHLogOut(logLevel, logBuf); } -} -} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/test/unittest/common/eventbus/BUILD.gn b/utils/test/unittest/common/eventbus/BUILD.gn index c3483808..5d244299 100644 --- a/utils/test/unittest/common/eventbus/BUILD.gn +++ b/utils/test/unittest/common/eventbus/BUILD.gn @@ -19,6 +19,7 @@ config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "include", + "${common_path}/log/include", "${utils_path}/include", "${utils_path}/include/log", "${utils_path}/include/eventbus", diff --git a/utils/test/unittest/common/eventbus/event_bus_test.cpp b/utils/test/unittest/common/eventbus/event_bus_test.cpp index 30d7a813..d0015d04 100644 --- a/utils/test/unittest/common/eventbus/event_bus_test.cpp +++ b/utils/test/unittest/common/eventbus/event_bus_test.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "distributed_hardware_log.h" + #include "event_bus_test.h" using namespace testing::ext; @@ -37,11 +39,27 @@ void EventbusTest::TearDownTestCase(void) void EventbusTest::SetUp() { - g_obj = new FakeObject("Player"); - g_listener = new FakeListener(); - g_sender = new FakeSender(); + g_obj = new(std::nothrow) FakeObject("Player"); + if (g_obj == nullptr) { + DHLOGE("obj is null, because applying memory fail!"); + return; + } + g_listener = new(std::nothrow) FakeListener(); + if (g_listener == nullptr) { + DHLOGE("listener is null, because applying memory fail!"); + return; + } + g_sender = new(std::nothrow) FakeSender(); + if (g_sender == nullptr) { + DHLOGE("sender is null, because applying memory fail!"); + return; + } g_regHandler = nullptr; - g_eventBus = new EventBus(); + g_eventBus = new(std::nothrow) EventBus(); + if (g_eventBus == nullptr) { + DHLOGE("eventBus is null, because applying memory fail!"); + return; + } } void EventbusTest::TearDown() @@ -155,5 +173,5 @@ HWTEST_F(EventbusTest, event_bus_test_005, TestSize.Level0) g_eventBus->PostEvent(e, POSTMODE::POST_SYNC); EXPECT_EQ(10, g_obj->GetAge()); } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/test/unittest/common/eventbus/event_bus_test.h b/utils/test/unittest/common/eventbus/event_bus_test.h index 110bfbb8..f3435a52 100644 --- a/utils/test/unittest/common/eventbus/event_bus_test.h +++ b/utils/test/unittest/common/eventbus/event_bus_test.h @@ -98,6 +98,6 @@ public: void SetUp(); void TearDown(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/utils/test/unittest/common/utilstool/utils_tool_test.cpp b/utils/test/unittest/common/utilstool/utils_tool_test.cpp index e67458ec..d83b3356 100644 --- a/utils/test/unittest/common/utilstool/utils_tool_test.cpp +++ b/utils/test/unittest/common/utilstool/utils_tool_test.cpp @@ -117,5 +117,5 @@ HWTEST_F(UtilsToolTest, utils_tool_test_004, TestSize.Level0) ASSERT_STRNE(std::to_string(i4).c_str(), GetAnonyInt32(i4).c_str()); ASSERT_STRNE(std::to_string(i5).c_str(), GetAnonyInt32(i5).c_str()); } -} -} \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/test/unittest/common/utilstool/utils_tool_test.h b/utils/test/unittest/common/utilstool/utils_tool_test.h index 62926ab0..234e06e0 100644 --- a/utils/test/unittest/common/utilstool/utils_tool_test.h +++ b/utils/test/unittest/common/utilstool/utils_tool_test.h @@ -27,6 +27,6 @@ public: void SetUp(); void TearDown(); }; -} -} -#endif \ No newline at end of file +} // namespace DistributedHardware +} // namespace OHOS +#endif -- Gitee From 8e1091c89c38569e7fbba0914c7c8d1ccba22a53 Mon Sep 17 00:00:00 2001 From: tangfan <1824525929@qq.com> Date: Tue, 22 Mar 2022 20:05:02 +0800 Subject: [PATCH 2/2] fix gn format Signed-off-by: tangfan <1824525929@qq.com> --- utils/test/unittest/common/eventbus/BUILD.gn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/test/unittest/common/eventbus/BUILD.gn b/utils/test/unittest/common/eventbus/BUILD.gn index 5d244299..ca74d213 100644 --- a/utils/test/unittest/common/eventbus/BUILD.gn +++ b/utils/test/unittest/common/eventbus/BUILD.gn @@ -12,7 +12,9 @@ # limitations under the License. import("//build/test.gni") -import("//foundation/distributedhardware/distributedhardwarefwk/distributedhardwarefwk.gni") +import( + "//foundation/distributedhardware/distributedhardwarefwk/distributedhardwarefwk.gni") + module_out_path = "distributed_hardware_fwk/event_bus_test" config("module_private_config") { @@ -36,13 +38,11 @@ ohos_unittest("EventBusTest") { configs = [ ":module_private_config" ] deps = [ + "//foundation/distributedhardware/distributedhardwarefwk/utils:distributedhardwareutils", "//third_party/googletest:gtest_main", - "//foundation/distributedhardware/distributedhardwarefwk/utils:distributedhardwareutils" ] - external_deps = [ - "eventhandler:libeventhandler", - ] + external_deps = [ "eventhandler:libeventhandler" ] } group("event_bus_test") { -- Gitee