diff --git a/frameworks/ans/src/notification_local_live_view_subscriber.cpp b/frameworks/ans/src/notification_local_live_view_subscriber.cpp index cd110f22efd03a1668c77b632de9d5c48b2f577f..7d017ce4302623f5e6b3d6a5c9b9dd051cdc8821 100644 --- a/frameworks/ans/src/notification_local_live_view_subscriber.cpp +++ b/frameworks/ans/src/notification_local_live_view_subscriber.cpp @@ -15,7 +15,7 @@ #include "notification_local_live_view_subscriber.h" -#include "hitrace_meter_adapter.h" +#include "ans_trace_wrapper.h" #include "iservice_registry.h" #include "system_ability_definition.h" @@ -42,7 +42,7 @@ NotificationLocalLiveViewSubscriber::SubscriberLocalLiveViewImpl::SubscriberLoca ErrCode NotificationLocalLiveViewSubscriber::SubscriberLocalLiveViewImpl::OnConnected() { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (proxy != nullptr) { proxy->AsObject()->AddDeathRecipient(recipient_); @@ -54,7 +54,7 @@ ErrCode NotificationLocalLiveViewSubscriber::SubscriberLocalLiveViewImpl::OnConn ErrCode NotificationLocalLiveViewSubscriber::SubscriberLocalLiveViewImpl::OnDisconnected() { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (proxy != nullptr) { proxy->AsObject()->RemoveDeathRecipient(recipient_); @@ -67,7 +67,7 @@ ErrCode NotificationLocalLiveViewSubscriber::SubscriberLocalLiveViewImpl::OnDisc ErrCode NotificationLocalLiveViewSubscriber::SubscriberLocalLiveViewImpl::OnResponse(int32_t notificationId, const sptr &buttonOption) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); subscriber_.OnResponse(notificationId, buttonOption); return ERR_OK; } diff --git a/frameworks/ans/src/notification_subscriber.cpp b/frameworks/ans/src/notification_subscriber.cpp index 911249298e03a17bb60c13b47ff0ea4c51a73534..704ad23b64cd02f9fe01ccb4a7ba0bda914f4a2b 100644 --- a/frameworks/ans/src/notification_subscriber.cpp +++ b/frameworks/ans/src/notification_subscriber.cpp @@ -15,6 +15,7 @@ #include "notification_subscriber.h" +#include "ans_trace_wrapper.h" #include "notification_constant.h" #include "hitrace_meter_adapter.h" #include "iservice_registry.h" @@ -127,7 +128,7 @@ NotificationSubscriber::SubscriberImpl::SubscriberImpl(NotificationSubscriber &s ErrCode NotificationSubscriber::SubscriberImpl::OnConnected() { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (proxy != nullptr) { proxy->AsObject()->AddDeathRecipient(recipient_); @@ -139,7 +140,7 @@ ErrCode NotificationSubscriber::SubscriberImpl::OnConnected() ErrCode NotificationSubscriber::SubscriberImpl::OnDisconnected() { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (proxy != nullptr) { proxy->AsObject()->RemoveDeathRecipient(recipient_); @@ -152,7 +153,7 @@ ErrCode NotificationSubscriber::SubscriberImpl::OnDisconnected() ErrCode NotificationSubscriber::SubscriberImpl::OnConsumed( const sptr ¬ification, const sptr ¬ificationMap) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); std::shared_ptr sharedNotification = std::make_shared(*notification); #ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED if (!subscriber_.ProcessSyncDecision(subscriber_.GetDeviceType(), sharedNotification)) { @@ -184,7 +185,7 @@ ErrCode NotificationSubscriber::SubscriberImpl::OnConsumedWithMaxCapacity(const ErrCode NotificationSubscriber::SubscriberImpl::OnConsumedList(const std::vector> ¬ifications, const sptr ¬ificationMap) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); for (auto notification : notifications) { OnConsumed(notification, notificationMap); } @@ -199,7 +200,7 @@ ErrCode NotificationSubscriber::SubscriberImpl::OnConsumedList(const std::vector ErrCode NotificationSubscriber::SubscriberImpl::OnCanceled( const sptr ¬ification, const sptr ¬ificationMap, int32_t deleteReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notificationMap == nullptr) { subscriber_.OnCanceled(std::make_shared(*notification), std::make_shared(), deleteReason); @@ -248,7 +249,7 @@ void NotificationSubscriber::SubscriberImpl::OnBatchCanceled(const std::vector> ¬ifications, const sptr ¬ificationMap, int32_t deleteReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber_.HasOnBatchCancelCallback()) { OnBatchCanceled(notifications, notificationMap, deleteReason); return ERR_OK; @@ -280,14 +281,14 @@ ErrCode NotificationSubscriber::SubscriberImpl::OnDoNotDisturbDateChange(const s ErrCode NotificationSubscriber::SubscriberImpl::OnEnabledNotificationChanged( const sptr &callbackData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); subscriber_.OnEnabledNotificationChanged(std::make_shared(*callbackData)); return ERR_OK; } ErrCode NotificationSubscriber::SubscriberImpl::OnBadgeChanged(const sptr &badgeData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); subscriber_.OnBadgeChanged(std::make_shared(*badgeData)); return ERR_OK; } @@ -295,7 +296,7 @@ ErrCode NotificationSubscriber::SubscriberImpl::OnBadgeChanged(const sptr &callbackData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); subscriber_.OnBadgeEnabledChanged(callbackData); return ERR_OK; } @@ -303,7 +304,7 @@ ErrCode NotificationSubscriber::SubscriberImpl::OnBadgeEnabledChanged( ErrCode NotificationSubscriber::SubscriberImpl::OnApplicationInfoNeedChanged( const std::string& bundleName) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); subscriber_.OnApplicationInfoNeedChanged(bundleName); return ERR_OK; } diff --git a/frameworks/core/common/include/ans_trace_wrapper.h b/frameworks/core/common/include/ans_trace_wrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..8dec4e906805c1b9facd85ceee921464a2e75c06 --- /dev/null +++ b/frameworks/core/common/include/ans_trace_wrapper.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef BASE_NOTIFICATION_ANS_STANDARD_INNERKITS_BASE_INCLUDE_ANS_TRACE_HELPER_H +#define BASE_NOTIFICATION_ANS_STANDARD_INNERKITS_BASE_INCLUDE_ANS_TRACE_HELPER_H + +#include "hitrace_meter.h" + +namespace OHOS { +namespace Notification { + +#define NOTIFICATION_HITRACE(tag) \ + HITRACE_METER_NAME_EX(HiTraceOutputLevel::HITRACE_LEVEL_INFO, tag, __PRETTY_FUNCTION__, "") + +} // namespace Notification +} // namespace OHOS +#endif // BASE_NOTIFICATION_ANS_STANDARD_INNERKITS_BASE_INCLUDE_ANS_TRACE_HELPER_H diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index fc132733f29c685f1a9d3af52566c4ee7e97b6bc..300848d35f9f87a4175d7f5fa7d4c9b92b6178c1 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -17,6 +17,7 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_manager_death_recipient.h" #include "ans_manager_proxy.h" #include "hitrace_meter_adapter.h" @@ -227,7 +228,7 @@ ErrCode AnsNotification::PublishNotification(const NotificationRequest &request, ErrCode AnsNotification::PublishNotification(const std::string &label, const NotificationRequest &request, const std::string &instanceKey) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGI("PublishNotification,notificationId:%{public}u", request.GetNotificationId()); if (request.GetContent() == nullptr || request.GetNotificationType() == NotificationContent::Type::NONE) { @@ -279,7 +280,7 @@ ErrCode AnsNotification::PublishNotification(const std::string &label, const Not ErrCode AnsNotification::PublishNotificationForIndirectProxy(const NotificationRequest &request) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGI("PublishNotificationForIndirectProxy,notificationId:%{public}u", request.GetNotificationId()); if (request.GetContent() == nullptr || request.GetNotificationType() == NotificationContent::Type::NONE) { @@ -337,7 +338,7 @@ ErrCode AnsNotification::CancelNotification(const std::string &label, int32_t no const std::string &instanceKey) { ANS_LOGI("enter CancelNotification,notificationId:%{public}d", notificationId); - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -596,7 +597,7 @@ ErrCode AnsNotification::GetBundleImportance(NotificationSlot::NotificationLevel ErrCode AnsNotification::SubscribeNotification(const NotificationSubscriber &subscriber) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -613,7 +614,7 @@ ErrCode AnsNotification::SubscribeNotification(const NotificationSubscriber &sub ErrCode AnsNotification::SubscribeNotificationSelf(const NotificationSubscriber &subscriber) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -631,7 +632,7 @@ ErrCode AnsNotification::SubscribeNotificationSelf(const NotificationSubscriber ErrCode AnsNotification::SubscribeLocalLiveViewNotification(const NotificationLocalLiveViewSubscriber &subscriber, const bool isNative) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -649,7 +650,7 @@ ErrCode AnsNotification::SubscribeLocalLiveViewNotification(const NotificationLo ErrCode AnsNotification::SubscribeNotification( const NotificationSubscriber &subscriber, const NotificationSubscribeInfo &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("Failed to GetAnsManagerProxy."); @@ -675,7 +676,7 @@ ErrCode AnsNotification::SubscribeNotification( ErrCode AnsNotification::UnSubscribeNotification(NotificationSubscriber &subscriber) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -693,7 +694,7 @@ ErrCode AnsNotification::UnSubscribeNotification(NotificationSubscriber &subscri ErrCode AnsNotification::UnSubscribeNotification( NotificationSubscriber &subscriber, NotificationSubscribeInfo subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -716,13 +717,13 @@ ErrCode AnsNotification::UnSubscribeNotification( ErrCode AnsNotification::SubscribeNotification(const std::shared_ptr &subscriber) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); return SubscribeNotification(subscriber, nullptr); } ErrCode AnsNotification::SubscribeNotificationSelf(const std::shared_ptr &subscriber) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr."); return ERR_ANS_INVALID_PARAM; @@ -747,7 +748,7 @@ ErrCode AnsNotification::SubscribeNotificationSelf(const std::shared_ptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr."); return ERR_ANS_INVALID_PARAM; @@ -778,14 +779,14 @@ ErrCode AnsNotification::SubscribeNotification(const std::shared_ptr &subscriber) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); return UnSubscribeNotification(subscriber, nullptr); } ErrCode AnsNotification::UnSubscribeNotification(const std::shared_ptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr."); return ERR_ANS_INVALID_PARAM; @@ -818,7 +819,7 @@ ErrCode AnsNotification::UnSubscribeNotification(const std::shared_ptr& operationInfo, const sptr &callback) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (operationInfo == nullptr || callback == nullptr) { ANS_LOGE("Input hashCode is empty."); return ERR_ANS_INVALID_PARAM; @@ -2375,7 +2376,7 @@ ErrCode AnsNotification::DistributeOperation(sptr& op ErrCode AnsNotification::ReplyDistributeOperation(const std::string& hashCode, const int32_t result) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { @@ -2389,7 +2390,7 @@ ErrCode AnsNotification::GetNotificationRequestByHashCode( const std::string& hashCode, sptr& notificationRequest) { ANS_LOGI("Get notification request by hashCode, hashCode:%{public}s", hashCode.c_str()); - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { @@ -2403,7 +2404,7 @@ ErrCode AnsNotification::SetHashCodeRule( const uint32_t type) { ANS_LOGI("SetHashCodeRule type = %{public}d", type); - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); sptr proxy = GetAnsManagerProxy(); if (!proxy) { diff --git a/frameworks/core/src/listener/ans_subscriber_listener.cpp b/frameworks/core/src/listener/ans_subscriber_listener.cpp index 846b76f85196f9d82e64ee6eb626924dbfaab5fa..5dd8a780fbcf1e32abf9fc43f560e636f7fdfc26 100644 --- a/frameworks/core/src/listener/ans_subscriber_listener.cpp +++ b/frameworks/core/src/listener/ans_subscriber_listener.cpp @@ -15,9 +15,8 @@ #include "ans_subscriber_listener.h" -#include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "notification_constant.h" -#include "hitrace_meter_adapter.h" #include "iservice_registry.h" #include "system_ability_definition.h" @@ -32,7 +31,7 @@ SubscriberListener::~SubscriberListener() ErrCode SubscriberListener::OnConnected() { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -44,7 +43,7 @@ ErrCode SubscriberListener::OnConnected() ErrCode SubscriberListener::OnDisconnected() { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -57,7 +56,7 @@ ErrCode SubscriberListener::OnDisconnected() ErrCode SubscriberListener::OnConsumed( const sptr ¬ification, const sptr ¬ificationMap) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -99,7 +98,7 @@ ErrCode SubscriberListener::OnConsumedWithMaxCapacity(const sptr & ErrCode SubscriberListener::OnConsumedList(const std::vector> ¬ifications, const sptr ¬ificationMap) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); for (auto notification : notifications) { OnConsumed(notification, notificationMap); } @@ -114,7 +113,7 @@ ErrCode SubscriberListener::OnConsumedList(const std::vector> ErrCode SubscriberListener::OnCanceled( const sptr ¬ification, const sptr ¬ificationMap, int32_t deleteReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -170,7 +169,7 @@ void SubscriberListener::OnBatchCanceled(const std::vector> & ErrCode SubscriberListener::OnCanceledList(const std::vector> ¬ifications, const sptr ¬ificationMap, int32_t deleteReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -217,7 +216,7 @@ ErrCode SubscriberListener::OnDoNotDisturbDateChange(const sptr &callbackData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -229,7 +228,7 @@ ErrCode SubscriberListener::OnEnabledNotificationChanged( ErrCode SubscriberListener::OnBadgeChanged(const sptr &badgeData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -242,7 +241,7 @@ ErrCode SubscriberListener::OnBadgeChanged(const sptr & ErrCode SubscriberListener::OnBadgeEnabledChanged( const sptr &callbackData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); @@ -254,7 +253,7 @@ ErrCode SubscriberListener::OnBadgeEnabledChanged( ErrCode SubscriberListener::OnApplicationInfoNeedChanged(const std::string& bundleName) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGW("OnApplicationInfoNeedChanged SubscriberListener 1."); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { @@ -268,7 +267,7 @@ ErrCode SubscriberListener::OnApplicationInfoNeedChanged(const std::string& bund ErrCode SubscriberListener::OnOperationResponse( const sptr& operationInfo, int32_t& funcResult) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGW("Subscriber is nullptr"); diff --git a/frameworks/core/test/unittest/ans_subscriber_listener_test/BUILD.gn b/frameworks/core/test/unittest/ans_subscriber_listener_test/BUILD.gn index 44590125c98b55a6644b37715ad35f7c33e36194..ec9a36edcd6485ad5ced39c948ebffb31e847ad1 100644 --- a/frameworks/core/test/unittest/ans_subscriber_listener_test/BUILD.gn +++ b/frameworks/core/test/unittest/ans_subscriber_listener_test/BUILD.gn @@ -37,6 +37,7 @@ ohos_unittest("ans_subscriber_listener_test") { "c_utils:utils", "ipc:ipc_single", "hilog:libhilog", + "hitrace:hitrace_meter", ] subsystem_name = "${subsystem_name}" diff --git a/services/ans/src/advanced_notification_manager/advanced_notification_cancel.cpp b/services/ans/src/advanced_notification_manager/advanced_notification_cancel.cpp index 9b3d35d3287471069bd2e5e74cbc32c5426528c2..4e2d2db3dffea9c10bf1b5a3c5701b5e9474310a 100644 --- a/services/ans/src/advanced_notification_manager/advanced_notification_cancel.cpp +++ b/services/ans/src/advanced_notification_manager/advanced_notification_cancel.cpp @@ -15,10 +15,10 @@ #include "advanced_notification_service.h" +#include "ans_trace_wrapper.h" #include "access_token_helper.h" #include "ans_permission_def.h" #include "bundle_manager_helper.h" -#include "hitrace_meter_adapter.h" #include "ipc_skeleton.h" #include "notification_analytics_util.h" #include "notification_bundle_option.h" @@ -305,7 +305,7 @@ ErrCode AdvancedNotificationService::CancelContinuousTaskNotification(const std: ErrCode AdvancedNotificationService::RemoveNotification(const sptr &bundleOption, int32_t notificationId, const std::string &label, int32_t removeReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); bool isSubsystem = AccessTokenHelper::VerifyNativeToken(IPCSkeleton::GetCallingTokenID()); @@ -420,7 +420,7 @@ ErrCode AdvancedNotificationService::RemoveAllNotifications(const sptr &bundleOption, int32_t reason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); bool isSubsystem = AccessTokenHelper::VerifyNativeToken(IPCSkeleton::GetCallingTokenID()); @@ -540,7 +540,7 @@ void AdvancedNotificationService::GetRemoveListForRemoveAll(const sptr &keys, int32_t removeReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("enter"); bool isSubsystem = AccessTokenHelper::VerifyNativeToken(IPCSkeleton::GetCallingTokenID()); @@ -602,7 +602,7 @@ void AdvancedNotificationService::ExcuteRemoveNotifications(const std::vector &bundleOption, const sptr &slot, const int reason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); bool isSubsystem = AccessTokenHelper::VerifyNativeToken(IPCSkeleton::GetCallingTokenID()); diff --git a/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp b/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp index 6ae602d310ef0d88137f63bb051c557112b4e306..c24176509345a4e77ad0a050a7a22b89c8288d3a 100644 --- a/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp +++ b/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp @@ -22,9 +22,9 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_status.h" -#include "hitrace_meter_adapter.h" #include "notification_analytics_util.h" #include "os_account_manager.h" #include "os_account_manager_helper.h" @@ -47,7 +47,7 @@ ErrCode AdvancedNotificationService::PublishWithMaxCapacity( ErrCode AdvancedNotificationService::Publish(const std::string &label, const sptr &request) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); TraceChainUtil traceChain = TraceChainUtil(); OHOS::HiviewDFX::HiTraceId traceId = OHOS::HiviewDFX::HiTraceChain::GetId(); ANS_LOGD("%{public}s", __FUNCTION__); @@ -161,7 +161,7 @@ ErrCode AdvancedNotificationService::PublishNotificationForIndirectProxyWithMaxC ErrCode AdvancedNotificationService::PublishNotificationForIndirectProxy(const sptr &request) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_9, EventBranchId::BRANCH_0); diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index f3c8893948f1265a07dd9b56818dc83b36c05083..64636a8098056a6375c0d98006c4874e9b673360 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -23,12 +23,12 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "errors.h" #include "ipc_skeleton.h" #include "notification_bundle_option.h" #include "notification_constant.h" -#include "hitrace_meter_adapter.h" #include "notification_unified_group_Info.h" #include "os_account_manager.h" #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED @@ -1147,7 +1147,7 @@ void AdvancedNotificationService::PublishSubscriberExistFlagEvent(bool headsetEx ErrCode AdvancedNotificationService::RemoveAllNotificationsByBundleName(const std::string &bundleName, int32_t reason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); if (bundleName.empty()) { diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 1e402629adc16431df81735f725f8a967c2cb848..77b40d6a59d4edc1796ffe6a3e41cd616a738576 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -28,6 +28,7 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_permission_def.h" #include "errors.h" #include "notification_extension_wrapper.h" @@ -41,7 +42,6 @@ #include "common_event_manager.h" #include "common_event_support.h" #include "event_report.h" -#include "hitrace_meter_adapter.h" #include "ipc_skeleton.h" #include "nlohmann/json.hpp" #include "notification_constant.h" @@ -410,7 +410,7 @@ ErrCode AdvancedNotificationService::AssignToNotificationList(const std::shared_ ErrCode AdvancedNotificationService::CancelPreparedNotification(int32_t notificationId, const std::string &label, const sptr &bundleOption, int32_t reason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (bundleOption == nullptr) { std::string message = "bundleOption is null"; OHOS::Notification::HaMetaMessage haMetaMessage = HaMetaMessage(1, 2) @@ -454,7 +454,7 @@ ErrCode AdvancedNotificationService::CancelPreparedNotification(int32_t notifica ErrCode AdvancedNotificationService::PrepareNotificationInfo( const sptr &request, sptr &bundleOption) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (request == nullptr) { ANS_LOGE("request is invalid."); return ERR_ANS_INVALID_PARAM; @@ -665,7 +665,7 @@ std::shared_ptr AdvancedNotificationService::MakeNotificatio ErrCode AdvancedNotificationService::PublishPreparedNotification(const sptr &request, const sptr &bundleOption, bool isUpdateByOwner) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGI("PublishPreparedNotification"); auto tokenCaller = IPCSkeleton::GetCallingTokenID(); bool isAgentController = AccessTokenHelper::VerifyCallerPermission(tokenCaller, diff --git a/services/ans/src/advanced_notification_slot_service.cpp b/services/ans/src/advanced_notification_slot_service.cpp index 139234002fa1069e8712d594faa5a44b561a9e77..8c833accc2a66104c55cdf8ab091eb62d6053145 100644 --- a/services/ans/src/advanced_notification_slot_service.cpp +++ b/services/ans/src/advanced_notification_slot_service.cpp @@ -22,11 +22,11 @@ #include "access_token_helper.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_permission_def.h" #include "errors.h" #include "common_event_manager.h" #include "common_event_support.h" -#include "hitrace_meter_adapter.h" #include "os_account_manager_helper.h" #include "ipc_skeleton.h" #ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED @@ -843,7 +843,7 @@ ErrCode AdvancedNotificationService::SetEnabledForBundleSlotInner( ErrCode AdvancedNotificationService::SetEnabledForBundleSlot(const sptr &bundleOption, int32_t slotTypeInt, bool enabled, bool isForceControl) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); NotificationConstant::SlotType slotType = static_cast(slotTypeInt); ANS_LOGD("slotType: %{public}d, enabled: %{public}d, isForceControl: %{public}d", slotType, enabled, isForceControl); @@ -954,7 +954,7 @@ bool AdvancedNotificationService::PublishSlotChangeCommonEvent(const sptrGetBundleName().c_str(), bundleOption->GetUid()); EventFwk::Want want; diff --git a/services/ans/src/advanced_notification_subscriber_service.cpp b/services/ans/src/advanced_notification_subscriber_service.cpp index a10934909d3f7b7a13a28d40fd41035c0ebf43b7..8303517a1d9d7ba46c86aa06ecd4a45e0cf0e717 100644 --- a/services/ans/src/advanced_notification_subscriber_service.cpp +++ b/services/ans/src/advanced_notification_subscriber_service.cpp @@ -23,12 +23,12 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "errors.h" #include "ipc_skeleton.h" #include "notification_constant.h" #include "os_account_manager_helper.h" -#include "hitrace_meter_adapter.h" #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED #include "distributed_notification_manager.h" #include "distributed_preferences.h" @@ -49,7 +49,7 @@ ErrCode AdvancedNotificationService::Subscribe(const sptr &subsc ErrCode AdvancedNotificationService::Subscribe( const sptr &subscriber, const sptr &info) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); ErrCode errCode = ERR_OK; do { @@ -88,7 +88,7 @@ ErrCode AdvancedNotificationService::Subscribe( ErrCode AdvancedNotificationService::SubscribeSelf(const sptr &subscriber) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); sptr sptrInfo = new (std::nothrow) NotificationSubscribeInfo(); if (sptrInfo == nullptr) { @@ -145,7 +145,7 @@ ErrCode AdvancedNotificationService::Unsubscribe(const sptr &sub ErrCode AdvancedNotificationService::Unsubscribe( const sptr &subscriber, const sptr &info) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); SendUnSubscribeHiSysEvent(IPCSkeleton::GetCallingPid(), IPCSkeleton::GetCallingUid(), info); diff --git a/services/ans/src/advanced_notification_utils.cpp b/services/ans/src/advanced_notification_utils.cpp index a9faf05dd717c6dfe4f86fb12ac4594424c022cd..f575aaecb9bbf1951a6325ddcfe42ac2ae4f3c0a 100644 --- a/services/ans/src/advanced_notification_utils.cpp +++ b/services/ans/src/advanced_notification_utils.cpp @@ -21,6 +21,7 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "access_token_helper.h" #include "ans_permission_def.h" #include "bundle_manager_helper.h" @@ -1089,7 +1090,7 @@ ErrCode AdvancedNotificationService::DoDistributedPublish( ErrCode AdvancedNotificationService::DoDistributedDelete( const std::string deviceId, const std::string bundleName, const sptr notification) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (!notification->GetNotificationRequestPoint()->GetNotificationDistributedOptions().IsDistributed()) { return ERR_OK; } @@ -1139,7 +1140,7 @@ ErrCode AdvancedNotificationService::IsSupportTemplate(const std::string& templa void AdvancedNotificationService::TriggerRemoveWantAgent(const sptr &request, int32_t removeReason, bool isThirdParty) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s %{public}d %{public}d", __FUNCTION__, isThirdParty, removeReason); if ((request == nullptr) || (request->GetRemovalWantAgent() == nullptr)) { diff --git a/services/ans/src/enable_manager/enable_manager.cpp b/services/ans/src/enable_manager/enable_manager.cpp index 4bc7c4faf41b9bb21cc85011ba82ef69d4aec3fc..a5d5280535d6f9fcd0a0e0d0636e9d617f4e158a 100644 --- a/services/ans/src/enable_manager/enable_manager.cpp +++ b/services/ans/src/enable_manager/enable_manager.cpp @@ -20,10 +20,10 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_permission_def.h" #include "bundle_manager_helper.h" -#include "hitrace_meter_adapter.h" #include "ipc_skeleton.h" #include "notification_preferences.h" @@ -231,7 +231,7 @@ ErrCode AdvancedNotificationService::SetNotificationsEnabledForSpecialBundle( bool updateUnEnableTime) { HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_13, EventBranchId::BRANCH_5); - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); if (bundleOption == nullptr) { ANS_LOGE("BundleOption is null."); diff --git a/services/ans/src/notification_local_live_view_subscriber_manager.cpp b/services/ans/src/notification_local_live_view_subscriber_manager.cpp index 9178c95dc42b3780ca92debcfbfb807b0fbd2201..d4ecd711e569a8ed3e0ed21fc02d6d09a23c2cc8 100644 --- a/services/ans/src/notification_local_live_view_subscriber_manager.cpp +++ b/services/ans/src/notification_local_live_view_subscriber_manager.cpp @@ -22,7 +22,7 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" -#include "hitrace_meter_adapter.h" +#include "ans_trace_wrapper.h" #include "ipc_skeleton.h" #include "notification_bundle_option.h" #include "notification_button_option.h" @@ -67,7 +67,7 @@ void NotificationLocalLiveViewSubscriberManager::ResetFfrtQueue() ErrCode NotificationLocalLiveViewSubscriberManager::AddLocalLiveViewSubscriber( const sptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber == nullptr) { ANS_LOGE("subscriber is null."); return ERR_ANS_INVALID_PARAM; @@ -105,7 +105,7 @@ ErrCode NotificationLocalLiveViewSubscriberManager::AddLocalLiveViewSubscriber( ErrCode NotificationLocalLiveViewSubscriberManager::RemoveLocalLiveViewSubscriber( const sptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber == nullptr) { ANS_LOGE("subscriber is null."); return ERR_ANS_INVALID_PARAM; @@ -130,7 +130,7 @@ ErrCode NotificationLocalLiveViewSubscriberManager::RemoveLocalLiveViewSubscribe void NotificationLocalLiveViewSubscriberManager::NotifyTriggerResponse(const sptr ¬ification, const sptr &buttonOption) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notificationButtonQueue_ == nullptr) { ANS_LOGE("queue is nullptr"); return; @@ -212,7 +212,7 @@ std::shared_ptr &subscriber, const sptr &bundleOption) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); std::shared_ptr record = FindSubscriberRecord(subscriber); if (record == nullptr) { record = CreateSubscriberRecord(subscriber, bundleOption); @@ -234,7 +234,7 @@ ErrCode NotificationLocalLiveViewSubscriberManager::AddSubscriberInner( ErrCode NotificationLocalLiveViewSubscriberManager::RemoveSubscriberInner( const sptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); std::shared_ptr record = FindSubscriberRecord(subscriber); if (record == nullptr) { @@ -256,7 +256,7 @@ void NotificationLocalLiveViewSubscriberManager::NotifyTriggerResponseInner( const sptr ¬ification, const sptr buttonOption) { ANS_LOGD("ffrt enter!"); - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); int32_t sendUserId; std::string bundleName; diff --git a/services/ans/src/notification_preferences.cpp b/services/ans/src/notification_preferences.cpp index 6a605aea73ca3752a6b2a4da81b1533d55f146be..dcff9f9fdb301d05eff2d440d5a58b80fab44adb 100644 --- a/services/ans/src/notification_preferences.cpp +++ b/services/ans/src/notification_preferences.cpp @@ -23,9 +23,9 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_permission_def.h" #include "bundle_manager_helper.h" -#include "hitrace_meter_adapter.h" #include "nlohmann/json.hpp" #include "os_account_manager_helper.h" #include "notification_analytics_util.h" @@ -65,7 +65,7 @@ std::shared_ptr NotificationPreferences::GetInstance() ErrCode NotificationPreferences::AddNotificationSlots( const sptr &bundleOption, const std::vector> &slots) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_5, EventBranchId::BRANCH_6) .BundleName(bundleOption == nullptr ? "" : bundleOption->GetBundleName()); @@ -120,7 +120,7 @@ ErrCode NotificationPreferences::AddNotificationBundleProperty(const sptr &bundleOption, const NotificationConstant::SlotType &slotType) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); if (bundleOption == nullptr || bundleOption->GetBundleName().empty()) { return ERR_ANS_INVALID_PARAM; @@ -427,7 +427,7 @@ ErrCode NotificationPreferences::GetNotificationsEnabledForBundle( ErrCode NotificationPreferences::SetNotificationsEnabledForBundle( const sptr &bundleOption, const bool enabled) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (bundleOption == nullptr || bundleOption->GetBundleName().empty()) { return ERR_ANS_INVALID_PARAM; } diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index 32a931dac48c6bf82a7daa73a7ceb40676ade548..895037299931dce8ddb73d2e13546dc97836d02e 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -23,7 +23,7 @@ #include "ans_inner_errors.h" #include "os_account_manager_helper.h" #include "ans_log_wrapper.h" -#include "hitrace_meter_adapter.h" +#include "ans_trace_wrapper.h" #include "os_account_manager.h" #include "ipc_skeleton.h" #include "bundle_manager_helper.h" @@ -290,7 +290,7 @@ bool NotificationPreferencesDatabase::CheckRdbStore() bool NotificationPreferencesDatabase::PutSlotsToDisturbeDB( const std::string &bundleName, const int32_t &bundleUid, const std::vector> &slots) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); if (bundleName.empty()) { ANS_LOGE("Bundle name is null."); @@ -839,7 +839,7 @@ bool NotificationPreferencesDatabase::RemoveBundleFromDisturbeDB( bool NotificationPreferencesDatabase::RemoveSlotFromDisturbeDB( const std::string &bundleKey, const NotificationConstant::SlotType &type, const int32_t &bundleUid) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); int32_t userId = -1; OsAccountManagerHelper::GetInstance().GetOsAccountLocalIdFromUid(bundleUid, userId); diff --git a/services/ans/src/notification_subscriber_manager.cpp b/services/ans/src/notification_subscriber_manager.cpp index 01a0fb2577560596b1bb8dff5c46d479f96b1ac1..6a7a93c07f9aa7cd6a999c6bbbc0fcf3d00f4713 100644 --- a/services/ans/src/notification_subscriber_manager.cpp +++ b/services/ans/src/notification_subscriber_manager.cpp @@ -22,7 +22,7 @@ #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" -#include "hitrace_meter_adapter.h" +#include "ans_trace_wrapper.h" #include "ipc_skeleton.h" #include "notification_flags.h" #include "notification_constant.h" @@ -81,7 +81,7 @@ void NotificationSubscriberManager::ResetFfrtQueue() ErrCode NotificationSubscriberManager::AddSubscriber( const sptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber == nullptr) { ANS_LOGE("subscriber is null."); return ERR_ANS_INVALID_PARAM; @@ -144,7 +144,7 @@ ErrCode NotificationSubscriberManager::AddSubscriber( ErrCode NotificationSubscriberManager::RemoveSubscriber( const sptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (subscriber == nullptr) { ANS_LOGE("subscriber is null."); return ERR_ANS_INVALID_PARAM; @@ -175,7 +175,7 @@ ErrCode NotificationSubscriberManager::RemoveSubscriber( void NotificationSubscriberManager::NotifyConsumed( const sptr ¬ification, const sptr ¬ificationMap) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notificationSubQueue_ == nullptr) { ANS_LOGE("queue is nullptr"); return; @@ -188,7 +188,7 @@ void NotificationSubscriberManager::NotifyConsumed( void NotificationSubscriberManager::NotifyApplicationInfoNeedChanged(const std::string& bundleName) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notificationSubQueue_ == nullptr || bundleName.empty()) { ANS_LOGE("queue is nullptr"); return; @@ -202,7 +202,7 @@ void NotificationSubscriberManager::NotifyApplicationInfoNeedChanged(const std:: void NotificationSubscriberManager::NotifyApplicationInfochangedInner(const std::string& bundleName) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGI("NotifyApplicationInfochangedInner %{public}s", bundleName.c_str()); for (auto record : subscriberRecordList_) { if (record->needNotifyApplicationChanged) { @@ -214,7 +214,7 @@ void NotificationSubscriberManager::NotifyApplicationInfochangedInner(const std: void NotificationSubscriberManager::BatchNotifyConsumed(const std::vector> ¬ifications, const sptr ¬ificationMap, const std::shared_ptr &record) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGI("Start batch notifyConsumed."); if (notifications.empty() || notificationMap == nullptr || record == nullptr) { ANS_LOGE("Invalid input."); @@ -235,7 +235,7 @@ void NotificationSubscriberManager::BatchNotifyConsumed(const std::vector ¬ification, const sptr ¬ificationMap, int32_t deleteReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); #ifdef ENABLE_ANS_AGGREGATION std::vector> notifications; notifications.emplace_back(notification); @@ -255,7 +255,7 @@ void NotificationSubscriberManager::NotifyCanceled( void NotificationSubscriberManager::BatchNotifyCanceled(const std::vector> ¬ifications, const sptr ¬ificationMap, int32_t deleteReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); #ifdef ENABLE_ANS_AGGREGATION EXTENTION_WRAPPER->UpdateByCancel(notifications, deleteReason); #endif @@ -298,7 +298,7 @@ void NotificationSubscriberManager::NotifyDoNotDisturbDateChanged(const int32_t void NotificationSubscriberManager::NotifyEnabledNotificationChanged( const sptr &callbackData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notificationSubQueue_ == nullptr) { ANS_LOGE("queue is nullptr"); return; @@ -311,7 +311,7 @@ void NotificationSubscriberManager::NotifyEnabledNotificationChanged( void NotificationSubscriberManager::NotifyBadgeEnabledChanged(const sptr &callbackData) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notificationSubQueue_ == nullptr) { ANS_LOGE("Queue is nullptr."); return; @@ -428,7 +428,7 @@ void NotificationSubscriberManager::RemoveRecordInfo( ErrCode NotificationSubscriberManager::AddSubscriberInner( const sptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); std::shared_ptr record = FindSubscriberRecord(subscriber); if (record == nullptr) { record = CreateSubscriberRecord(subscriber); @@ -462,7 +462,7 @@ ErrCode NotificationSubscriberManager::AddSubscriberInner( ErrCode NotificationSubscriberManager::RemoveSubscriberInner( const sptr &subscriber, const sptr &subscribeInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); std::shared_ptr record = FindSubscriberRecord(subscriber); if (record == nullptr) { @@ -490,7 +490,7 @@ void NotificationSubscriberManager::NotifyConsumedInner( ANS_LOGE("[OnConsumed] fail: notification is nullptr."); return; } - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s notification->GetUserId <%{public}d>", __FUNCTION__, notification->GetUserId()); bool wearableFlag = false; @@ -582,7 +582,7 @@ ErrCode NotificationSubscriberManager::IsDeviceTypeAffordConsume( void NotificationSubscriberManager::BatchNotifyConsumedInner(const std::vector> ¬ifications, const sptr ¬ificationMap, const std::shared_ptr &record) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notifications.empty() || notificationMap == nullptr || record == nullptr) { ANS_LOGE("Invalid input."); return; @@ -626,7 +626,7 @@ void NotificationSubscriberManager::NotifyCanceledInner( ANS_LOGE("[OnCanceled] fail: notification is nullptr."); return; } - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s notification->GetUserId <%{public}d>", __FUNCTION__, notification->GetUserId()); std::shared_ptr liveViewContent = nullptr; @@ -711,7 +711,7 @@ bool NotificationSubscriberManager::ConsumeRecordFilter( void NotificationSubscriberManager::BatchNotifyCanceledInner(const std::vector> ¬ifications, const sptr ¬ificationMap, int32_t deleteReason) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("notifications size = <%{public}zu>", notifications.size()); @@ -960,7 +960,7 @@ void NotificationSubscriberManager::TrackCodeLog( ErrCode NotificationSubscriberManager::DistributeOperation(const sptr& operationInfo) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); if (notificationSubQueue_ == nullptr || operationInfo == nullptr) { ANS_LOGE("queue is nullptr"); return ERR_ANS_TASK_ERR; diff --git a/services/ans/src/system_live_view/advanced_notification_system_live_view_service.cpp b/services/ans/src/system_live_view/advanced_notification_system_live_view_service.cpp index 9ee386ecbda7c294444f9e45addd49dd308654b0..f827c102128772228e39a25a9f4d7cde51705c4a 100644 --- a/services/ans/src/system_live_view/advanced_notification_system_live_view_service.cpp +++ b/services/ans/src/system_live_view/advanced_notification_system_live_view_service.cpp @@ -18,9 +18,9 @@ #include "ans_permission_def.h" #include "access_token_helper.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_inner_errors.h" #include "errors.h" -#include "hitrace_meter_adapter.h" #include "ipc_skeleton.h" #include "notification_bundle_option.h" @@ -33,7 +33,7 @@ namespace Notification { ErrCode AdvancedNotificationService::TriggerLocalLiveView(const sptr &bundleOption, const int32_t notificationId, const sptr &buttonOption) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s", __FUNCTION__); bool isSubsystem = AccessTokenHelper::VerifyNativeToken(IPCSkeleton::GetCallingTokenID()); @@ -101,7 +101,7 @@ ErrCode AdvancedNotificationService::SubscribeLocalLiveView( const sptr &subscriber, const sptr &info, const bool isNative) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("%{public}s, isNative: %{public}d", __FUNCTION__, isNative); ErrCode errCode = ERR_OK; diff --git a/services/distributed/src/distributed_notification_manager.cpp b/services/distributed/src/distributed_notification_manager.cpp index 426c446879c9a734ad25a06de480fd39e1956c3e..1d1098bbf9d11a5b876f3b351d998b05683a1111 100644 --- a/services/distributed/src/distributed_notification_manager.cpp +++ b/services/distributed/src/distributed_notification_manager.cpp @@ -19,7 +19,7 @@ #include "ans_inner_errors.h" #include "ans_log_wrapper.h" -#include "hitrace_meter_adapter.h" +#include "ans_trace_wrapper.h" namespace OHOS { namespace Notification { @@ -314,7 +314,7 @@ bool DistributedNotificationManager::DeleteCallback( ErrCode DistributedNotificationManager::Publish( const std::string &bundleName, const std::string &label, int32_t id, const sptr &request) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("start"); std::string key; if (!GenerateLocalDistributedKey(bundleName, label, id, key)) { @@ -369,7 +369,7 @@ ErrCode DistributedNotificationManager::Update( ErrCode DistributedNotificationManager::Delete(const std::string &bundleName, const std::string &label, int32_t id) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("start"); std::string key; if (!GenerateLocalDistributedKey(bundleName, label, id, key)) { @@ -391,7 +391,7 @@ ErrCode DistributedNotificationManager::Delete(const std::string &bundleName, co ErrCode DistributedNotificationManager::DeleteRemoteNotification( const std::string &deviceId, const std::string &bundleName, const std::string &label, int32_t id) { - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_NOTIFICATION); ANS_LOGD("start"); std::string key; diff --git a/services/reminder/src/reminder_agent_service.cpp b/services/reminder/src/reminder_agent_service.cpp index e1cccb0ea0f235d8120bca2e1372074b5ed458f2..3f32fae0ba5329575e9ef9ace35b11f567cd977d 100644 --- a/services/reminder/src/reminder_agent_service.cpp +++ b/services/reminder/src/reminder_agent_service.cpp @@ -26,10 +26,10 @@ #include "ipc_skeleton.h" #include "accesstoken_kit.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_inner_errors.h" #include "os_account_manager.h" #include "notification_helper.h" -#include "hitrace_meter_adapter.h" #include "in_process_call_wrapper.h" #include @@ -62,7 +62,7 @@ sptr ReminderAgentService::GetInstance() ErrCode ReminderAgentService::PublishReminder(const ReminderRequest& reminder, int32_t& reminderId) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); ANSR_LOGD("call."); sptr tarReminder = CreateReminderRequest(reminder); if (nullptr == tarReminder) { @@ -106,7 +106,7 @@ ErrCode ReminderAgentService::PublishReminder(const ReminderRequest& reminder, i ErrCode ReminderAgentService::UpdateReminder(const int32_t reminderId, const ReminderRequest& reminder) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); ANSR_LOGD("call."); sptr tarReminder = CreateReminderRequest(reminder); if (nullptr == tarReminder) { @@ -135,7 +135,7 @@ ErrCode ReminderAgentService::UpdateReminder(const int32_t reminderId, const Rem ErrCode ReminderAgentService::CancelReminder(const int32_t reminderId) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); ANSR_LOGD("call."); if (!CheckReminderPermission()) { ANSR_LOGE("Failed to check permission: ohos.permission.PUBLISH_AGENT_REMINDER."); @@ -151,7 +151,7 @@ ErrCode ReminderAgentService::CancelReminder(const int32_t reminderId) ErrCode ReminderAgentService::CancelAllReminders() { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); ANSR_LOGD("call."); if (!CheckReminderPermission()) { ANSR_LOGE("Failed to check permission: ohos.permission.PUBLISH_AGENT_REMINDER."); @@ -171,7 +171,7 @@ ErrCode ReminderAgentService::CancelAllReminders() ErrCode ReminderAgentService::GetValidReminders(std::vector& reminders) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); ANSR_LOGD("call."); if (!CheckReminderPermission()) { ANSR_LOGE("Failed to check permission: ohos.permission.PUBLISH_AGENT_REMINDER."); @@ -188,7 +188,7 @@ ErrCode ReminderAgentService::GetValidReminders(std::vector& dates) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); ANSR_LOGD("call."); if (!CheckReminderPermission()) { ANSR_LOGE("Failed to check permission: ohos.permission.PUBLISH_AGENT_REMINDER."); diff --git a/services/reminder/src/reminder_data_manager.cpp b/services/reminder/src/reminder_data_manager.cpp index aa3498344462507e1732c3d647c7530ac74b9ae8..7c230c7de1d8603c8bec983edf73be57a16579e4 100644 --- a/services/reminder/src/reminder_data_manager.cpp +++ b/services/reminder/src/reminder_data_manager.cpp @@ -18,6 +18,7 @@ #include "ability_manager_client.h" #include "ans_convert_enum.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_const_define.h" #include "common_event_support.h" #include "common_event_manager.h" @@ -94,7 +95,7 @@ ReminderDataManager::~ReminderDataManager() = default; ErrCode ReminderDataManager::PublishReminder(const sptr &reminder, const int32_t callingUid) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); uint32_t callerTokenId = IPCSkeleton::GetCallingTokenID(); if (callerTokenId == 0) { ANSR_LOGE("pushlish failed, callerTokenId is 0"); @@ -118,7 +119,7 @@ ErrCode ReminderDataManager::PublishReminder(const sptr &remind ErrCode ReminderDataManager::CancelReminder( const int32_t &reminderId, const int32_t callingUid) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); ANSR_LOGI("cancel reminder id: %{public}d", reminderId); sptr reminder = FindReminderRequestLocked(reminderId, false); if (reminder == nullptr) { @@ -152,7 +153,7 @@ ErrCode ReminderDataManager::CancelReminder( ErrCode ReminderDataManager::CancelAllReminders(const std::string& bundleName, const int32_t userId, const int32_t callingUid) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); CancelRemindersImplLocked(bundleName, userId, callingUid); return ERR_OK; } @@ -180,7 +181,7 @@ sptr ReminderDataManager::CheckExcludeDateParam(const int32_t r ErrCode ReminderDataManager::AddExcludeDate(const int32_t reminderId, const int64_t date, const int32_t callingUid) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); sptr reminder = CheckExcludeDateParam(reminderId, callingUid); if (reminder == nullptr) { return ERR_REMINDER_NOT_EXIST; @@ -197,7 +198,7 @@ ErrCode ReminderDataManager::AddExcludeDate(const int32_t reminderId, const int6 ErrCode ReminderDataManager::DelExcludeDates(const int32_t reminderId, const int32_t callingUid) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); sptr reminder = CheckExcludeDateParam(reminderId, callingUid); if (reminder == nullptr) { return ERR_REMINDER_NOT_EXIST; @@ -214,7 +215,7 @@ ErrCode ReminderDataManager::DelExcludeDates(const int32_t reminderId, ErrCode ReminderDataManager::GetExcludeDates(const int32_t reminderId, const int32_t callingUid, std::vector& dates) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); sptr reminder = CheckExcludeDateParam(reminderId, callingUid); if (reminder == nullptr) { return ERR_REMINDER_NOT_EXIST; @@ -230,7 +231,7 @@ ErrCode ReminderDataManager::GetExcludeDates(const int32_t reminderId, void ReminderDataManager::GetValidReminders( const int32_t callingUid, std::vector &reminders) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); std::lock_guard lock(ReminderDataManager::MUTEX); auto reminderVector = store_->GetAllValidReminders(); for (auto& eachReminder : reminderVector) { diff --git a/services/reminder/src/reminder_data_manager_inner.cpp b/services/reminder/src/reminder_data_manager_inner.cpp index f03c98a023efdf6d7f6c420bea497b876bcdf1ef..5a6bd6cad96683ab59aea14e76d8191d026809e4 100644 --- a/services/reminder/src/reminder_data_manager_inner.cpp +++ b/services/reminder/src/reminder_data_manager_inner.cpp @@ -17,6 +17,7 @@ #include "ability_manager_client.h" #include "ans_log_wrapper.h" +#include "ans_trace_wrapper.h" #include "ans_const_define.h" #include "common_event_support.h" #include "common_event_manager.h" @@ -316,7 +317,7 @@ void ReminderDataManager::UpdateReminderFromDb(const std::vector& reminder, const int32_t callingUid) { - HITRACE_METER_NAME(HITRACE_TAG_OHOS, __PRETTY_FUNCTION__); + NOTIFICATION_HITRACE(HITRACE_TAG_OHOS); sptr reminderOld = FindReminderRequestLocked(reminder->GetReminderId(), false); bool existInMemory = true; if (nullptr != reminderOld) { diff --git a/services/reminder/test/unittest/BUILD.gn b/services/reminder/test/unittest/BUILD.gn index bf5ca1c194e1e8c0d38ba6a08a099aed78b658b6..3419ce493809dd60058b157f23823eadd281dfe0 100644 --- a/services/reminder/test/unittest/BUILD.gn +++ b/services/reminder/test/unittest/BUILD.gn @@ -153,6 +153,7 @@ ohos_unittest("reminder_agent_service_test") { "data_share:datashare_common", "ffrt:libffrt", "hilog:libhilog", + "hitrace:hitrace_meter", "ipc:ipc_core", "os_account:os_account_innerkits", "relational_store:native_rdb",