diff --git a/frameworks/ans/src/notification_subscriber.cpp b/frameworks/ans/src/notification_subscriber.cpp index 5e56611880afa9baf125937eeb7849abf0570981..f44ee410090dca6459f9edfcab0302cf5604c5e8 100644 --- a/frameworks/ans/src/notification_subscriber.cpp +++ b/frameworks/ans/src/notification_subscriber.cpp @@ -81,7 +81,8 @@ bool NotificationSubscriber::ProcessSyncDecision( if (deviceType.size() <= 0 || deviceType.compare(NotificationConstant::CURRENT_DEVICE_TYPE) == 0) { return true; } - ANS_LOGD("No need to consume cause cannot find deviceFlags. deviceType: %{public}s.", deviceType.c_str()); + ANS_LOGI("Cannot find deviceFlags,notificationKey = %{public}s, deviceType: %{public}s.", + request->GetKey().c_str(), deviceType.c_str()); return false; } diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index 6553934480e27011f6843bac921546654752ff64..15fc629f22e06c27bf501bf523d8419242a8751f 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -170,6 +170,8 @@ ErrCode AnsNotification::SetNotificationSlotFlagsAsBundle(const NotificationBund ANS_LOGE("Invalid bundle name."); return ERR_ANS_INVALID_PARAM; } + ANS_LOGI("SetNotificationSlotFlagsAsBundle,bundleName:%{public}s, %{public}d", + bundleOption.GetBundleName().c_str(), (int)slotFlags); sptr proxy = GetAnsManagerProxy(); if (!proxy) { @@ -190,7 +192,7 @@ ErrCode AnsNotification::PublishNotification(const NotificationRequest &request) ErrCode AnsNotification::PublishNotification(const std::string &label, const NotificationRequest &request) { HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); - ANS_LOGD("enter"); + ANS_LOGI("PublishNotification,notificationId:%{public}u", request.GetNotificationId()); if (request.GetContent() == nullptr || request.GetNotificationType() == NotificationContent::Type::NONE) { ANS_LOGE("Refuse to publish the notification without valid content"); @@ -242,7 +244,7 @@ ErrCode AnsNotification::PublishNotification(const std::string &label, const Not ErrCode AnsNotification::PublishNotificationForIndirectProxy(const NotificationRequest &request) { HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); - ANS_LOGD("enter"); + ANS_LOGI("PublishNotificationForIndirectProxy,notificationId:%{public}u", request.GetNotificationId()); if (request.GetContent() == nullptr || request.GetNotificationType() == NotificationContent::Type::NONE) { ANS_LOGE("Refuse to publish the notification without valid content"); @@ -406,6 +408,8 @@ ErrCode AnsNotification::CanPublishNotificationAsBundle(const std::string &repre ErrCode AnsNotification::PublishNotificationAsBundle( const std::string &representativeBundle, const NotificationRequest &request) { + ANS_LOGI("PublishNotificationAsBundle,representativeBundle:%{public}s ,notificationId:%{public}u", + representativeBundle.c_str(), request.GetNotificationId()); if (representativeBundle.empty()) { ANS_LOGE("Refuse to publish the notification whit invalid representativeBundle"); return ERR_ANS_INVALID_PARAM; @@ -774,6 +778,8 @@ ErrCode AnsNotification::TriggerLocalLiveView(const NotificationBundleOption &bu ANS_LOGE("Invalid button name."); return ERR_ANS_INVALID_PARAM; } + ANS_LOGI("TriggerLocalLiveView,notificationId:%{public}u,bundleName:%{public}s,button:%{public}s", + notificationId, bundleOption.GetBundleName().c_str(), buttonOption.GetButtonName().c_str()); sptr proxy = GetAnsManagerProxy(); if (!proxy) { diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 35e5ea9ca0cfcff9fb056b7d304c952350ab37ee..1f792c55135eeb38f64b69f6d531bb679cb5e6ab 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -141,6 +141,8 @@ ErrCode AdvancedNotificationService::Publish(const std::string &label, const spt sptr bundleOption; result = PrepareNotificationInfo(request, bundleOption); if (result != ERR_OK) { + message.ErrorCode(result).Message("PrepareNotificationInfo failed."); + NotificationAnalyticsUtil::ReportPublishFailedEvent(request, message); break; } diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 8b3ab5fa1cc116b47893e296114ad0ad87b8d777..ab12a06c0f6b5ce67fccb6901d8157449fdf6df3 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -1251,13 +1251,7 @@ ErrCode AdvancedNotificationService::RemoveFromNotificationList(const sptrnotification->IsRemoveAllowed()) { - ANS_LOGI("BatchRemove-FILTER-RemoveNotAllowed-%{public}s", record->notification->GetKey().c_str()); - std::string message = "notification unremove."; - OHOS::Notification::HaMetaMessage haMetaMessage = HaMetaMessage(1, 4) - .ErrorCode(ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED); - ReportDeleteFailedEventPushByNotification(record->notification, haMetaMessage, - NotificationConstant::DEFAULT_REASON_DELETE, message); - ANS_LOGE("%{public}s", message.c_str()); + ANS_LOGI("UnRemoved-%{public}s", record->notification->GetKey().c_str()); return ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED; } notification = record->notification; @@ -1300,12 +1294,7 @@ ErrCode AdvancedNotificationService::RemoveFromNotificationList( } if (!isCancel && !record->notification->IsRemoveAllowed()) { - std::string message = "notification unremove."; - OHOS::Notification::HaMetaMessage haMetaMessage = HaMetaMessage(1, 7) - .ErrorCode(ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED); - ReportDeleteFailedEventPushByNotification(record->notification, haMetaMessage, - removeReason, message); - ANS_LOGE("%{public}s", message.c_str()); + ANS_LOGI("UnRemoved-%{public}s", record->notification->GetKey().c_str()); return ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED; } notification = record->notification; diff --git a/services/ans/src/advanced_notification_utils.cpp b/services/ans/src/advanced_notification_utils.cpp index ff581aa3d6a812a7bee939a3fece1b840cd018b0..e6c0fdd4c57bde6b97b117b2a688a3f17da84b66 100644 --- a/services/ans/src/advanced_notification_utils.cpp +++ b/services/ans/src/advanced_notification_utils.cpp @@ -570,6 +570,7 @@ void AdvancedNotificationService::RemoveDoNotDisturbProfileTrustList( void AdvancedNotificationService::OnBundleDataAdd(const sptr &bundleOption) { CHECK_BUNDLE_OPTION_IS_INVALID(bundleOption) + ANS_LOGI("enter OnBundleDataAdd,bundleName:%{public}s", bundleOption->GetBundleName().c_str()); auto bundleInstall = [bundleOption, this]() { CHECK_BUNDLE_OPTION_IS_INVALID(bundleOption) AppExecFwk::BundleInfo bundleInfo; @@ -580,6 +581,7 @@ void AdvancedNotificationService::OnBundleDataAdd(const sptrGetBundleName().c_str()); auto errCode = NotificationPreferences::GetInstance()->SetNotificationsEnabledForBundle(bundleOption, true); if (errCode != ERR_OK) { ANS_LOGE("Set notification enable error! code: %{public}d", errCode); @@ -600,6 +602,7 @@ void AdvancedNotificationService::OnBundleDataAdd(const sptr &bundleOption) { CHECK_BUNDLE_OPTION_IS_INVALID(bundleOption) + ANS_LOGI("enter OnBundleDataUpdate,bundleName:%{public}s", bundleOption->GetBundleName().c_str()); AppExecFwk::BundleInfo bundleInfo; if (!GetBundleInfoByNotificationBundleOption(bundleOption, bundleInfo)) { ANS_LOGE("Failed to get BundleInfo using NotificationBundleOption."); @@ -1868,6 +1871,7 @@ void AdvancedNotificationService::InitNotificationEnableList() if (saveRef == ERR_OK) { continue; } + ANS_LOGI("need set %{public}s to be enabled", bundleOption->GetBundleName().c_str()); saveRef = NotificationPreferences::GetInstance()->SetNotificationsEnabledForBundle(bundleOption, true); if (saveRef != ERR_OK) { ANS_LOGE("Set enable error! code: %{public}d", saveRef); diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index 20e0c68d45d9074febbdeae7558af746eb55fc98..3e883aa5064f650afbf5a5a61acc3243f069d2c3 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -320,6 +320,8 @@ bool NotificationPreferencesDatabase::PutShowBadge( ANS_LOGE("Bundle name is nullptr."); return false; } + ANS_LOGI("bundelName:%{public}s, uid:%{public}d, showBadge[%{public}d]", + bundleInfo.GetBundleName().c_str(), bundleInfo.GetBundleUid(), enable); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; @@ -338,6 +340,8 @@ bool NotificationPreferencesDatabase::PutImportance( ANS_LOGE("Bundle name is empty."); return false; } + ANS_LOGI("bundelName:%{public}s, uid:%{public}d, importance[%{public}d]", + bundleInfo.GetBundleName().c_str(), bundleInfo.GetBundleUid(), importance); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; @@ -356,6 +360,8 @@ bool NotificationPreferencesDatabase::PutTotalBadgeNums( ANS_LOGE("Bundle name is blank."); return false; } + ANS_LOGI("bundelName:%{public}s, uid:%{public}d, totalBadgeNum[%{public}d]", + bundleInfo.GetBundleName().c_str(), bundleInfo.GetBundleUid(), totalBadgeNum); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; @@ -369,12 +375,13 @@ bool NotificationPreferencesDatabase::PutTotalBadgeNums( bool NotificationPreferencesDatabase::PutNotificationsEnabledForBundle( const NotificationPreferencesInfo::BundleInfo &bundleInfo, const bool &enabled) { - ANS_LOGD("%{public}s, enabled[%{public}d]", __FUNCTION__, enabled); if (bundleInfo.GetBundleName().empty()) { ANS_LOGE("Bundle name is null."); return false; } + ANS_LOGI("bundelName:%{public}s, uid:%{public}d, enabled[%{public}d]", + bundleInfo.GetBundleName().c_str(), bundleInfo.GetBundleUid(), enabled); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; } @@ -411,6 +418,8 @@ bool NotificationPreferencesDatabase::PutSlotFlags(NotificationPreferencesInfo:: return false; } + ANS_LOGI("bundelName:%{public}s, uid:%{public}d, slotFlags[%{public}d]", + bundleInfo.GetBundleName().c_str(), bundleInfo.GetBundleUid(), slotFlags); std::string bundleKey = GenerateBundleLablel(bundleInfo); int32_t result = PutBundlePropertyToDisturbeDB(bundleKey, BundleType::BUNDLE_SLOTFLGS_TYPE, slotFlags, bundleInfo.GetBundleUid()); @@ -424,6 +433,8 @@ bool NotificationPreferencesDatabase::PutHasPoppedDialog( ANS_LOGE("Bundle name is null."); return false; } + ANS_LOGI("bundelName:%{public}s, uid:%{public}d, hasPopped[%{public}d]", + bundleInfo.GetBundleName().c_str(), bundleInfo.GetBundleUid(), hasPopped); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; diff --git a/services/ans/src/notification_subscriber_manager.cpp b/services/ans/src/notification_subscriber_manager.cpp index 9d1ffc4ce654e2dcde562fccaca9c50186d327ce..a35896b0a7d0bd5ba02fd7997f86304ab6e7a4f1 100644 --- a/services/ans/src/notification_subscriber_manager.cpp +++ b/services/ans/src/notification_subscriber_manager.cpp @@ -555,11 +555,6 @@ void NotificationSubscriberManager::BatchNotifyCanceledInner(const std::vector", notifications.size()); - std::string message = "BatchNotifyCanceledInner.size:" + - std::to_string(notifications.size()) + "."; - OHOS::Notification::HaMetaMessage haMetaMessage = HaMetaMessage(1, 9) - .ErrorCode(ERR_OK); - ReportDeleteFailedEventPush(haMetaMessage, deleteReason, message); std::string notificationKeys = ""; for (auto notification : notifications) {