From 1b36dec2c5bd995920f6d2310db67bc3387b072d Mon Sep 17 00:00:00 2001 From: liuyanzhi Date: Wed, 8 Dec 2021 20:36:10 +0800 Subject: [PATCH] start alarm clearing Signed-off-by: liuyanzhi Change-Id: Ia40ae490c43b9688a795baf558f9015b2d4a189f --- .../core/common/include/ans_const_define.h | 1 - .../ans/core/common/include/ans_log_wrapper.h | 1 - .../include/ans_manager_death_recipient.h | 1 - .../ans/core/include/ans_notification.h | 2 +- .../ans/core/include/ans_subscriber_proxy.h | 1 - .../ans/core/include/ans_subscriber_stub.h | 1 - frameworks/ans/core/src/ans_manager_proxy.cpp | 3 -- frameworks/ans/core/src/ans_manager_stub.cpp | 37 ------------------- frameworks/ans/core/src/ans_notification.cpp | 1 - .../ans/core/src/ans_subscriber_proxy.cpp | 1 - .../ans/core/src/ans_subscriber_stub.cpp | 2 - frameworks/ans/native/src/notification.cpp | 4 +- .../native/src/notification_action_button.cpp | 6 +-- .../native/src/notification_bundle_option.cpp | 3 +- .../ans/native/src/notification_constant.cpp | 1 - .../ans/native/src/notification_content.cpp | 22 +++++++---- .../notification_conversational_content.cpp | 2 +- .../notification_conversational_message.cpp | 2 +- .../src/notification_long_text_content.cpp | 5 +-- .../native/src/notification_media_content.cpp | 5 +-- .../src/notification_multiline_content.cpp | 4 +- .../src/notification_normal_content.cpp | 2 +- .../src/notification_picture_content.cpp | 2 +- .../ans/native/src/notification_request.cpp | 14 +++---- .../ans/native/src/notification_slot.cpp | 1 - .../native/src/notification_slot_group.cpp | 2 +- .../src/notification_subscribe_info.cpp | 2 - .../native/src/notification_subscriber.cpp | 8 ++-- .../native/src/notification_user_input.cpp | 3 +- .../ans_innerkits_module_publish_test.cpp | 3 +- .../ans_innerkits_module_setting_test.cpp | 13 +++---- .../ans_innerkits_module_slot_test.cpp | 1 - .../moduletest/mock/mock_bundle_mgr_proxy.cpp | 2 - .../moduletest/mock/mock_event_handler.cpp | 1 - .../moduletest/mock/mock_message_parcel.cpp | 2 +- .../moduletest/mock/mock_single_kv_store.cpp | 1 - frameworks/wantagent/src/pending_want.cpp | 1 - .../wantagent/src/want_agent_log_wrapper.cpp | 1 - .../ans/native/include/message_user.h | 10 ++--- .../ans/native/include/notification.h | 1 - .../include/notification_bundle_option.h | 4 +- .../native/include/notification_constant.h | 4 +- .../ans/native/include/notification_request.h | 32 ++++++++-------- .../native/include/notification_slot_group.h | 10 ++--- .../ans/native/include/notification_sorting.h | 1 - .../native/include/notification_sorting_map.h | 2 - .../include/notification_subscribe_info.h | 1 - .../native/include/notification_subscriber.h | 3 +- .../wantagent/include/completed_callback.h | 1 - .../wantagent/include/completed_dispatcher.h | 18 ++++----- .../wantagent/include/pending_want.h | 8 ++-- .../wantagent/include/trigger_info.h | 12 +++--- .../innerkits/wantagent/include/want_agent.h | 19 +++++----- .../wantagent/include/want_agent_constant.h | 2 +- .../wantagent/include/want_agent_helper.h | 8 ++-- .../wantagent/include/want_agent_info.h | 14 +++---- .../include/want_agent_log_wrapper.h | 2 +- interfaces/kits/napi/ans/include/cancel.h | 1 - interfaces/kits/napi/ans/include/common.h | 1 - interfaces/kits/napi/ans/include/constant.h | 1 - .../kits/napi/ans/include/display_badge.h | 1 - .../kits/napi/ans/include/disturb_mode.h | 1 - .../napi/ans/include/enable_notification.h | 1 - interfaces/kits/napi/ans/include/get_active.h | 1 - interfaces/kits/napi/ans/include/init.h | 1 - interfaces/kits/napi/ans/include/publish.h | 2 - interfaces/kits/napi/ans/include/remove.h | 1 - interfaces/kits/napi/ans/include/slot.h | 1 - interfaces/kits/napi/ans/include/subscribe.h | 2 - .../kits/napi/ans/include/unsubscribe.h | 1 - interfaces/kits/napi/ans/src/cancel.cpp | 1 - .../kits/napi/ans/src/display_badge.cpp | 1 - interfaces/kits/napi/ans/src/disturb_mode.cpp | 1 - .../kits/napi/ans/src/enable_notification.cpp | 1 - interfaces/kits/napi/ans/src/init.cpp | 1 - interfaces/kits/napi/ans/src/slot.cpp | 1 - interfaces/kits/napi/ans/src/subscribe.cpp | 1 - interfaces/kits/napi/ans/src/unsubscribe.cpp | 1 - .../kits/napi/wantagent/napi_want_agent.cpp | 18 ++++----- .../kits/napi/wantagent/native_module.cpp | 4 +- .../include/advanced_notification_service.h | 2 - .../advanced_notification_service_ability.h | 2 - services/ans/include/bundle_manager_helper.h | 2 - .../distributed_kvstore_death_recipient.h | 2 - services/ans/include/disturb_filter.h | 6 +-- services/ans/include/interface_system_event.h | 2 - services/ans/include/notification_filter.h | 6 +-- .../notification_preferences_database.h | 2 - services/ans/include/notification_record.h | 2 - .../ans/include/notification_slot_filter.h | 6 +-- .../include/notification_subscriber_manager.h | 1 - services/ans/include/permission_filter.h | 6 +-- services/ans/include/preferences_constant.h | 2 - services/ans/include/remote_death_recipient.h | 7 +--- services/ans/include/system_event_observer.h | 2 - .../ans/include/system_event_subscriber.h | 2 - .../ans/src/advanced_notification_service.cpp | 1 - .../advanced_notification_service_ability.cpp | 2 - services/ans/src/bundle_manager_helper.cpp | 2 - services/ans/src/notification_preferences.cpp | 6 --- .../src/notification_preferences_database.cpp | 4 -- .../ans/src/notification_preferences_info.cpp | 2 - services/ans/src/notification_slot_filter.cpp | 2 - .../src/notification_subscriber_manager.cpp | 1 - services/ans/src/permission_filter.cpp | 2 - services/ans/src/system_event_observer.cpp | 2 - ...nced_notification_service_ability_test.cpp | 10 ++--- .../unittest/bundle_manager_helper_test.cpp | 9 ++--- .../mock/mock_bundle_manager_helper.cpp | 3 -- .../test/unittest/mock/mock_event_handler.cpp | 2 - ...notification_preferences_database_test.cpp | 12 ++---- .../notification_preferences_test.cpp | 8 ++-- .../notification_slot_filter_test.cpp | 9 ++--- .../notification_subscriber_manager_test.cpp | 1 - .../test/unittest/permission_filter_test.cpp | 5 +-- services/test/moduletest/ans_module_test.cpp | 9 ++--- .../moduletest/mock/mock_bundle_mgr_proxy.cpp | 1 - .../moduletest/mock/mock_event_handler.cpp | 1 - .../include/ans_slotgroup_test.h | 2 - .../dump/include/notification_shell_command.h | 4 +- tools/dump/src/main.cpp | 1 - 121 files changed, 169 insertions(+), 345 deletions(-) diff --git a/frameworks/ans/core/common/include/ans_const_define.h b/frameworks/ans/core/common/include/ans_const_define.h index 8e1cb00b4..8568a2b3e 100644 --- a/frameworks/ans/core/common/include/ans_const_define.h +++ b/frameworks/ans/core/common/include/ans_const_define.h @@ -22,7 +22,6 @@ namespace OHOS { namespace Notification { - // Max active notification number constexpr uint32_t MAX_ACTIVE_NUM = 1000; constexpr uint32_t MAX_ACTIVE_NUM_PERAPP = 100; diff --git a/frameworks/ans/core/common/include/ans_log_wrapper.h b/frameworks/ans/core/common/include/ans_log_wrapper.h index 3f03294f4..c9543f7ca 100644 --- a/frameworks/ans/core/common/include/ans_log_wrapper.h +++ b/frameworks/ans/core/common/include/ans_log_wrapper.h @@ -22,7 +22,6 @@ namespace OHOS { namespace Notification { - #ifndef LOG_DOMAIN #define LOG_DOMAIN 0xD001800 #endif diff --git a/frameworks/ans/core/include/ans_manager_death_recipient.h b/frameworks/ans/core/include/ans_manager_death_recipient.h index a726115e9..671a4e33d 100644 --- a/frameworks/ans/core/include/ans_manager_death_recipient.h +++ b/frameworks/ans/core/include/ans_manager_death_recipient.h @@ -27,7 +27,6 @@ public: virtual void OnRemoteDied(const wptr &object) override; }; - } // namespace Notification } // namespace OHOS diff --git a/frameworks/ans/core/include/ans_notification.h b/frameworks/ans/core/include/ans_notification.h index 54d481105..f95a82d62 100644 --- a/frameworks/ans/core/include/ans_notification.h +++ b/frameworks/ans/core/include/ans_notification.h @@ -427,7 +427,7 @@ public: * @param bundleOption Indicates the bundle name and uid of the application whose notifications are to be removed. * @return Returns remove notification result. */ - ErrCode RemoveAllNotifications(const NotificationBundleOption &bundleOption); + ErrCode RemoveAllNotifications(const NotificationBundleOption &bundleOption); /** * Removes all removable notifications of a specified bundle. diff --git a/frameworks/ans/core/include/ans_subscriber_proxy.h b/frameworks/ans/core/include/ans_subscriber_proxy.h index ea286a7a9..8739caf27 100644 --- a/frameworks/ans/core/include/ans_subscriber_proxy.h +++ b/frameworks/ans/core/include/ans_subscriber_proxy.h @@ -21,7 +21,6 @@ namespace OHOS { namespace Notification { - class AnsSubscriberProxy : public IRemoteProxy { public: AnsSubscriberProxy() = delete; diff --git a/frameworks/ans/core/include/ans_subscriber_stub.h b/frameworks/ans/core/include/ans_subscriber_stub.h index 403731bf3..26928cd84 100644 --- a/frameworks/ans/core/include/ans_subscriber_stub.h +++ b/frameworks/ans/core/include/ans_subscriber_stub.h @@ -21,7 +21,6 @@ namespace OHOS { namespace Notification { - class AnsSubscriberStub : public IRemoteStub { public: AnsSubscriberStub(); diff --git a/frameworks/ans/core/src/ans_manager_proxy.cpp b/frameworks/ans/core/src/ans_manager_proxy.cpp index 7729d7a7b..f3889d70d 100644 --- a/frameworks/ans/core/src/ans_manager_proxy.cpp +++ b/frameworks/ans/core/src/ans_manager_proxy.cpp @@ -23,7 +23,6 @@ namespace OHOS { namespace Notification { - AnsManagerProxy::AnsManagerProxy(const sptr &impl) : IRemoteProxy(impl) {} @@ -1442,7 +1441,6 @@ ErrCode AnsManagerProxy::GetShowBadgeEnabled(bool &enabled) MessageParcel reply; MessageOption option = {MessageOption::TF_SYNC}; ErrCode result = InnerTransact(GET_SHOW_BADGE_ENABLED, option, data, reply); - if (result != ERR_OK) { ANS_LOGW("[GetShowBadgeEnabled] fail: transact ErrCode=%{public}d", result); return ERR_ANS_TRANSACT_FAILED; @@ -2009,6 +2007,5 @@ bool AnsManagerProxy::ReadParcelableVector(std::vector> &parcelableInfos return true; } - } // namespace Notification } // namespace OHOS diff --git a/frameworks/ans/core/src/ans_manager_stub.cpp b/frameworks/ans/core/src/ans_manager_stub.cpp index 20a8c87d0..ea74077f4 100644 --- a/frameworks/ans/core/src/ans_manager_stub.cpp +++ b/frameworks/ans/core/src/ans_manager_stub.cpp @@ -23,7 +23,6 @@ namespace OHOS { namespace Notification { - const std::map> AnsManagerStub::interfaces_ = { {AnsManagerStub::PUBLISH_NOTIFICATION, @@ -249,7 +248,6 @@ ErrCode AnsManagerStub::HandlePublish(MessageParcel &data, MessageParcel &reply) } ErrCode result = Publish(label, notification); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandlePublish] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -272,7 +270,6 @@ ErrCode AnsManagerStub::HandlePublishToDevice(MessageParcel &data, MessageParcel } ErrCode result = PublishToDevice(notification, deviceId); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandlePublishToDevice] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -295,7 +292,6 @@ ErrCode AnsManagerStub::HandleCancel(MessageParcel &data, MessageParcel &reply) } ErrCode result = Cancel(notificationId, label); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleCancel] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -306,7 +302,6 @@ ErrCode AnsManagerStub::HandleCancel(MessageParcel &data, MessageParcel &reply) ErrCode AnsManagerStub::HandleCancelAll(MessageParcel &data, MessageParcel &reply) { ErrCode result = CancelAll(); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleCancelAll] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -317,9 +312,7 @@ ErrCode AnsManagerStub::HandleCancelAll(MessageParcel &data, MessageParcel &repl ErrCode AnsManagerStub::HandleAddSlotByType(MessageParcel &data, MessageParcel &reply) { NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); - ErrCode result = AddSlotByType(slotType); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleAddSlotByType] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -349,7 +342,6 @@ ErrCode AnsManagerStub::HandleRemoveSlotByType(MessageParcel &data, MessageParce NotificationConstant::SlotType slotType = static_cast(data.ReadInt32()); ErrCode result = RemoveSlotByType(slotType); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleRemoveSlotByType] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -360,7 +352,6 @@ ErrCode AnsManagerStub::HandleRemoveSlotByType(MessageParcel &data, MessageParce ErrCode AnsManagerStub::HandleRemoveAllSlots(MessageParcel &data, MessageParcel &reply) { ErrCode result = RemoveAllSlots(); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleRemoveAllSlots] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -377,7 +368,6 @@ ErrCode AnsManagerStub::HandleAddSlotGroups(MessageParcel &data, MessageParcel & } ErrCode result = AddSlotGroups(groups); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleAddSlotGroups] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -389,7 +379,6 @@ ErrCode AnsManagerStub::HandleGetSlots(MessageParcel &data, MessageParcel &reply { std::vector> slots; ErrCode result = GetSlots(slots); - if (!WriteParcelableVector(slots, reply, result)) { ANS_LOGW("[HandleGetSlots] fail: write slots failed"); return ERR_ANS_PARCELABLE_FAILED; @@ -404,7 +393,6 @@ ErrCode AnsManagerStub::HandleGetSlotByType(MessageParcel &data, MessageParcel & sptr slot; ErrCode result = GetSlotByType(slotType, slot); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetSlotByType] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -427,7 +415,6 @@ ErrCode AnsManagerStub::HandleGetSlotGroup(MessageParcel &data, MessageParcel &r sptr group; ErrCode result = GetSlotGroup(groupId, group); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetSlotGroup] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -444,7 +431,6 @@ ErrCode AnsManagerStub::HandleGetSlotGroups(MessageParcel &data, MessageParcel & { std::vector> groups; ErrCode result = GetSlotGroups(groups); - if (!WriteParcelableVector(groups, reply, result)) { ANS_LOGW("[HandleGetSlotGroups] fail: write groups failed"); return ERR_ANS_PARCELABLE_FAILED; @@ -484,7 +470,6 @@ ErrCode AnsManagerStub::HandleRemoveSlotGroups(MessageParcel &data, MessageParce } ErrCode result = RemoveSlotGroups(groupIds); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleRemoveSlotGroups] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -496,7 +481,6 @@ ErrCode AnsManagerStub::HandleGetActiveNotifications(MessageParcel &data, Messag { std::vector> notifications; ErrCode result = GetActiveNotifications(notifications); - if (!WriteParcelableVector(notifications, reply, result)) { ANS_LOGW("[HandleGetActiveNotifications] fail: write notifications failed"); return ERR_ANS_PARCELABLE_FAILED; @@ -508,7 +492,6 @@ ErrCode AnsManagerStub::HandleGetActiveNotificationNums(MessageParcel &data, Mes { int num = 0; ErrCode result = GetActiveNotificationNums(num); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetActiveNotificationNums] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -525,7 +508,6 @@ ErrCode AnsManagerStub::HandleGetAllActiveNotifications(MessageParcel &data, Mes { std::vector> notifications; ErrCode result = GetAllActiveNotifications(notifications); - if (!WriteParcelableVector(notifications, reply, result)) { ANS_LOGW("[HandleGetAllActiveNotifications] fail: write notifications failed"); return ERR_ANS_PARCELABLE_FAILED; @@ -543,7 +525,6 @@ ErrCode AnsManagerStub::HandleGetSpecialActiveNotifications(MessageParcel &data, std::vector> notifications; ErrCode result = GetSpecialActiveNotifications(key, notifications); - if (!WriteParcelableVector(notifications, reply, result)) { ANS_LOGW("[HandleGetSpecialActiveNotifications] fail: write notifications failed"); return ERR_ANS_PARCELABLE_FAILED; @@ -571,7 +552,6 @@ ErrCode AnsManagerStub::HandleGetNotificationAgent(MessageParcel &data, MessageP { std::string agent; ErrCode result = GetNotificationAgent(agent); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetNotificationAgent] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -595,7 +575,6 @@ ErrCode AnsManagerStub::HandleCanPublishAsBundle(MessageParcel &data, MessagePar bool canPublish = false; ErrCode result = CanPublishAsBundle(representativeBundle, canPublish); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleCanPublishAsBundle] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -651,7 +630,6 @@ ErrCode AnsManagerStub::HandleGetBundleImportance(MessageParcel &data, MessagePa { int importance = 0; ErrCode result = GetBundleImportance(importance); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetBundleImportance] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -673,7 +651,6 @@ ErrCode AnsManagerStub::HandleSetDoNotDisturbDate(MessageParcel &data, MessagePa } ErrCode result = SetDoNotDisturbDate(date); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleSetDoNotDisturbDate] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -687,7 +664,6 @@ ErrCode AnsManagerStub::HandleGetDoNotDisturbDate(MessageParcel &data, MessagePa sptr date = nullptr; ErrCode result = GetDoNotDisturbDate(date); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleSetDoNotDisturbDate] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -708,7 +684,6 @@ ErrCode AnsManagerStub::HandleDoesSupportDoNotDisturbMode(MessageParcel &data, M bool support = false; ErrCode result = DoesSupportDoNotDisturbMode(support); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleDoesSupportDoNotDisturbMode] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -731,7 +706,6 @@ ErrCode AnsManagerStub::HandlePublishContinuousTaskNotification(MessageParcel &d } ErrCode result = PublishContinuousTaskNotification(request); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandlePublishContinuousTaskNotification] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -754,7 +728,6 @@ ErrCode AnsManagerStub::HandleCancelContinuousTaskNotification(MessageParcel &da } ErrCode result = CancelContinuousTaskNotification(label, notificationId); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleCancelContinuousTaskNotification] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -766,7 +739,6 @@ ErrCode AnsManagerStub::HandleIsNotificationPolicyAccessGranted(MessageParcel &d { bool granted = false; ErrCode result = HasNotificationPolicyAccessPermission(granted); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleIsNotificationPolicyAccessGranted] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1058,7 +1030,6 @@ ErrCode AnsManagerStub::HandleGetShowBadgeEnabledForBundle(MessageParcel &data, bool enabled = false; ErrCode result = GetShowBadgeEnabledForBundle(bundleOption, enabled); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetShowBadgeEnabledForBundle] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1075,7 +1046,6 @@ ErrCode AnsManagerStub::HandleGetShowBadgeEnabled(MessageParcel &data, MessagePa { bool enabled = false; ErrCode result = GetShowBadgeEnabled(enabled); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetShowBadgeEnabled] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1154,7 +1124,6 @@ ErrCode AnsManagerStub::HandleAreNotificationsSuspended(MessageParcel &data, Mes { bool suspended = false; ErrCode result = AreNotificationsSuspended(suspended); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleAreNotificationsSuspended] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1171,7 +1140,6 @@ ErrCode AnsManagerStub::HandleGetCurrentAppSorting(MessageParcel &data, MessageP { sptr sortingMap; ErrCode result = GetCurrentAppSorting(sortingMap); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetCurrentAppSorting] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1188,7 +1156,6 @@ ErrCode AnsManagerStub::HandleIsAllowedNotify(MessageParcel &data, MessageParcel { bool allowed = false; ErrCode result = IsAllowedNotify(allowed); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleIsAllowedNotify] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1211,7 +1178,6 @@ ErrCode AnsManagerStub::HandleIsSpecialBundleAllowedNotify(MessageParcel &data, bool allowed = false; ErrCode result = IsSpecialBundleAllowedNotify(bundleOption, allowed); - if (!reply.WriteInt32(result)) { ANS_LOGW("[IsSpecialBundleAllowedNotify] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1233,7 +1199,6 @@ ErrCode AnsManagerStub::HandleCancelGroup(MessageParcel &data, MessageParcel &re } ErrCode result = CancelGroup(groupName); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleCancelGroup] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1256,7 +1221,6 @@ ErrCode AnsManagerStub::HandleRemoveGroupByBundle(MessageParcel &data, MessagePa } ErrCode result = RemoveGroupByBundle(bundleOption, groupName); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleRemoveGroupByBundle] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; @@ -1274,7 +1238,6 @@ ErrCode AnsManagerStub::HandleShellDump(MessageParcel &data, MessageParcel &repl std::vector notificationsInfo; ErrCode result = ShellDump(dumpOption, notificationsInfo); - if (!reply.WriteInt32(result)) { ANS_LOGW("[HandleGetRecentNotificationsInfo] fail: write result failed, ErrCode=%{public}d", result); return ERR_ANS_PARCELABLE_FAILED; diff --git a/frameworks/ans/core/src/ans_notification.cpp b/frameworks/ans/core/src/ans_notification.cpp index 7171c3879..2e8b48018 100644 --- a/frameworks/ans/core/src/ans_notification.cpp +++ b/frameworks/ans/core/src/ans_notification.cpp @@ -14,7 +14,6 @@ */ #include "ans_notification.h" -#include #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" diff --git a/frameworks/ans/core/src/ans_subscriber_proxy.cpp b/frameworks/ans/core/src/ans_subscriber_proxy.cpp index b1abfafed..1952b3f6b 100644 --- a/frameworks/ans/core/src/ans_subscriber_proxy.cpp +++ b/frameworks/ans/core/src/ans_subscriber_proxy.cpp @@ -274,6 +274,5 @@ void AnsSubscriberProxy::OnDoNotDisturbDateChange(const sptr #include "ans_subscriber_stub.h" @@ -216,6 +215,5 @@ void AnsSubscriberStub::OnUpdated(const sptr ¬ificati void AnsSubscriberStub::OnDoNotDisturbDateChange(const sptr &date) {} - } // namespace Notification } // namespace OHOS diff --git a/frameworks/ans/native/src/notification.cpp b/frameworks/ans/native/src/notification.cpp index 100e12220..77b1f58b4 100644 --- a/frameworks/ans/native/src/notification.cpp +++ b/frameworks/ans/native/src/notification.cpp @@ -15,13 +15,12 @@ #include "notification.h" -#include #include "ans_log_wrapper.h" namespace OHOS { namespace Notification { -Notification::Notification(){}; +Notification::Notification() {}; Notification::Notification(const sptr &request) { @@ -445,6 +444,5 @@ std::string Notification::Dump() const } return dump; } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/frameworks/ans/native/src/notification_action_button.cpp b/frameworks/ans/native/src/notification_action_button.cpp index 4c114748e..94cd2a724 100644 --- a/frameworks/ans/native/src/notification_action_button.cpp +++ b/frameworks/ans/native/src/notification_action_button.cpp @@ -15,7 +15,6 @@ #include "notification_action_button.h" -#include #include "ans_log_wrapper.h" namespace OHOS { @@ -34,7 +33,6 @@ std::shared_ptr NotificationActionButton::Create(const auto realExtras = extras; if (!realExtras) { realExtras = std::make_shared(); - if (!realExtras) { ANS_LOGE("create PacMap object failed"); return {}; @@ -289,7 +287,7 @@ bool NotificationActionButton::Marshalling(Parcel &parcel) const NotificationActionButton *NotificationActionButton::Unmarshalling(Parcel &parcel) { auto pButton = new NotificationActionButton(); - if ((nullptr != pButton) && !pButton->ReadFromParcel(parcel)) { + if ((pButton != nullptr) && !pButton->ReadFromParcel(parcel)) { delete pButton; pButton = nullptr; } @@ -345,7 +343,7 @@ bool NotificationActionButton::ReadFromParcel(Parcel &parcel) NotificationUserInput *member {nullptr}; if (valid) { member = parcel.ReadParcelable(); - if (nullptr == member) { + if (member == nullptr) { ANS_LOGE("Failed to read userInput"); return false; } diff --git a/frameworks/ans/native/src/notification_bundle_option.cpp b/frameworks/ans/native/src/notification_bundle_option.cpp index b5adae94e..4269aca2b 100644 --- a/frameworks/ans/native/src/notification_bundle_option.cpp +++ b/frameworks/ans/native/src/notification_bundle_option.cpp @@ -18,7 +18,8 @@ namespace OHOS { namespace Notification { -NotificationBundleOption::NotificationBundleOption(const std::string &bundleName, const int32_t uid) : bundleName_(bundleName), uid_(uid) +NotificationBundleOption::NotificationBundleOption(const std::string &bundleName, const int32_t uid) + : bundleName_(bundleName), uid_(uid) {} NotificationBundleOption::~NotificationBundleOption() diff --git a/frameworks/ans/native/src/notification_constant.cpp b/frameworks/ans/native/src/notification_constant.cpp index 43f23d63c..5637d588d 100644 --- a/frameworks/ans/native/src/notification_constant.cpp +++ b/frameworks/ans/native/src/notification_constant.cpp @@ -18,6 +18,5 @@ namespace OHOS { namespace Notification { const std::string NotificationConstant::EXTRA_INPUTS_SOURCE {"notification_user_input_source"}; - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/frameworks/ans/native/src/notification_content.cpp b/frameworks/ans/native/src/notification_content.cpp index 1accb1daa..5f302bb59 100644 --- a/frameworks/ans/native/src/notification_content.cpp +++ b/frameworks/ans/native/src/notification_content.cpp @@ -136,7 +136,7 @@ bool NotificationContent::Marshalling(Parcel &parcel) const NotificationContent *NotificationContent::Unmarshalling(Parcel &parcel) { auto pContent = new NotificationContent(); - if ((nullptr != pContent) && !pContent->ReadFromParcel(parcel)) { + if ((pContent != nullptr) && !pContent->ReadFromParcel(parcel)) { delete pContent; pContent = nullptr; } @@ -162,7 +162,8 @@ bool NotificationContent::ReadFromParcel(Parcel &parcel) return false; } content_ = std::dynamic_pointer_cast(normalContent); - } break; + break; + } case NotificationContent::Type::CONVERSATION: { std::shared_ptr conversationalContent( parcel.ReadParcelable()); @@ -171,7 +172,8 @@ bool NotificationContent::ReadFromParcel(Parcel &parcel) return false; } content_ = std::dynamic_pointer_cast(conversationalContent); - } break; + break; + } case NotificationContent::Type::LONG_TEXT: { std::shared_ptr longTextContent( parcel.ReadParcelable()); @@ -180,7 +182,8 @@ bool NotificationContent::ReadFromParcel(Parcel &parcel) return false; } content_ = std::dynamic_pointer_cast(longTextContent); - } break; + break; + } case NotificationContent::Type::MEDIA: { std::shared_ptr mediaContent(parcel.ReadParcelable()); if (!mediaContent) { @@ -188,7 +191,8 @@ bool NotificationContent::ReadFromParcel(Parcel &parcel) return false; } content_ = std::dynamic_pointer_cast(mediaContent); - } break; + break; + } case NotificationContent::Type::MULTILINE: { std::shared_ptr multiLineContent( parcel.ReadParcelable()); @@ -197,7 +201,8 @@ bool NotificationContent::ReadFromParcel(Parcel &parcel) return false; } content_ = std::dynamic_pointer_cast(multiLineContent); - } break; + break; + } case NotificationContent::Type::PICTURE: { std::shared_ptr pictureContent( parcel.ReadParcelable()); @@ -206,10 +211,11 @@ bool NotificationContent::ReadFromParcel(Parcel &parcel) return false; } content_ = std::dynamic_pointer_cast(pictureContent); - } break; + break; + } default: { return false; - } break; + } } return true; diff --git a/frameworks/ans/native/src/notification_conversational_content.cpp b/frameworks/ans/native/src/notification_conversational_content.cpp index 2b1925d84..102a98424 100644 --- a/frameworks/ans/native/src/notification_conversational_content.cpp +++ b/frameworks/ans/native/src/notification_conversational_content.cpp @@ -133,7 +133,7 @@ bool NotificationConversationalContent::Marshalling(Parcel &parcel) const NotificationConversationalContent *NotificationConversationalContent::Unmarshalling(Parcel &parcel) { auto pContent = new NotificationConversationalContent(); - if ((nullptr != pContent) && !pContent->ReadFromParcel(parcel)) { + if ((pContent != nullptr) && !pContent->ReadFromParcel(parcel)) { delete pContent; pContent = nullptr; } diff --git a/frameworks/ans/native/src/notification_conversational_message.cpp b/frameworks/ans/native/src/notification_conversational_message.cpp index 9274ef8aa..139826a7c 100644 --- a/frameworks/ans/native/src/notification_conversational_message.cpp +++ b/frameworks/ans/native/src/notification_conversational_message.cpp @@ -102,7 +102,7 @@ bool NotificationConversationalMessage::Marshalling(Parcel &parcel) const NotificationConversationalMessage *NotificationConversationalMessage::Unmarshalling(Parcel &parcel) { auto pMessage = new NotificationConversationalMessage(); - if ((nullptr != pMessage) && !pMessage->ReadFromParcel(parcel)) { + if ((pMessage != nullptr) && !pMessage->ReadFromParcel(parcel)) { delete pMessage; pMessage = nullptr; } diff --git a/frameworks/ans/native/src/notification_long_text_content.cpp b/frameworks/ans/native/src/notification_long_text_content.cpp index c806df2ef..1ce547bbd 100644 --- a/frameworks/ans/native/src/notification_long_text_content.cpp +++ b/frameworks/ans/native/src/notification_long_text_content.cpp @@ -13,9 +13,8 @@ * limitations under the License. */ -#include -#include "notification_long_text_content.h" #include "ans_log_wrapper.h" +#include "notification_long_text_content.h" namespace OHOS { namespace Notification { @@ -97,7 +96,7 @@ bool NotificationLongTextContent::Marshalling(Parcel &parcel) const NotificationLongTextContent *NotificationLongTextContent::Unmarshalling(Parcel &parcel) { auto pContent = new NotificationLongTextContent(); - if ((nullptr != pContent) && !pContent->ReadFromParcel(parcel)) { + if ((pContent != nullptr) && !pContent->ReadFromParcel(parcel)) { delete pContent; pContent = nullptr; } diff --git a/frameworks/ans/native/src/notification_media_content.cpp b/frameworks/ans/native/src/notification_media_content.cpp index d66b8bc7a..252240bc4 100644 --- a/frameworks/ans/native/src/notification_media_content.cpp +++ b/frameworks/ans/native/src/notification_media_content.cpp @@ -13,9 +13,8 @@ * limitations under the License. */ -#include -#include "notification_media_content.h" #include "ans_log_wrapper.h" +#include "notification_media_content.h" namespace OHOS { namespace Notification { @@ -68,7 +67,7 @@ bool NotificationMediaContent::Marshalling(Parcel &parcel) const NotificationMediaContent *NotificationMediaContent::Unmarshalling(Parcel &parcel) { auto pContent = new NotificationMediaContent(); - if ((nullptr != pContent) && !pContent->ReadFromParcel(parcel)) { + if ((pContent != nullptr) && !pContent->ReadFromParcel(parcel)) { delete pContent; pContent = nullptr; } diff --git a/frameworks/ans/native/src/notification_multiline_content.cpp b/frameworks/ans/native/src/notification_multiline_content.cpp index abd88be57..d20acf486 100644 --- a/frameworks/ans/native/src/notification_multiline_content.cpp +++ b/frameworks/ans/native/src/notification_multiline_content.cpp @@ -14,8 +14,8 @@ */ #include -#include "notification_multiline_content.h" #include "ans_log_wrapper.h" +#include "notification_multiline_content.h" namespace OHOS { namespace Notification { @@ -95,7 +95,7 @@ bool NotificationMultiLineContent::Marshalling(Parcel &parcel) const NotificationMultiLineContent *NotificationMultiLineContent::Unmarshalling(Parcel &parcel) { auto pContent = new NotificationMultiLineContent(); - if ((nullptr != pContent) && !pContent->ReadFromParcel(parcel)) { + if ((pContent != nullptr) && !pContent->ReadFromParcel(parcel)) { delete pContent; pContent = nullptr; } diff --git a/frameworks/ans/native/src/notification_normal_content.cpp b/frameworks/ans/native/src/notification_normal_content.cpp index e9e253789..481c1aa9c 100644 --- a/frameworks/ans/native/src/notification_normal_content.cpp +++ b/frameworks/ans/native/src/notification_normal_content.cpp @@ -30,7 +30,7 @@ bool NotificationNormalContent::Marshalling(Parcel &parcel) const NotificationNormalContent *NotificationNormalContent::Unmarshalling(Parcel &parcel) { auto pContent = new NotificationNormalContent(); - if ((nullptr != pContent) && !pContent->ReadFromParcel(parcel)) { + if ((pContent != nullptr) && !pContent->ReadFromParcel(parcel)) { delete pContent; pContent = nullptr; } diff --git a/frameworks/ans/native/src/notification_picture_content.cpp b/frameworks/ans/native/src/notification_picture_content.cpp index 9138938cb..b2aa8af66 100644 --- a/frameworks/ans/native/src/notification_picture_content.cpp +++ b/frameworks/ans/native/src/notification_picture_content.cpp @@ -90,7 +90,7 @@ bool NotificationPictureContent::Marshalling(Parcel &parcel) const NotificationPictureContent *NotificationPictureContent::Unmarshalling(Parcel &parcel) { auto pContent = new NotificationPictureContent(); - if ((nullptr != pContent) && !pContent->ReadFromParcel(parcel)) { + if ((pContent != nullptr) && !pContent->ReadFromParcel(parcel)) { delete pContent; pContent = nullptr; } diff --git a/frameworks/ans/native/src/notification_request.cpp b/frameworks/ans/native/src/notification_request.cpp index 1ea18d3c0..a3898fcda 100644 --- a/frameworks/ans/native/src/notification_request.cpp +++ b/frameworks/ans/native/src/notification_request.cpp @@ -13,10 +13,8 @@ * limitations under the License. */ -#include -#include -#include "notification_request.h" #include "ans_log_wrapper.h" +#include "notification_request.h" namespace OHOS { namespace Notification { @@ -271,7 +269,7 @@ int64_t NotificationRequest::GetDeliveryTime() const bool NotificationRequest::IsShowDeliveryTime() const { - return (0 != deliveryTime_) && showDeliveryTime_; + return (deliveryTime_ != 0) && showDeliveryTime_; } void NotificationRequest::SetShowDeliveryTime(bool showDeliveryTime) @@ -653,7 +651,7 @@ const std::shared_ptr NotificationRequest::GetPublicNotific std::string NotificationRequest::GetNotificationHashCode() const { - if (creatorBundleName_.empty() || (0 == creatorUid_) || ownerBundleName_.empty()) { + if (creatorBundleName_.empty() || (creatorUid_ == 0) || ownerBundleName_.empty()) { return ""; } @@ -1090,7 +1088,7 @@ bool NotificationRequest::Marshalling(Parcel &parcel) const NotificationRequest *NotificationRequest::Unmarshalling(Parcel &parcel) { auto objptr = new NotificationRequest(); - if ((nullptr != objptr) && !objptr->ReadFromParcel(parcel)) { + if ((objptr != nullptr) && !objptr->ReadFromParcel(parcel)) { delete objptr; objptr = nullptr; } @@ -1254,7 +1252,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) auto vsize = parcel.ReadInt32(); for (auto it = 0; it < vsize; ++it) { auto member = parcel.ReadParcelable(); - if (nullptr == member) { + if (member == nullptr) { ANS_LOGE("Failed to read actionButton"); return false; } @@ -1265,7 +1263,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) vsize = parcel.ReadInt32(); for (auto it = 0; it < vsize; ++it) { auto member = parcel.ReadParcelable(); - if (nullptr == member) { + if (member == nullptr) { ANS_LOGE("Failed to read messageUser"); return false; } diff --git a/frameworks/ans/native/src/notification_slot.cpp b/frameworks/ans/native/src/notification_slot.cpp index a54224d44..00f7a5b7c 100644 --- a/frameworks/ans/native/src/notification_slot.cpp +++ b/frameworks/ans/native/src/notification_slot.cpp @@ -19,7 +19,6 @@ namespace OHOS { namespace Notification { - const int MAX_TEXT_LENGTH = 1000; NotificationSlot::NotificationSlot(NotificationConstant::SlotType type) : sound_("") diff --git a/frameworks/ans/native/src/notification_slot_group.cpp b/frameworks/ans/native/src/notification_slot_group.cpp index 5f06ffc53..89720f812 100644 --- a/frameworks/ans/native/src/notification_slot_group.cpp +++ b/frameworks/ans/native/src/notification_slot_group.cpp @@ -137,7 +137,7 @@ bool NotificationSlotGroup::ReadFromParcel(Parcel &parcel) if (size) { for (int32_t i = 0; i < size; ++i) { auto slot = parcel.ReadParcelable(); - if (nullptr == slot) { + if (slot == nullptr) { ANS_LOGE("Failed to read slot"); return false; } diff --git a/frameworks/ans/native/src/notification_subscribe_info.cpp b/frameworks/ans/native/src/notification_subscribe_info.cpp index 542404270..7f4239874 100644 --- a/frameworks/ans/native/src/notification_subscribe_info.cpp +++ b/frameworks/ans/native/src/notification_subscribe_info.cpp @@ -19,7 +19,6 @@ namespace OHOS { namespace Notification { - NotificationSubscribeInfo::NotificationSubscribeInfo() {} @@ -77,6 +76,5 @@ std::string NotificationSubscribeInfo::Dump() { return "Dump"; } - } // namespace Notification } // namespace OHOS diff --git a/frameworks/ans/native/src/notification_subscriber.cpp b/frameworks/ans/native/src/notification_subscriber.cpp index 62e2c09e6..d1be62359 100644 --- a/frameworks/ans/native/src/notification_subscriber.cpp +++ b/frameworks/ans/native/src/notification_subscriber.cpp @@ -20,7 +20,6 @@ namespace OHOS { namespace Notification { - NotificationSubscriber::NotificationSubscriber() { impl_ = new SubscriberImpl(*this); @@ -110,7 +109,7 @@ bool NotificationSubscriber::SubscriberImpl::GetAnsManagerProxy() } proxy_ = iface_cast(remoteObject); - if ((nullptr == proxy_) || (nullptr == proxy_->AsObject())) { + if ((proxy_ == nullptr) || (proxy_->AsObject() == nullptr)) { return false; } } @@ -120,15 +119,14 @@ bool NotificationSubscriber::SubscriberImpl::GetAnsManagerProxy() } NotificationSubscriber::SubscriberImpl::DeathRecipient::DeathRecipient(SubscriberImpl &subscriberImpl) - : subscriberImpl_(subscriberImpl){}; + : subscriberImpl_(subscriberImpl) {}; -NotificationSubscriber::SubscriberImpl::DeathRecipient::~DeathRecipient(){}; +NotificationSubscriber::SubscriberImpl::DeathRecipient::~DeathRecipient() {}; void NotificationSubscriber::SubscriberImpl::DeathRecipient::OnRemoteDied(const wptr &object) { subscriberImpl_.proxy_ = nullptr; subscriberImpl_.subscriber_.OnDied(); } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/frameworks/ans/native/src/notification_user_input.cpp b/frameworks/ans/native/src/notification_user_input.cpp index 0115c3ba4..e8ed66a0f 100644 --- a/frameworks/ans/native/src/notification_user_input.cpp +++ b/frameworks/ans/native/src/notification_user_input.cpp @@ -15,7 +15,6 @@ #include "notification_user_input.h" -#include #include "ans_log_wrapper.h" namespace OHOS { @@ -281,7 +280,7 @@ bool NotificationUserInput::Marshalling(Parcel &parcel) const NotificationUserInput *NotificationUserInput::Unmarshalling(Parcel &parcel) { auto pUserInput = new NotificationUserInput(); - if ((nullptr != pUserInput) && !pUserInput->ReadFromParcel(parcel)) { + if ((pUserInput != nullptr) && !pUserInput->ReadFromParcel(parcel)) { delete pUserInput; pUserInput = nullptr; } diff --git a/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp b/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp index aae3d31d7..65a4ab2e7 100644 --- a/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp +++ b/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp @@ -32,7 +32,6 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - static sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); bool OnConsumedReceived = false; @@ -67,7 +66,7 @@ std::mutex g_send_finished_mtx; AAFwk::Want g_want; const time_t TIME_OUT_SECONDS_LIMIT = 5; -const std::string CLASSIFICATION_ALARM{"alarm"}; +const std::string CLASSIFICATION_ALARM {"alarm"}; class TestAnsSubscriber : public NotificationSubscriber { public: diff --git a/frameworks/ans/test/moduletest/ans_innerkits_module_setting_test.cpp b/frameworks/ans/test/moduletest/ans_innerkits_module_setting_test.cpp index 98a38c06f..4a16ba62f 100644 --- a/frameworks/ans/test/moduletest/ans_innerkits_module_setting_test.cpp +++ b/frameworks/ans/test/moduletest/ans_innerkits_module_setting_test.cpp @@ -28,7 +28,6 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - static sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); const int32_t CALLING_UID = 9998; @@ -73,7 +72,7 @@ HWTEST_F(AnsInterfaceModuleSettingTest, ANS_Interface_MT_NotificationSetting_001 EXPECT_EQ(0, NotificationHelper::SetShowBadgeEnabledForBundle(bundleOption, true)); bool enabled = false; EXPECT_EQ(0, NotificationHelper::GetShowBadgeEnabledForBundle(bundleOption, enabled)); - EXPECT_EQ(true,enabled); + EXPECT_EQ(true, enabled); EXPECT_EQ("bundlename", bundleOption.GetBundleName()); EXPECT_EQ(CALLING_UID, bundleOption.GetUid()); } @@ -91,7 +90,7 @@ HWTEST_F(AnsInterfaceModuleSettingTest, ANS_Interface_MT_NotificationSetting_002 EXPECT_EQ(0, NotificationHelper::SetShowBadgeEnabledForBundle(bundleOption, false)); bool enabled = false; EXPECT_EQ(0, NotificationHelper::GetShowBadgeEnabledForBundle(bundleOption, enabled)); - EXPECT_EQ(false,enabled); + EXPECT_EQ(false, enabled); EXPECT_EQ("bundlename", bundleOption.GetBundleName()); EXPECT_EQ(CALLING_UID, bundleOption.GetUid()); } @@ -111,7 +110,7 @@ HWTEST_F(AnsInterfaceModuleSettingTest, ANS_Interface_MT_NotificationSetting_003 EXPECT_EQ(0, NotificationHelper::SetNotificationsEnabledForSpecifiedBundle(bundleOption, deviceId, true)); bool enabled = false; EXPECT_EQ(0, NotificationHelper::IsAllowedNotify(bundleOption, enabled)); - EXPECT_EQ(true,enabled); + EXPECT_EQ(true, enabled); EXPECT_EQ("bundlename", bundleOption.GetBundleName()); EXPECT_EQ(CALLING_UID, bundleOption.GetUid()); } @@ -119,8 +118,8 @@ HWTEST_F(AnsInterfaceModuleSettingTest, ANS_Interface_MT_NotificationSetting_003 /** * @tc.number : ANS_Interface_MT_NotificationSetting_00400 * @tc.name : NotificationSetting_00400 - * @tc.desc : Set a specified application do not publish notification, get the specified application can not publish - * notification. + * @tc.desc : Set a specified application do not publish notification, get the specified application can not + * publish notification. * @tc.expected : Set a specified application do not publish notification success, get the specified application can * not publish notification. */ @@ -131,7 +130,7 @@ HWTEST_F(AnsInterfaceModuleSettingTest, ANS_Interface_MT_NotificationSetting_004 EXPECT_EQ(0, NotificationHelper::SetNotificationsEnabledForSpecifiedBundle(bundleOption, deviceId, false)); bool enabled = false; EXPECT_EQ(0, NotificationHelper::IsAllowedNotify(bundleOption, enabled)); - EXPECT_EQ(false,enabled); + EXPECT_EQ(false, enabled); EXPECT_EQ("bundlename", bundleOption.GetBundleName()); EXPECT_EQ(CALLING_UID, bundleOption.GetUid()); } diff --git a/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp b/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp index caef96a20..31675f210 100644 --- a/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp +++ b/frameworks/ans/test/moduletest/ans_innerkits_module_slot_test.cpp @@ -29,7 +29,6 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - static sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); const int32_t CALLING_UID = 9998; diff --git a/frameworks/ans/test/moduletest/mock/mock_bundle_mgr_proxy.cpp b/frameworks/ans/test/moduletest/mock/mock_bundle_mgr_proxy.cpp index cd58a4838..6bcdb3b57 100644 --- a/frameworks/ans/test/moduletest/mock/mock_bundle_mgr_proxy.cpp +++ b/frameworks/ans/test/moduletest/mock/mock_bundle_mgr_proxy.cpp @@ -24,7 +24,6 @@ namespace OHOS { namespace AppExecFwk { - BundleMgrProxy::BundleMgrProxy(const sptr &impl) : IRemoteProxy(impl) { } @@ -277,6 +276,5 @@ bool BundleMgrProxy::SendTransactCmd(IBundleMgr::Message code, MessageParcel &da { return true; } - } // namespace AppExecFwk } // namespace OHOS diff --git a/frameworks/ans/test/moduletest/mock/mock_event_handler.cpp b/frameworks/ans/test/moduletest/mock/mock_event_handler.cpp index 12a7f65b9..bbbeb4907 100644 --- a/frameworks/ans/test/moduletest/mock/mock_event_handler.cpp +++ b/frameworks/ans/test/moduletest/mock/mock_event_handler.cpp @@ -15,7 +15,6 @@ #include "event_handler.h" #include "event_handler_utils.h" -#include namespace OHOS { namespace AppExecFwk { diff --git a/frameworks/ans/test/moduletest/mock/mock_message_parcel.cpp b/frameworks/ans/test/moduletest/mock/mock_message_parcel.cpp index 26b6304c7..49c18fba8 100644 --- a/frameworks/ans/test/moduletest/mock/mock_message_parcel.cpp +++ b/frameworks/ans/test/moduletest/mock/mock_message_parcel.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "message_parcel.h" #include #include +#include "message_parcel.h" #include "ipc_debug.h" #include "iremote_object.h" diff --git a/frameworks/ans/test/moduletest/mock/mock_single_kv_store.cpp b/frameworks/ans/test/moduletest/mock/mock_single_kv_store.cpp index bc79b1906..e246e8d99 100644 --- a/frameworks/ans/test/moduletest/mock/mock_single_kv_store.cpp +++ b/frameworks/ans/test/moduletest/mock/mock_single_kv_store.cpp @@ -18,7 +18,6 @@ namespace OHOS { namespace DistributedKv { - Status AnsTestSingleKvStore::GetEntries(const Key &prefixKey, std::vector &entries) const { return Status::SUCCESS; diff --git a/frameworks/wantagent/src/pending_want.cpp b/frameworks/wantagent/src/pending_want.cpp index 926dbfc2d..56e1e4c96 100644 --- a/frameworks/wantagent/src/pending_want.cpp +++ b/frameworks/wantagent/src/pending_want.cpp @@ -408,5 +408,4 @@ PendingWant *PendingWant::Unmarshalling(Parcel &parcel) return pendingWant; } - } // namespace OHOS::Notification::WantAgent diff --git a/frameworks/wantagent/src/want_agent_log_wrapper.cpp b/frameworks/wantagent/src/want_agent_log_wrapper.cpp index 059ffb295..e379cef23 100644 --- a/frameworks/wantagent/src/want_agent_log_wrapper.cpp +++ b/frameworks/wantagent/src/want_agent_log_wrapper.cpp @@ -14,7 +14,6 @@ */ #include "want_agent_log_wrapper.h" -#include namespace OHOS::Notification::WantAgent { // initial static member object diff --git a/interfaces/innerkits/ans/native/include/message_user.h b/interfaces/innerkits/ans/native/include/message_user.h index 0e7717dda..7c8dbda6a 100644 --- a/interfaces/innerkits/ans/native/include/message_user.h +++ b/interfaces/innerkits/ans/native/include/message_user.h @@ -150,12 +150,12 @@ private: bool ReadFromParcel(Parcel &parcel); private: - std::string key_{}; - std::string name_{}; - std::shared_ptr pixelMap_{nullptr}; + std::string key_ {}; + std::string name_ {}; + std::shared_ptr pixelMap_ {nullptr}; Uri uri_; - bool isMachine_{false}; - bool isUserImportant_{false}; + bool isMachine_ {false}; + bool isUserImportant_ {false}; // no object in parcel static constexpr int VALUE_NULL = -1; diff --git a/interfaces/innerkits/ans/native/include/notification.h b/interfaces/innerkits/ans/native/include/notification.h index 1b125e4fe..7503e15b1 100644 --- a/interfaces/innerkits/ans/native/include/notification.h +++ b/interfaces/innerkits/ans/native/include/notification.h @@ -25,7 +25,6 @@ namespace OHOS { namespace Notification { - class Notification final : public Parcelable { public: /** diff --git a/interfaces/innerkits/ans/native/include/notification_bundle_option.h b/interfaces/innerkits/ans/native/include/notification_bundle_option.h index 7c2fa9171..4ea4fb03c 100644 --- a/interfaces/innerkits/ans/native/include/notification_bundle_option.h +++ b/interfaces/innerkits/ans/native/include/notification_bundle_option.h @@ -91,8 +91,8 @@ private: bool ReadFromParcel(Parcel &parcel); private: - std::string bundleName_{}; - int32_t uid_{}; + std::string bundleName_ {}; + int32_t uid_ {}; }; } // namespace Notification } // namespace OHOS diff --git a/interfaces/innerkits/ans/native/include/notification_constant.h b/interfaces/innerkits/ans/native/include/notification_constant.h index fb8f4aae8..1f710ef02 100644 --- a/interfaces/innerkits/ans/native/include/notification_constant.h +++ b/interfaces/innerkits/ans/native/include/notification_constant.h @@ -23,8 +23,8 @@ namespace Notification { class NotificationConstant { public: enum InputEditType { - EDIT_AUTO, // Indicates that the system determines whether to allow the user to edit the options before they - // are sent to the application. + EDIT_AUTO, // Indicates that the system determines whether to allow the user to edit the options before + // they are sent to the application. EDIT_DISABLED, // Indicates that the user is not allowed to edit an option before the option is sent to the // application. EDIT_ENABLED, // Indicates that the user is allowed to edit an option before the option is sent to the diff --git a/interfaces/innerkits/ans/native/include/notification_request.h b/interfaces/innerkits/ans/native/include/notification_request.h index ad1b0789f..34d542ddc 100644 --- a/interfaces/innerkits/ans/native/include/notification_request.h +++ b/interfaces/innerkits/ans/native/include/notification_request.h @@ -137,22 +137,6 @@ public: */ static const uint32_t COLOR_DEFAULT; -private: - /** - * Indicates the color mask, used for calculation with the ARGB value set by setColor(int32_t). - */ - static const uint32_t COLOR_MASK; - - /** - * the maximum number of user input history is 5. - */ - static const std::size_t MAX_USER_INPUT_HISTORY; - - /** - * the maximum number of action buttons is 3. - */ - static const std::size_t MAX_ACTION_BUTTONS; - public: /** * Default constructor used to create a NotificationRequest instance. @@ -874,6 +858,22 @@ public: */ static NotificationRequest *Unmarshalling(Parcel &parcel); +private: + /** + * Indicates the color mask, used for calculation with the ARGB value set by setColor(int32_t). + */ + static const uint32_t COLOR_MASK; + + /** + * the maximum number of user input history is 5. + */ + static const std::size_t MAX_USER_INPUT_HISTORY; + + /** + * the maximum number of action buttons is 3. + */ + static const std::size_t MAX_ACTION_BUTTONS; + private: /** * Read a NotificationRequest object from a Parcel. diff --git a/interfaces/innerkits/ans/native/include/notification_slot_group.h b/interfaces/innerkits/ans/native/include/notification_slot_group.h index 723128910..bcba43946 100644 --- a/interfaces/innerkits/ans/native/include/notification_slot_group.h +++ b/interfaces/innerkits/ans/native/include/notification_slot_group.h @@ -140,11 +140,11 @@ private: bool ReadFromParcel(Parcel &parcel); private: - std::string id_{}; - std::string name_{}; - std::string description_{}; - std::vector slots_{}; - bool isDisabled_{false}; + std::string id_ {}; + std::string name_ {}; + std::string description_ {}; + std::vector slots_ {}; + bool isDisabled_ {false}; }; } // namespace Notification } // namespace OHOS diff --git a/interfaces/innerkits/ans/native/include/notification_sorting.h b/interfaces/innerkits/ans/native/include/notification_sorting.h index 1efa272e5..da7810b6f 100644 --- a/interfaces/innerkits/ans/native/include/notification_sorting.h +++ b/interfaces/innerkits/ans/native/include/notification_sorting.h @@ -26,7 +26,6 @@ namespace OHOS { namespace Notification { - class NotificationSorting final : public Parcelable { public: /** diff --git a/interfaces/innerkits/ans/native/include/notification_sorting_map.h b/interfaces/innerkits/ans/native/include/notification_sorting_map.h index 54fb3f37a..0fe5e4b83 100644 --- a/interfaces/innerkits/ans/native/include/notification_sorting_map.h +++ b/interfaces/innerkits/ans/native/include/notification_sorting_map.h @@ -25,7 +25,6 @@ namespace OHOS { namespace Notification { - class NotificationSortingMap final : public Parcelable { public: /** @@ -96,7 +95,6 @@ private: std::vector sortedKey_ {}; std::map sortings_ {}; }; - } // namespace Notification } // namespace OHOS diff --git a/interfaces/innerkits/ans/native/include/notification_subscribe_info.h b/interfaces/innerkits/ans/native/include/notification_subscribe_info.h index 1eb370e59..bb5ede504 100644 --- a/interfaces/innerkits/ans/native/include/notification_subscribe_info.h +++ b/interfaces/innerkits/ans/native/include/notification_subscribe_info.h @@ -24,7 +24,6 @@ namespace OHOS { namespace Notification { - class NotificationSubscribeInfo final : public Parcelable { public: /** diff --git a/interfaces/innerkits/ans/native/include/notification_subscriber.h b/interfaces/innerkits/ans/native/include/notification_subscriber.h index 54ce4f337..688959d02 100644 --- a/interfaces/innerkits/ans/native/include/notification_subscriber.h +++ b/interfaces/innerkits/ans/native/include/notification_subscriber.h @@ -26,7 +26,6 @@ namespace OHOS { namespace Notification { - class NotificationSubscriber { public: /** @@ -120,7 +119,7 @@ private: public: SubscriberImpl(NotificationSubscriber &subscriber); - ~SubscriberImpl(){}; + ~SubscriberImpl() {}; void OnConnected() override; diff --git a/interfaces/innerkits/wantagent/include/completed_callback.h b/interfaces/innerkits/wantagent/include/completed_callback.h index 5740a899d..5b83a2dc4 100644 --- a/interfaces/innerkits/wantagent/include/completed_callback.h +++ b/interfaces/innerkits/wantagent/include/completed_callback.h @@ -23,7 +23,6 @@ namespace OHOS::Notification::WantAgent { class CompletedCallback { - /** * Called when a Send operation as completed. * diff --git a/interfaces/innerkits/wantagent/include/completed_dispatcher.h b/interfaces/innerkits/wantagent/include/completed_dispatcher.h index bd17fbecf..3b987c8fd 100644 --- a/interfaces/innerkits/wantagent/include/completed_dispatcher.h +++ b/interfaces/innerkits/wantagent/include/completed_dispatcher.h @@ -27,15 +27,6 @@ namespace OHOS::Notification::WantAgent { class PendingWant; class CompletedDispatcher : public AAFwk::WantReceiverStub { -private: - const std::shared_ptr pendingWant_; - const std::shared_ptr callback_; - const std::shared_ptr handler_; - AAFwk::Want want_; - int resultCode_ = 0; - std::string resultData_; - AAFwk::WantParams resultExtras_; - public: CompletedDispatcher(const std::shared_ptr &pendingWant, const std::shared_ptr &callback, const std::shared_ptr &handler); @@ -47,6 +38,15 @@ public: const AAFwk::WantParams &extras, bool serialized, bool sticky, int sendingUser) override; void Run(); + +private: + const std::shared_ptr pendingWant_; + const std::shared_ptr callback_; + const std::shared_ptr handler_; + AAFwk::Want want_; + int resultCode_ = 0; + std::string resultData_; + AAFwk::WantParams resultExtras_; }; } // namespace OHOS::Notification::WantAgent #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NATIVE_WANTAGENT_COMPLETED_DISPATCHER_H \ No newline at end of file diff --git a/interfaces/innerkits/wantagent/include/pending_want.h b/interfaces/innerkits/wantagent/include/pending_want.h index 7ab84bd4e..1db00b773 100644 --- a/interfaces/innerkits/wantagent/include/pending_want.h +++ b/interfaces/innerkits/wantagent/include/pending_want.h @@ -32,7 +32,7 @@ namespace OHOS::Notification::WantAgent { class PendingWant final : public std::enable_shared_from_this, public Parcelable { public: - PendingWant(){}; + PendingWant() {}; PendingWant(const sptr &target); PendingWant(const sptr &target, const sptr whitelistToken); virtual ~PendingWant() = default; @@ -255,9 +255,6 @@ private: std::vector> cancelListeners_; class CancelReceiver : public AAFwk::WantReceiverStub { - private: - std::weak_ptr outerInstance_; - public: explicit CancelReceiver(const std::weak_ptr &outerInstance); virtual ~CancelReceiver() = default; @@ -265,6 +262,9 @@ private: void Send(const int32_t resultCode) override; void PerformReceive(const AAFwk::Want &want, int resultCode, const std::string &data, const AAFwk::WantParams &extras, bool serialized, bool sticky, int sendingUser) override; + + private: + std::weak_ptr outerInstance_; }; static std::shared_ptr BuildServicePendingWant(const std::shared_ptr &context, diff --git a/interfaces/innerkits/wantagent/include/trigger_info.h b/interfaces/innerkits/wantagent/include/trigger_info.h index ce60016a4..ba4cdba4e 100644 --- a/interfaces/innerkits/wantagent/include/trigger_info.h +++ b/interfaces/innerkits/wantagent/include/trigger_info.h @@ -100,12 +100,6 @@ public: */ public: class Builder final : public std::enable_shared_from_this { - private: - std::string permission_; - std::shared_ptr params_; - std::shared_ptr want_; - int resultCode_ = 0; - /** * Default constructor used to create a {@code Builder} instance. * @@ -161,6 +155,12 @@ public: * @return Returns the created {@code TriggerInfo} object. */ std::shared_ptr Build(); + + private: + std::string permission_; + std::shared_ptr params_; + std::shared_ptr want_; + int resultCode_ = 0; }; private: diff --git a/interfaces/innerkits/wantagent/include/want_agent.h b/interfaces/innerkits/wantagent/include/want_agent.h index 06d6cd36b..f9a19087e 100644 --- a/interfaces/innerkits/wantagent/include/want_agent.h +++ b/interfaces/innerkits/wantagent/include/want_agent.h @@ -25,16 +25,8 @@ namespace OHOS::Notification::WantAgent { class WantAgent final : public std::enable_shared_from_this, public Parcelable { -private: - std::shared_ptr pendingWant_; - - /** - * Constructor. - * - * @param obj The proxy object. - */ public: - WantAgent(){}; + WantAgent() {}; virtual ~WantAgent() = default; explicit WantAgent(const std::shared_ptr &pendingWant); @@ -67,6 +59,15 @@ public: * @return Returns true if the unmarshalling is successful; returns false otherwise. */ static WantAgent *Unmarshalling(Parcel &parcel); + +private: + std::shared_ptr pendingWant_; + + /** + * Constructor. + * + * @param obj The proxy object. + */ }; } // namespace OHOS::Notification::WantAgent #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NATIVE_WANTAGENT_INCLUDE_WANT_AGENT_H \ No newline at end of file diff --git a/interfaces/innerkits/wantagent/include/want_agent_constant.h b/interfaces/innerkits/wantagent/include/want_agent_constant.h index 461b023c1..4f611ffa5 100644 --- a/interfaces/innerkits/wantagent/include/want_agent_constant.h +++ b/interfaces/innerkits/wantagent/include/want_agent_constant.h @@ -126,7 +126,7 @@ public: }; private: - WantAgentConstant(){}; + WantAgentConstant() {}; virtual ~WantAgentConstant() = default; }; } // namespace OHOS::Notification::WantAgent diff --git a/interfaces/innerkits/wantagent/include/want_agent_helper.h b/interfaces/innerkits/wantagent/include/want_agent_helper.h index cf775dde2..7f3027fcf 100644 --- a/interfaces/innerkits/wantagent/include/want_agent_helper.h +++ b/interfaces/innerkits/wantagent/include/want_agent_helper.h @@ -42,10 +42,6 @@ static const int FLAG_UPDATE_CURRENT = 1 << 27; static const int FLAG_IMMUTABLE = 1 << 26; class WantAgentHelper final : public std::enable_shared_from_this { -private: - WantAgentHelper(); - virtual ~WantAgentHelper() = default; - public: /** * Obtains an WantAgent object. @@ -166,6 +162,10 @@ public: */ static void UnregisterCancelListener( const std::shared_ptr &cancelListener, const std::shared_ptr &agent); + +private: + WantAgentHelper(); + virtual ~WantAgentHelper() = default; private: static void Send(const std::shared_ptr &context, diff --git a/interfaces/innerkits/wantagent/include/want_agent_info.h b/interfaces/innerkits/wantagent/include/want_agent_info.h index 15c411dc9..c363784a1 100644 --- a/interfaces/innerkits/wantagent/include/want_agent_info.h +++ b/interfaces/innerkits/wantagent/include/want_agent_info.h @@ -32,13 +32,6 @@ namespace OHOS::Notification::WantAgent { * */ class WantAgentInfo final : public std::enable_shared_from_this { -private: - int requestCode_ = 0; - WantAgentConstant::OperationType operationType_ = WantAgentConstant::OperationType::UNKNOWN_TYPE; - std::vector flags_ = std::vector(); - std::vector> wants_ = std::vector>(); - std::shared_ptr extraInfo_; - /** * Default constructor used to create an empty WantAgentInfo instance. * @@ -119,6 +112,13 @@ public: * @return Returns the extra information of the WantAgent object. */ std::shared_ptr GetExtraInfo() const; + +private: + int requestCode_ = 0; + WantAgentConstant::OperationType operationType_ = WantAgentConstant::OperationType::UNKNOWN_TYPE; + std::vector flags_ = std::vector(); + std::vector> wants_ = std::vector>(); + std::shared_ptr extraInfo_; }; } // namespace OHOS::Notification::WantAgent #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NATIVE_WANTAGENT_INCLUDE_WANT_AGENT_INFO_H \ No newline at end of file diff --git a/interfaces/innerkits/wantagent/include/want_agent_log_wrapper.h b/interfaces/innerkits/wantagent/include/want_agent_log_wrapper.h index 263310dfe..8c9c141a3 100644 --- a/interfaces/innerkits/wantagent/include/want_agent_log_wrapper.h +++ b/interfaces/innerkits/wantagent/include/want_agent_log_wrapper.h @@ -16,8 +16,8 @@ #ifndef BASE_NOTIFICATION_ANS_STANDARD_KITS_NATIVE_WANTAGENT_INCLUDE_WANT_AGENT_LOG_WRAPPER_H #define BASE_NOTIFICATION_ANS_STANDARD_KITS_NATIVE_WANTAGENT_INCLUDE_WANT_AGENT_LOG_WRAPPER_H -#include "hilog/log.h" #include +#include "hilog/log.h" namespace OHOS::Notification::WantAgent { #ifndef WANT_AGENT_LOG_DOMAIN diff --git a/interfaces/kits/napi/ans/include/cancel.h b/interfaces/kits/napi/ans/include/cancel.h index 219005d66..4cdc87e79 100644 --- a/interfaces/kits/napi/ans/include/cancel.h +++ b/interfaces/kits/napi/ans/include/cancel.h @@ -25,7 +25,6 @@ using namespace OHOS::Notification; napi_value Cancel(napi_env env, napi_callback_info info); napi_value CancelAll(napi_env env, napi_callback_info info); napi_value CancelGroup(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS diff --git a/interfaces/kits/napi/ans/include/common.h b/interfaces/kits/napi/ans/include/common.h index 94f053a3e..0f2075e72 100644 --- a/interfaces/kits/napi/ans/include/common.h +++ b/interfaces/kits/napi/ans/include/common.h @@ -406,7 +406,6 @@ private: static const int ONLY_CALLBACK_MIN_PARA = 0; static std::set> wantAgent_; }; - } // namespace NotificationNapi } // namespace OHOS diff --git a/interfaces/kits/napi/ans/include/constant.h b/interfaces/kits/napi/ans/include/constant.h index 96cb86f39..5eb46c17f 100644 --- a/interfaces/kits/napi/ans/include/constant.h +++ b/interfaces/kits/napi/ans/include/constant.h @@ -32,7 +32,6 @@ napi_value InputEditTypeInit(napi_env env, napi_value exports); napi_value ContentTypeInit(napi_env env, napi_value exports); napi_value DoNotDisturbTypeInit(napi_env env, napi_value exports); napi_value ConstantInit(napi_env env, napi_value exports); - } // namespace NotificationNapi } // namespace OHOS diff --git a/interfaces/kits/napi/ans/include/display_badge.h b/interfaces/kits/napi/ans/include/display_badge.h index 945543193..992a41dee 100644 --- a/interfaces/kits/napi/ans/include/display_badge.h +++ b/interfaces/kits/napi/ans/include/display_badge.h @@ -23,7 +23,6 @@ using namespace OHOS::Notification; napi_value DisplayBadge(napi_env env, napi_callback_info info); napi_value IsBadgeDisplayed(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NAPI_INCLUDE_DISPLAY_BADGE_H \ No newline at end of file diff --git a/interfaces/kits/napi/ans/include/disturb_mode.h b/interfaces/kits/napi/ans/include/disturb_mode.h index 5b86d6eec..3a2d668bb 100644 --- a/interfaces/kits/napi/ans/include/disturb_mode.h +++ b/interfaces/kits/napi/ans/include/disturb_mode.h @@ -24,7 +24,6 @@ using namespace OHOS::Notification; napi_value SetDoNotDisturbDate(napi_env env, napi_callback_info info); napi_value GetDoNotDisturbDate(napi_env env, napi_callback_info info); napi_value SupportDoNotDisturbMode(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NAPI_INCLUDE_DISTURB_MODE_H \ No newline at end of file diff --git a/interfaces/kits/napi/ans/include/enable_notification.h b/interfaces/kits/napi/ans/include/enable_notification.h index e7ae30648..d96094539 100644 --- a/interfaces/kits/napi/ans/include/enable_notification.h +++ b/interfaces/kits/napi/ans/include/enable_notification.h @@ -23,7 +23,6 @@ using namespace OHOS::Notification; napi_value EnableNotification(napi_env env, napi_callback_info info); napi_value IsNotificationEnabled(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NAPI_INCLUDE_ENABLE_NOTIFICATION_H \ No newline at end of file diff --git a/interfaces/kits/napi/ans/include/get_active.h b/interfaces/kits/napi/ans/include/get_active.h index 867eef8b0..37865304a 100644 --- a/interfaces/kits/napi/ans/include/get_active.h +++ b/interfaces/kits/napi/ans/include/get_active.h @@ -25,7 +25,6 @@ using namespace OHOS::Notification; napi_value GetAllActiveNotifications(napi_env env, napi_callback_info info); napi_value GetActiveNotifications(napi_env env, napi_callback_info info); napi_value GetActiveNotificationCount(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS diff --git a/interfaces/kits/napi/ans/include/init.h b/interfaces/kits/napi/ans/include/init.h index fabae8a06..d8306a664 100644 --- a/interfaces/kits/napi/ans/include/init.h +++ b/interfaces/kits/napi/ans/include/init.h @@ -46,7 +46,6 @@ napi_module _module = { .reserved = {0} }; - } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NAPI_INCLUDE_INIT_H diff --git a/interfaces/kits/napi/ans/include/publish.h b/interfaces/kits/napi/ans/include/publish.h index a288687b9..2f64e25b9 100644 --- a/interfaces/kits/napi/ans/include/publish.h +++ b/interfaces/kits/napi/ans/include/publish.h @@ -21,9 +21,7 @@ namespace OHOS { namespace NotificationNapi { using namespace OHOS::Notification; - napi_value Publish(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NAPI_INCLUDE_PUBLISH_H \ No newline at end of file diff --git a/interfaces/kits/napi/ans/include/remove.h b/interfaces/kits/napi/ans/include/remove.h index fddba9010..56bc61c2c 100644 --- a/interfaces/kits/napi/ans/include/remove.h +++ b/interfaces/kits/napi/ans/include/remove.h @@ -26,7 +26,6 @@ napi_value Remove(napi_env env, napi_callback_info info); napi_value RemoveAsBundle(napi_env env, napi_callback_info info); napi_value RemoveAll(napi_env env, napi_callback_info info); napi_value RemoveGroupByBundle(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NAPI_INCLUDE_REMOVE_H \ No newline at end of file diff --git a/interfaces/kits/napi/ans/include/slot.h b/interfaces/kits/napi/ans/include/slot.h index e4e03749a..d7aaca4d2 100644 --- a/interfaces/kits/napi/ans/include/slot.h +++ b/interfaces/kits/napi/ans/include/slot.h @@ -30,7 +30,6 @@ napi_value GetSlots(napi_env env, napi_callback_info info); napi_value GetSlotsByBundle(napi_env env, napi_callback_info info); napi_value RemoveSlot(napi_env env, napi_callback_info info); napi_value RemoveAllSlots(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS diff --git a/interfaces/kits/napi/ans/include/subscribe.h b/interfaces/kits/napi/ans/include/subscribe.h index 08c0df5e3..b18e1de4b 100644 --- a/interfaces/kits/napi/ans/include/subscribe.h +++ b/interfaces/kits/napi/ans/include/subscribe.h @@ -80,7 +80,6 @@ private: CallbackInfo dieCallbackInfo_; CallbackInfo disturbModeCallbackInfo_; CallbackInfo disturbDateCallbackInfo_; - }; struct SubscriberInstancesInfo { @@ -96,7 +95,6 @@ bool AddSubscriberInstancesInfo(const napi_env &env, const SubscriberInstancesIn bool DelSubscriberInstancesInfo(const napi_env &env, SubscriberInstance *subscriber); napi_value Subscribe(napi_env env, napi_callback_info info); - } // namespace NotificationNapi } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_KITS_NAPI_INCLUDE_SUBSCRIBE_H \ No newline at end of file diff --git a/interfaces/kits/napi/ans/include/unsubscribe.h b/interfaces/kits/napi/ans/include/unsubscribe.h index 595de743b..2751b461b 100644 --- a/interfaces/kits/napi/ans/include/unsubscribe.h +++ b/interfaces/kits/napi/ans/include/unsubscribe.h @@ -21,7 +21,6 @@ namespace OHOS { namespace NotificationNapi { using namespace OHOS::Notification; - napi_value Unsubscribe(napi_env env, napi_callback_info info); } // namespace NotificationNapi diff --git a/interfaces/kits/napi/ans/src/cancel.cpp b/interfaces/kits/napi/ans/src/cancel.cpp index 0ba7a4461..1632d1fc2 100644 --- a/interfaces/kits/napi/ans/src/cancel.cpp +++ b/interfaces/kits/napi/ans/src/cancel.cpp @@ -289,6 +289,5 @@ napi_value CancelGroup(napi_env env, napi_callback_info info) return promise; } } - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/ans/src/display_badge.cpp b/interfaces/kits/napi/ans/src/display_badge.cpp index 889fd7842..214b87bb6 100644 --- a/interfaces/kits/napi/ans/src/display_badge.cpp +++ b/interfaces/kits/napi/ans/src/display_badge.cpp @@ -260,6 +260,5 @@ napi_value IsBadgeDisplayed(napi_env env, napi_callback_info info) return promise; } } - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/ans/src/disturb_mode.cpp b/interfaces/kits/napi/ans/src/disturb_mode.cpp index 2c261ebe8..d9b056f86 100644 --- a/interfaces/kits/napi/ans/src/disturb_mode.cpp +++ b/interfaces/kits/napi/ans/src/disturb_mode.cpp @@ -316,6 +316,5 @@ napi_value SupportDoNotDisturbMode(napi_env env, napi_callback_info info) return promise; } } - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/ans/src/enable_notification.cpp b/interfaces/kits/napi/ans/src/enable_notification.cpp index b350df6c0..f0d943a43 100644 --- a/interfaces/kits/napi/ans/src/enable_notification.cpp +++ b/interfaces/kits/napi/ans/src/enable_notification.cpp @@ -257,6 +257,5 @@ napi_value IsNotificationEnabled(napi_env env, napi_callback_info info) return promise; } } - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/ans/src/init.cpp b/interfaces/kits/napi/ans/src/init.cpp index 358865aa3..2a27497cb 100644 --- a/interfaces/kits/napi/ans/src/init.cpp +++ b/interfaces/kits/napi/ans/src/init.cpp @@ -96,6 +96,5 @@ __attribute__((constructor)) void RegisterModule(void) napi_module_register(&_module); } EXTERN_C_END - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/ans/src/slot.cpp b/interfaces/kits/napi/ans/src/slot.cpp index faa723f51..15d0156b5 100644 --- a/interfaces/kits/napi/ans/src/slot.cpp +++ b/interfaces/kits/napi/ans/src/slot.cpp @@ -978,6 +978,5 @@ napi_value RemoveAllSlots(napi_env env, napi_callback_info info) return promise; } } - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/ans/src/subscribe.cpp b/interfaces/kits/napi/ans/src/subscribe.cpp index 4056542cf..d35db6290 100644 --- a/interfaces/kits/napi/ans/src/subscribe.cpp +++ b/interfaces/kits/napi/ans/src/subscribe.cpp @@ -1083,6 +1083,5 @@ napi_value Subscribe(napi_env env, napi_callback_info info) return promise; } } - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/ans/src/unsubscribe.cpp b/interfaces/kits/napi/ans/src/unsubscribe.cpp index a8b188eeb..bd500e332 100644 --- a/interfaces/kits/napi/ans/src/unsubscribe.cpp +++ b/interfaces/kits/napi/ans/src/unsubscribe.cpp @@ -130,6 +130,5 @@ napi_value Unsubscribe(napi_env env, napi_callback_info info) return promise; } } - } // namespace NotificationNapi } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/napi/wantagent/napi_want_agent.cpp b/interfaces/kits/napi/wantagent/napi_want_agent.cpp index 727f54fcb..1d7fa5f79 100644 --- a/interfaces/kits/napi/wantagent/napi_want_agent.cpp +++ b/interfaces/kits/napi/wantagent/napi_want_agent.cpp @@ -15,8 +15,8 @@ #include "napi_want_agent.h" -#include -#include +#include +#include #include #include @@ -330,7 +330,7 @@ napi_value NAPI_GetBundleName(napi_env env, napi_callback_info info) NAPI_ASSERT_RETURN_NULL(env, valuetype == napi_function, "Wrong argument type. Function expected."); callBackMode = true; } - AsyncGetBundleNameCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetBundleNameCallbackInfo{ + AsyncGetBundleNameCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetBundleNameCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr, @@ -454,7 +454,7 @@ napi_value NAPI_GetUid(napi_env env, napi_callback_info info) NAPI_ASSERT_RETURN_NULL(env, valuetype == napi_function, "Wrong argument type. Function expected."); callBackMode = true; } - AsyncGetUidCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetUidCallbackInfo{ + AsyncGetUidCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetUidCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr, @@ -576,7 +576,7 @@ napi_value NAPI_GetWant(napi_env env, napi_callback_info info) NAPI_ASSERT_RETURN_NULL(env, valuetype == napi_function, "Wrong argument type. Function expected."); callBackMode = true; } - AsyncGetWantCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetWantCallbackInfo{ + AsyncGetWantCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetWantCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr, @@ -716,7 +716,7 @@ napi_value NAPI_Cancel(napi_env env, napi_callback_info info) NAPI_ASSERT_RETURN_NULL(env, valuetype == napi_function, "Wrong argument type. Function expected."); callBackMode = true; } - AsyncCancelCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncCancelCallbackInfo{ + AsyncCancelCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncCancelCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr, @@ -862,7 +862,7 @@ napi_value NAPI_Trigger(napi_env env, napi_callback_info info) return NapiGetNull(env); } - AsyncTriggerCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncTriggerCallbackInfo{ + AsyncTriggerCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncTriggerCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr, @@ -1002,7 +1002,7 @@ napi_value NAPI_Equal(napi_env env, napi_callback_info info) NAPI_ASSERT_RETURN_NULL(env, valuetype == napi_function, "Wrong argument type. Function expected."); callBackMode = true; } - AsyncEqualCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncEqualCallbackInfo{ + AsyncEqualCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncEqualCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr, @@ -1254,7 +1254,7 @@ napi_value NAPI_GetWantAgent(napi_env env, napi_callback_info info) callBackMode = true; } - AsyncGetWantAgentCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetWantAgentCallbackInfo{ + AsyncGetWantAgentCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncGetWantAgentCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr, diff --git a/interfaces/kits/napi/wantagent/native_module.cpp b/interfaces/kits/napi/wantagent/native_module.cpp index 0177c32c6..f4474a384 100644 --- a/interfaces/kits/napi/wantagent/native_module.cpp +++ b/interfaces/kits/napi/wantagent/native_module.cpp @@ -14,8 +14,8 @@ */ #include -#include -#include +#include +#include #include #include "napi_want_agent.h" diff --git a/services/ans/include/advanced_notification_service.h b/services/ans/include/advanced_notification_service.h index 176224efa..95214c02c 100644 --- a/services/ans/include/advanced_notification_service.h +++ b/services/ans/include/advanced_notification_service.h @@ -36,7 +36,6 @@ namespace OHOS { namespace Notification { - class AdvancedNotificationService final : public AnsManagerStub { public: ~AdvancedNotificationService() override; @@ -165,7 +164,6 @@ private: std::shared_ptr systemEventObserver_ = nullptr; DistributedKv::DistributedKvDataManager dataManager_; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/advanced_notification_service_ability.h b/services/ans/include/advanced_notification_service_ability.h index 10f8ac311..ec5c866d8 100644 --- a/services/ans/include/advanced_notification_service_ability.h +++ b/services/ans/include/advanced_notification_service_ability.h @@ -23,7 +23,6 @@ namespace OHOS { namespace Notification { - class AdvancedNotificationServiceAbility final : public SystemAbility { public: AdvancedNotificationServiceAbility(const int32_t systemAbilityId, bool runOnCreate); @@ -38,7 +37,6 @@ private: private: sptr service_; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/bundle_manager_helper.h b/services/ans/include/bundle_manager_helper.h index bb8dc8169..ab4fb0ca9 100644 --- a/services/ans/include/bundle_manager_helper.h +++ b/services/ans/include/bundle_manager_helper.h @@ -29,7 +29,6 @@ namespace OHOS { namespace Notification { - class BundleManagerHelper : public DelayedSingleton { public: std::string GetBundleNameByUid(int uid); @@ -49,7 +48,6 @@ private: DECLARE_DELAYED_SINGLETON(BundleManagerHelper) }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/distributed_kvstore_death_recipient.h b/services/ans/include/distributed_kvstore_death_recipient.h index d59604801..a02331889 100644 --- a/services/ans/include/distributed_kvstore_death_recipient.h +++ b/services/ans/include/distributed_kvstore_death_recipient.h @@ -22,7 +22,6 @@ namespace OHOS { namespace Notification { - class DistributedKvStoreDeathRecipient : public DistributedKv::KvStoreDeathRecipient { public: DistributedKvStoreDeathRecipient(const std::function &callback) @@ -43,7 +42,6 @@ public: private: std::function callback_; }; - } // namespace Notification } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_DISTRIBUTED_KVSTORE_DEATH_RECIPIENT_H \ No newline at end of file diff --git a/services/ans/include/disturb_filter.h b/services/ans/include/disturb_filter.h index 3a28a324d..84c4846bb 100644 --- a/services/ans/include/disturb_filter.h +++ b/services/ans/include/disturb_filter.h @@ -20,11 +20,10 @@ namespace OHOS { namespace Notification { - class DisturbFilter : public INotificationFilter { public: - DisturbFilter(){}; - ~DisturbFilter(){}; + DisturbFilter() {}; + ~DisturbFilter() {}; void OnStart() override; void OnStop() override; @@ -34,7 +33,6 @@ public: private: void GetTimeInterval(int64_t &beginDate, int64_t &endDate); }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/interface_system_event.h b/services/ans/include/interface_system_event.h index b4aba38fc..bc3b8f4ad 100644 --- a/services/ans/include/interface_system_event.h +++ b/services/ans/include/interface_system_event.h @@ -23,11 +23,9 @@ namespace OHOS { namespace Notification { - struct ISystemEvent { std::function &)> onBundleRemoved; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/notification_filter.h b/services/ans/include/notification_filter.h index 30dc7b902..4c229109e 100644 --- a/services/ans/include/notification_filter.h +++ b/services/ans/include/notification_filter.h @@ -24,18 +24,16 @@ namespace OHOS { namespace Notification { - class INotificationFilter { public: - INotificationFilter(){}; - virtual ~INotificationFilter(){}; + INotificationFilter() {}; + virtual ~INotificationFilter() {}; virtual void OnStart() = 0; virtual void OnStop() = 0; virtual ErrCode OnPublish(const std::shared_ptr &record) = 0; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/notification_preferences_database.h b/services/ans/include/notification_preferences_database.h index d037fe471..0787c62f2 100644 --- a/services/ans/include/notification_preferences_database.h +++ b/services/ans/include/notification_preferences_database.h @@ -24,7 +24,6 @@ namespace OHOS { namespace Notification { - class NotificationPreferencesDatabase final { public: NotificationPreferencesDatabase(); @@ -142,7 +141,6 @@ private: std::shared_ptr kvStorePtr_ = nullptr; DistributedKv::DistributedKvDataManager dataManager_; }; - } // namespace Notification } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_SERVICES_NOTIFICATION_PREFERENCES_DATABASE_H \ No newline at end of file diff --git a/services/ans/include/notification_record.h b/services/ans/include/notification_record.h index f41e65faf..12b541336 100644 --- a/services/ans/include/notification_record.h +++ b/services/ans/include/notification_record.h @@ -25,14 +25,12 @@ namespace OHOS { namespace Notification { - struct NotificationRecord { sptr bundleOption; sptr request; sptr notification; sptr slot; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/notification_slot_filter.h b/services/ans/include/notification_slot_filter.h index 45092a2bc..3b8978c2c 100644 --- a/services/ans/include/notification_slot_filter.h +++ b/services/ans/include/notification_slot_filter.h @@ -20,18 +20,16 @@ namespace OHOS { namespace Notification { - class NotificationSlotFilter : public INotificationFilter { public: - NotificationSlotFilter(){}; - ~NotificationSlotFilter(){}; + NotificationSlotFilter() {}; + ~NotificationSlotFilter() {}; void OnStart() override; void OnStop() override; ErrCode OnPublish(const std::shared_ptr &record) override; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/notification_subscriber_manager.h b/services/ans/include/notification_subscriber_manager.h index ea96bfa6b..477acb747 100644 --- a/services/ans/include/notification_subscriber_manager.h +++ b/services/ans/include/notification_subscriber_manager.h @@ -79,7 +79,6 @@ private: DECLARE_DELAYED_SINGLETON(NotificationSubscriberManager); DISALLOW_COPY_AND_MOVE(NotificationSubscriberManager); }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/permission_filter.h b/services/ans/include/permission_filter.h index 850069cc8..f0610279d 100644 --- a/services/ans/include/permission_filter.h +++ b/services/ans/include/permission_filter.h @@ -20,18 +20,16 @@ namespace OHOS { namespace Notification { - class PermissionFilter : public INotificationFilter { public: - PermissionFilter(){}; - ~PermissionFilter(){}; + PermissionFilter() {}; + ~PermissionFilter() {}; void OnStart() override; void OnStop() override; ErrCode OnPublish(const std::shared_ptr &record) override; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/preferences_constant.h b/services/ans/include/preferences_constant.h index f4ced9362..64419b653 100644 --- a/services/ans/include/preferences_constant.h +++ b/services/ans/include/preferences_constant.h @@ -18,7 +18,6 @@ namespace OHOS { namespace Notification { - const static std::string KEY_DO_NOT_DISTURB_TYPE = "ans_doNotDisturbType"; const static std::string KEY_DO_NOT_DISTURB_BEGIN_DATE = "ans_doNotDisturbBeginDate"; const static std::string KEY_DO_NOT_DISTURB_END_DATE = "ans_doNotDisturbEndDate"; @@ -74,7 +73,6 @@ enum class BundleType { BUNDLE_PRIVATE_ALLOWED_TYPE, BUNDLE_ENABLE_NOTIFICATION_TYPE, }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/remote_death_recipient.h b/services/ans/include/remote_death_recipient.h index 400dfd58d..ea52d41e6 100644 --- a/services/ans/include/remote_death_recipient.h +++ b/services/ans/include/remote_death_recipient.h @@ -12,18 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifndef BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_REMOTE_DEATH_RECIPIENT_H +#define BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_REMOTE_DEATH_RECIPIENT_H #include #include "iremote_object.h" #include "refbase.h" -#ifndef BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_REMOTE_DEATH_RECIPIENT_H -#define BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_REMOTE_DEATH_RECIPIENT_H - namespace OHOS { namespace Notification { - class RemoteDeathRecipient : public IRemoteObject::DeathRecipient { public: RemoteDeathRecipient(std::function &)> callback) @@ -46,7 +44,6 @@ public: private: std::function &)> callback_; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/system_event_observer.h b/services/ans/include/system_event_observer.h index 7fc8cd4fe..8e4be393c 100644 --- a/services/ans/include/system_event_observer.h +++ b/services/ans/include/system_event_observer.h @@ -26,7 +26,6 @@ namespace OHOS { namespace Notification { - class SystemEventObserver { public: SystemEventObserver(const ISystemEvent& callbacks); @@ -39,7 +38,6 @@ private: std::shared_ptr subscriber_ = nullptr; ISystemEvent callbacks_; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/include/system_event_subscriber.h b/services/ans/include/system_event_subscriber.h index 41b58c48d..593f92b8b 100644 --- a/services/ans/include/system_event_subscriber.h +++ b/services/ans/include/system_event_subscriber.h @@ -22,7 +22,6 @@ namespace OHOS { namespace Notification { - class SystemEventSubscriber : public EventFwk::CommonEventSubscriber { public: SystemEventSubscriber(const EventFwk::CommonEventSubscribeInfo &subscribeInfo, @@ -43,7 +42,6 @@ public: private: std::function callback_; }; - } // namespace Notification } // namespace OHOS diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 3deb150f6..1af9f6629 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -34,7 +34,6 @@ namespace OHOS { namespace Notification { - namespace { static const std::string ACTIVE_NOTIFICATION_OPTION = "active"; static const std::string RECENT_NOTIFICATION_OPTION = "recent"; diff --git a/services/ans/src/advanced_notification_service_ability.cpp b/services/ans/src/advanced_notification_service_ability.cpp index f361f3d16..56f052fb8 100644 --- a/services/ans/src/advanced_notification_service_ability.cpp +++ b/services/ans/src/advanced_notification_service_ability.cpp @@ -17,7 +17,6 @@ namespace OHOS { namespace Notification { - namespace { REGISTER_SYSTEM_ABILITY_BY_ID(AdvancedNotificationServiceAbility, ADVANCED_NOTIFICATION_SERVICE_ABILITY_ID, true); } @@ -45,6 +44,5 @@ void AdvancedNotificationServiceAbility::OnStop() { service_ = nullptr; } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/services/ans/src/bundle_manager_helper.cpp b/services/ans/src/bundle_manager_helper.cpp index a02c7f20a..c5485263e 100644 --- a/services/ans/src/bundle_manager_helper.cpp +++ b/services/ans/src/bundle_manager_helper.cpp @@ -21,7 +21,6 @@ namespace OHOS { namespace Notification { - BundleManagerHelper::BundleManagerHelper() { deathRecipient_ = @@ -118,6 +117,5 @@ int BundleManagerHelper::GetDefaultUidByBundleName(const std::string& bundle) return uid; } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/services/ans/src/notification_preferences.cpp b/services/ans/src/notification_preferences.cpp index dcf308015..04c2ce8d6 100644 --- a/services/ans/src/notification_preferences.cpp +++ b/services/ans/src/notification_preferences.cpp @@ -21,7 +21,6 @@ namespace OHOS { namespace Notification { - NotificationPreferences::NotificationPreferences() { preferncesDB_ = std::make_unique(); @@ -39,7 +38,6 @@ NotificationPreferences &NotificationPreferences::GetInstance() ErrCode NotificationPreferences::AddNotificationSlots( const sptr &bundleOption, const std::vector> &slots) { - ANS_LOGD("%{public}s", __FUNCTION__); if (bundleOption == nullptr || bundleOption->GetBundleName().empty() || slots.empty()) { return ERR_ANS_INVALID_PARAM; @@ -119,7 +117,6 @@ ErrCode NotificationPreferences::RemoveNotificationSlot( NotificationPreferencesInfo preferencesInfo = preferencesInfo_; ErrCode result = ERR_OK; result = CheckSlotForRemoveSlot(bundleOption, slotType, preferencesInfo); - if (result == ERR_OK && (!preferncesDB_->RemoveSlotFromDisturbeDB(GenerateBundleKey(bundleOption), slotType))) { return ERR_ANS_PREFERENCES_NOTIFICATION_DB_OPERATION_FAILED; } @@ -237,7 +234,6 @@ ErrCode NotificationPreferences::UpdateNotificationSlots( ErrCode NotificationPreferences::UpdateNotificationSlotGroups( const sptr &bundleOption, const std::vector> &groups) { - ANS_LOGD("%{public}s", __FUNCTION__); if (bundleOption == nullptr || bundleOption->GetBundleName().empty() || groups.empty()) { return ERR_ANS_INVALID_PARAM; @@ -484,7 +480,6 @@ ErrCode NotificationPreferences::SetNotificationsEnabledForBundle( NotificationPreferencesInfo preferencesInfo = preferencesInfo_; ErrCode result = SetBundleProperty(preferencesInfo, bundleOption, BundleType::BUNDLE_ENABLE_NOTIFICATION_TYPE, enabled); - if (result == ERR_OK) { preferencesInfo_ = preferencesInfo; } @@ -778,6 +773,5 @@ void NotificationPreferences::OnDistributedKvStoreDeathRecipient() } } } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index a839e1440..54c5a1e54 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -14,16 +14,12 @@ */ #include "notification_preferences_database.h" -#include -#include -#include #include "ans_log_wrapper.h" #include "uri.h" namespace OHOS { namespace Notification { - const std::map &, std::string &)>> NotificationPreferencesDatabase::slotMap_ = { diff --git a/services/ans/src/notification_preferences_info.cpp b/services/ans/src/notification_preferences_info.cpp index 539035fb8..f58a968b7 100644 --- a/services/ans/src/notification_preferences_info.cpp +++ b/services/ans/src/notification_preferences_info.cpp @@ -16,7 +16,6 @@ namespace OHOS { namespace Notification { - NotificationPreferencesInfo::BundleInfo::BundleInfo() {} NotificationPreferencesInfo::BundleInfo::~BundleInfo() @@ -291,6 +290,5 @@ void NotificationPreferencesInfo::ClearBundleInfo() { infos_.clear(); } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/services/ans/src/notification_slot_filter.cpp b/services/ans/src/notification_slot_filter.cpp index d59d1d181..9b4c59e6d 100644 --- a/services/ans/src/notification_slot_filter.cpp +++ b/services/ans/src/notification_slot_filter.cpp @@ -21,7 +21,6 @@ namespace OHOS { namespace Notification { - void NotificationSlotFilter::OnStart() {} @@ -63,6 +62,5 @@ ErrCode NotificationSlotFilter::OnPublish(const std::shared_ptr subscriber {nullptr}; std::set bundleList_ {}; diff --git a/services/ans/src/permission_filter.cpp b/services/ans/src/permission_filter.cpp index d66946c6c..9c4a86870 100644 --- a/services/ans/src/permission_filter.cpp +++ b/services/ans/src/permission_filter.cpp @@ -21,7 +21,6 @@ namespace OHOS { namespace Notification { - void PermissionFilter::OnStart() {} @@ -49,6 +48,5 @@ ErrCode PermissionFilter::OnPublish(const std::shared_ptr &r } return result; } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/services/ans/src/system_event_observer.cpp b/services/ans/src/system_event_observer.cpp index 959e85f80..c87a77748 100644 --- a/services/ans/src/system_event_observer.cpp +++ b/services/ans/src/system_event_observer.cpp @@ -21,7 +21,6 @@ namespace OHOS { namespace Notification { - SystemEventObserver::SystemEventObserver(const ISystemEvent &callbacks) : callbacks_(callbacks) { EventFwk::MatchingSkills matchingSkills; @@ -53,6 +52,5 @@ void SystemEventObserver::OnReceiveEvent(const EventFwk::CommonEventData &data) } } } - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/services/ans/test/unittest/advanced_notification_service_ability_test.cpp b/services/ans/test/unittest/advanced_notification_service_ability_test.cpp index e447dec8c..fce488e4d 100644 --- a/services/ans/test/unittest/advanced_notification_service_ability_test.cpp +++ b/services/ans/test/unittest/advanced_notification_service_ability_test.cpp @@ -22,13 +22,12 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - class AdvancedNotificationServiceAbilityTest : public testing::Test { public: - static void SetUpTestCase(){}; - static void TearDownTestCase(){}; - void SetUp(){}; - void TearDown(){}; + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; + void SetUp() {}; + void TearDown() {}; }; /** @@ -43,6 +42,5 @@ HWTEST_F( bool runOnCreate = true; AdvancedNotificationServiceAbility(systemAbilityId, runOnCreate); } - } // namespace Notification } // namespace OHOS diff --git a/services/ans/test/unittest/bundle_manager_helper_test.cpp b/services/ans/test/unittest/bundle_manager_helper_test.cpp index dc710dad0..4cde76e92 100644 --- a/services/ans/test/unittest/bundle_manager_helper_test.cpp +++ b/services/ans/test/unittest/bundle_manager_helper_test.cpp @@ -25,13 +25,12 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - class BundleManagerHelperTest : public testing::Test { public: - static void SetUpTestCase(){}; - static void TearDownTestCase(){}; - void SetUp(){}; - void TearDown(){}; + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; + void SetUp() {}; + void TearDown() {}; }; /** diff --git a/services/ans/test/unittest/mock/mock_bundle_manager_helper.cpp b/services/ans/test/unittest/mock/mock_bundle_manager_helper.cpp index efde9364a..0d454850b 100644 --- a/services/ans/test/unittest/mock/mock_bundle_manager_helper.cpp +++ b/services/ans/test/unittest/mock/mock_bundle_manager_helper.cpp @@ -22,7 +22,6 @@ namespace OHOS { namespace Notification { - BundleManagerHelper::BundleManagerHelper() {} @@ -46,12 +45,10 @@ bool BundleManagerHelper::IsSystemApp(int uid) { return (uid == SYSTEM_APP_UID); } - void BundleManagerHelper::Connect() {} void BundleManagerHelper::Disconnect() {} - } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/services/ans/test/unittest/mock/mock_event_handler.cpp b/services/ans/test/unittest/mock/mock_event_handler.cpp index 12a7f65b9..bdadec57f 100644 --- a/services/ans/test/unittest/mock/mock_event_handler.cpp +++ b/services/ans/test/unittest/mock/mock_event_handler.cpp @@ -15,11 +15,9 @@ #include "event_handler.h" #include "event_handler_utils.h" -#include namespace OHOS { namespace AppExecFwk { - std::shared_ptr EventHandler::Current() { const std::weak_ptr &wp = std::make_shared(EventRunner::Create(true)); diff --git a/services/ans/test/unittest/notification_preferences_database_test.cpp b/services/ans/test/unittest/notification_preferences_database_test.cpp index 6cb5f7743..b294f18e7 100644 --- a/services/ans/test/unittest/notification_preferences_database_test.cpp +++ b/services/ans/test/unittest/notification_preferences_database_test.cpp @@ -21,13 +21,12 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - class NotificationPreferencesDatabaseTest : public testing::Test { public: - static void SetUpTestCase(){}; - static void TearDownTestCase(){}; - void SetUp(){}; - void TearDown(){}; + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; + void SetUp() {}; + void TearDown() {}; const std::string bundleName_ = "bundleName"; std::unique_ptr preferncesDB_ = @@ -173,7 +172,6 @@ HWTEST_F(NotificationPreferencesDatabaseTest, PutImportance_00200, Function | Sm */ HWTEST_F(NotificationPreferencesDatabaseTest, PutTotalBadgeNums_00100, Function | SmallTest | Level1) { - EXPECT_TRUE(preferncesDB_->PutTotalBadgeNums(bundleName_, 0)); } @@ -456,7 +454,6 @@ HWTEST_F(NotificationPreferencesDatabaseTest, CheckKvStore_00100, Function | Sma */ HWTEST_F(NotificationPreferencesDatabaseTest, PutBundlePropertyValueToDisturbeDB_00100, Function | SmallTest | Level1) { - NotificationPreferencesInfo::BundleInfo info; EXPECT_EQ(true, preferncesDB_->PutBundlePropertyValueToDisturbeDB(info)); } @@ -494,6 +491,5 @@ HWTEST_F(NotificationPreferencesDatabaseTest, CheckBundle_00100, Function | Smal { EXPECT_EQ(true, preferncesDB_->CheckBundle(bundleName_)); } - } // namespace Notification } // namespace OHOS diff --git a/services/ans/test/unittest/notification_preferences_test.cpp b/services/ans/test/unittest/notification_preferences_test.cpp index 6c5353459..f1ec114e4 100644 --- a/services/ans/test/unittest/notification_preferences_test.cpp +++ b/services/ans/test/unittest/notification_preferences_test.cpp @@ -22,12 +22,11 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - class NotificationPreferencesTest : public testing::Test { public: - static void SetUpTestCase(){}; - static void TearDownTestCase(){}; - void SetUp(){}; + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; + void SetUp() {}; void TearDown(); void TestAddNotificationSlot(); @@ -127,7 +126,6 @@ HWTEST_F(NotificationPreferencesTest, AddNotificationSlots_00400, Function | Sma */ HWTEST_F(NotificationPreferencesTest, AddNotificationSlots_00500, Function | SmallTest | Level1) { - sptr slot1 = new NotificationSlot(NotificationConstant::SlotType::SOCIAL_COMMUNICATION); sptr slot2 = new NotificationSlot(NotificationConstant::SlotType::SOCIAL_COMMUNICATION); diff --git a/services/ans/test/unittest/notification_slot_filter_test.cpp b/services/ans/test/unittest/notification_slot_filter_test.cpp index 15e72a01e..7cc73fa00 100644 --- a/services/ans/test/unittest/notification_slot_filter_test.cpp +++ b/services/ans/test/unittest/notification_slot_filter_test.cpp @@ -21,13 +21,12 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - class NotificationSlotFilterTest : public testing::Test { public: - static void SetUpTestCase(){}; - static void TearDownTestCase(){}; - void SetUp(){}; - void TearDown(){}; + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; + void SetUp() {}; + void TearDown() {}; }; /** diff --git a/services/ans/test/unittest/notification_subscriber_manager_test.cpp b/services/ans/test/unittest/notification_subscriber_manager_test.cpp index 6ce1eee99..eb8d6f743 100644 --- a/services/ans/test/unittest/notification_subscriber_manager_test.cpp +++ b/services/ans/test/unittest/notification_subscriber_manager_test.cpp @@ -25,7 +25,6 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - class NotificationSubscriberManagerTest : public testing::Test { public: static void SetUpTestCase(); diff --git a/services/ans/test/unittest/permission_filter_test.cpp b/services/ans/test/unittest/permission_filter_test.cpp index 3aa2fa829..f1010e093 100644 --- a/services/ans/test/unittest/permission_filter_test.cpp +++ b/services/ans/test/unittest/permission_filter_test.cpp @@ -26,11 +26,10 @@ using namespace testing::ext; namespace OHOS { namespace Notification { - class PermissionFilterTest : public testing::Test { public: - static void SetUpTestCase(){}; - static void TearDownTestCase(){}; + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; void SetUp(); void TearDown(); }; diff --git a/services/test/moduletest/ans_module_test.cpp b/services/test/moduletest/ans_module_test.cpp index a967f8b00..50b07085e 100644 --- a/services/test/moduletest/ans_module_test.cpp +++ b/services/test/moduletest/ans_module_test.cpp @@ -1079,10 +1079,10 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0051, Function | SmallTest | Level1) slots.push_back(slot); g_advancedNotificationService->AddSlots(slots); - std::vector> slotsRef{}; + std::vector> slotsRef {}; g_advancedNotificationService->GetSlots(slotsRef); EXPECT_EQ(1, static_cast(slotsRef.size())); - std::vector slotsId{}; + std::vector slotsId {}; for (const auto &i : slotsRef) { slotsId.push_back(i->GetId()); } @@ -1104,9 +1104,9 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0052, Function | SmallTest | Level1) slots.push_back(slot); g_advancedNotificationService->AddSlots(slots); - std::vector> slotsRef{}; + std::vector> slotsRef {}; g_advancedNotificationService->GetSlots(slotsRef); - std::vector slotsId{}; + std::vector slotsId {}; for (const auto &i : slotsRef) { slotsId.push_back(i->GetId()); } @@ -1620,7 +1620,6 @@ HWTEST_F(AnsModuleTest, AnsModuleTest_0103, Function | SmallTest | Level1) */ HWTEST_F(AnsModuleTest, AnsModuleTest_0105, Function | SmallTest | Level1) { - std::vector> slots; sptr socialSlot = new NotificationSlot(NotificationConstant::SlotType::SOCIAL_COMMUNICATION); sptr reminderSlot = new NotificationSlot(NotificationConstant::SlotType::SERVICE_REMINDER); diff --git a/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp b/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp index 5738fc881..7839b908c 100644 --- a/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp +++ b/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp @@ -274,6 +274,5 @@ bool BundleMgrProxy::SendTransactCmd(IBundleMgr::Message code, MessageParcel &da { return true; } - } // namespace AppExecFwk } // namespace OHOS diff --git a/services/test/moduletest/mock/mock_event_handler.cpp b/services/test/moduletest/mock/mock_event_handler.cpp index 12a7f65b9..bbbeb4907 100644 --- a/services/test/moduletest/mock/mock_event_handler.cpp +++ b/services/test/moduletest/mock/mock_event_handler.cpp @@ -15,7 +15,6 @@ #include "event_handler.h" #include "event_handler_utils.h" -#include namespace OHOS { namespace AppExecFwk { diff --git a/test/resource/ansSTSlotGroupTest/include/ans_slotgroup_test.h b/test/resource/ansSTSlotGroupTest/include/ans_slotgroup_test.h index cdab5c143..4e20ffb27 100644 --- a/test/resource/ansSTSlotGroupTest/include/ans_slotgroup_test.h +++ b/test/resource/ansSTSlotGroupTest/include/ans_slotgroup_test.h @@ -26,7 +26,6 @@ namespace OHOS { namespace AppExecFwk { - class AnsSlotGroupSystemTest : public Ability { protected: virtual void OnStart(const Want &want) override; @@ -45,7 +44,6 @@ private: std::string targetBundle; std::string targetAbility; }; - } // namespace AppExecFwk } // namespace OHOS #endif \ No newline at end of file diff --git a/tools/dump/include/notification_shell_command.h b/tools/dump/include/notification_shell_command.h index b881ffacd..ae1b2f8dc 100644 --- a/tools/dump/include/notification_shell_command.h +++ b/tools/dump/include/notification_shell_command.h @@ -23,11 +23,10 @@ namespace OHOS { namespace Notification { - class NotificationShellCommand : public OHOS::AAFwk::ShellCommand { public: NotificationShellCommand(int argc, char *argv[]); - ~NotificationShellCommand() override{}; + ~NotificationShellCommand() override {}; private: ErrCode CreateCommandMap() override; @@ -39,7 +38,6 @@ private: private: std::shared_ptr ans_; }; - } // namespace Notification } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_TOOLS_DUMP_INCLUDE_NOTIFICATION_SHELL_COMMAND_H \ No newline at end of file diff --git a/tools/dump/src/main.cpp b/tools/dump/src/main.cpp index 3a650b7e4..b9557ac51 100644 --- a/tools/dump/src/main.cpp +++ b/tools/dump/src/main.cpp @@ -13,7 +13,6 @@ * limitations under the License. */ -#include #include "notification_shell_command.h" -- Gitee