diff --git a/frameworks/ans/src/notification.cpp b/frameworks/ans/src/notification.cpp index 7723258b80e2da49c025bb80cfe43d1747543a60..f368a78c2bd30ce8abe634d18203b604ae0fc67c 100644 --- a/frameworks/ans/src/notification.cpp +++ b/frameworks/ans/src/notification.cpp @@ -465,10 +465,10 @@ void Notification::SetRemindType(const NotificationConstant::RemindType &reminTy std::string Notification::GenerateNotificationKey( const std::string &deviceId, int32_t userId, int32_t uid, const std::string &label, int32_t id) { - const char *KEY_SPLITER = "_"; + const char *keySpliter = "_"; std::stringstream stream; - stream << deviceId << KEY_SPLITER << userId << KEY_SPLITER << uid << KEY_SPLITER << label << KEY_SPLITER << id; + stream << deviceId << keySpliter << userId << keySpliter << uid << keySpliter << label << keySpliter << id; return stream.str(); } diff --git a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp index a9e2e45a417e28184eb28776f3cb825414c77042..22de02b1b9f0035a49b65645b872d0bebd488901 100644 --- a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp +++ b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp @@ -74,40 +74,40 @@ const std::string CLASSIFICATION_ALARM {"alarm"}; class TestAnsSubscriber : public NotificationSubscriber { public: - virtual void OnConnected() override + void OnConnected() override { g_subscribe_mtx.unlock(); } - virtual void OnDisconnected() override + void OnDisconnected() override { g_unsubscribe_mtx.unlock(); } - virtual void OnDied() override + void OnDied() override {} - virtual void OnUpdate(const std::shared_ptr &sortingMap) override + void OnUpdate(const std::shared_ptr &sortingMap) override {} - virtual void OnDoNotDisturbDateChange(const std::shared_ptr &date) override + void OnDoNotDisturbDateChange(const std::shared_ptr &date) override {} - virtual void OnEnabledNotificationChanged( + void OnEnabledNotificationChanged( const std::shared_ptr &callbackData) override {} - virtual void OnCanceled(const std::shared_ptr &request) override + void OnCanceled(const std::shared_ptr &request) override { GTEST_LOG_(INFO) << "ANS_Interface_MT::OnCanceled request : " << request->GetNotificationRequest().Dump(); OnCanceledReceived = true; } - virtual void OnCanceled(const std::shared_ptr &request, + void OnCanceled(const std::shared_ptr &request, const std::shared_ptr &sortingMap, int deleteReason) override {} - virtual void OnConsumed(const std::shared_ptr &request) override + void OnConsumed(const std::shared_ptr &request) override { OnConsumedReceived = true; g_consumed_mtx.unlock(); @@ -153,7 +153,7 @@ public: } } - virtual void OnConsumed(const std::shared_ptr &request, + void OnConsumed(const std::shared_ptr &request, const std::shared_ptr &sortingMap) override {} diff --git a/frameworks/test/moduletest/mock/mock_bundle_manager_helper.cpp b/frameworks/test/moduletest/mock/mock_bundle_manager_helper.cpp index b4c84abd03d6005edc214ccea8e243afc0e95a8b..daba3e9c449a6a08ac8401f2118ef34533337f78 100644 --- a/frameworks/test/moduletest/mock/mock_bundle_manager_helper.cpp +++ b/frameworks/test/moduletest/mock/mock_bundle_manager_helper.cpp @@ -21,6 +21,9 @@ namespace OHOS { namespace Notification { + +const int32_t defaultUserId = 1000; + BundleManagerHelper::BundleManagerHelper() {} @@ -42,7 +45,7 @@ bool BundleManagerHelper::IsSystemApp(int uid) int BundleManagerHelper::GetDefaultUidByBundleName(const std::string &bundle, const int32_t userId) { - return 1000; + return defaultUserId; } bool BundleManagerHelper::GetBundleInfoByBundleName( diff --git a/test/bechmarktest/notification_publish_test/notification_publish_test.cpp b/test/bechmarktest/notification_publish_test/notification_publish_test.cpp index 02a3485802b9500d78cb49dd9c9036aee0ea3bc0..61b59db636618ffac90e3dd6bce0339b1b8fa9e0 100644 --- a/test/bechmarktest/notification_publish_test/notification_publish_test.cpp +++ b/test/bechmarktest/notification_publish_test/notification_publish_test.cpp @@ -42,7 +42,7 @@ public: InitButtonRequest(); } - virtual ~BenchmarkNotificationPublish() override = default; + ~BenchmarkNotificationPublish() override = default; void SetUp(const ::benchmark::State &state) override {} diff --git a/test/bechmarktest/notification_services_test/notification_service_test.cpp b/test/bechmarktest/notification_services_test/notification_service_test.cpp index 0f3c6001e324bcee632c4f202044640441d77bef..25c853c360fd2d766ef1cac7cc661c40504a2078 100644 --- a/test/bechmarktest/notification_services_test/notification_service_test.cpp +++ b/test/bechmarktest/notification_services_test/notification_service_test.cpp @@ -68,7 +68,7 @@ public: ReportAggregatesOnly(); } - virtual ~BenchmarkNotificationService() override = default; + ~BenchmarkNotificationService() override = default; void SetUp(const ::benchmark::State &state) override {} diff --git a/tools/dump/src/notification_shell_command.cpp b/tools/dump/src/notification_shell_command.cpp index b135c15c56abef6440147c5450d36c4b2720a359..0906e4684375359167dbf75cd086f383e234fccb 100644 --- a/tools/dump/src/notification_shell_command.cpp +++ b/tools/dump/src/notification_shell_command.cpp @@ -305,7 +305,6 @@ ErrCode NotificationShellCommand::RunSetEnableCmd() resultReceiver_.append("set notification enabled failed\n"); } return ret; - } } // namespace Notification } // namespace OHOS