From a5ecd190b3d747f1ce46cd8de4accbdb7f5dede0 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Tue, 3 Dec 2024 14:06:54 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=B4=E6=B5=8B?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: Ibbe36862668078d855aee1209ed7de4f18b52728 --- frameworks/core/src/ans_notification.cpp | 10 ++++++++-- services/ans/src/advanced_notification_utils.cpp | 4 ++++ services/ans/src/notification_preferences_database.cpp | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index 655393448..15fc629f2 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_utils.cpp b/services/ans/src/advanced_notification_utils.cpp index ff581aa3d..e6c0fdd4c 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 20e0c68d4..7b1909fe3 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -321,6 +321,7 @@ bool NotificationPreferencesDatabase::PutShowBadge( return false; } + ANS_LOGI("bundelName:%{public}s, showBadge[%{public}d]",bundleInfo.GetBundleName().c_str() , enable); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; } @@ -369,12 +370,12 @@ 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, enabled[%{public}d]",bundleInfo.GetBundleName().c_str() , enabled); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; } -- Gitee From 9b94b0cf4deb1ad76c1fb7e7f0d2428c45552385 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Tue, 3 Dec 2024 16:37:36 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=B4=E6=B5=8B?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: Ie1ead68957df8fac155386e7c0e27ddf281cdbff --- .../ans/src/notification_preferences_database.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index 7b1909fe3..3e883aa50 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -320,8 +320,9 @@ 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); - ANS_LOGI("bundelName:%{public}s, showBadge[%{public}d]",bundleInfo.GetBundleName().c_str() , enable); if (!CheckBundle(bundleInfo.GetBundleName(), bundleInfo.GetBundleUid())) { return false; } @@ -339,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; @@ -357,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; @@ -375,7 +380,8 @@ bool NotificationPreferencesDatabase::PutNotificationsEnabledForBundle( return false; } - ANS_LOGI("bundelName:%{public}s, enabled[%{public}d]",bundleInfo.GetBundleName().c_str() , enabled); + 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; } @@ -412,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()); @@ -425,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; -- Gitee From c8ff0261534533990721a67ef190c2a1ca0a412e Mon Sep 17 00:00:00 2001 From: luojingsong Date: Wed, 27 Nov 2024 14:23:05 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=8C=85=E5=90=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E7=82=B9=E7=BC=BA=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: Ibbe221caa229e3cb9dcadec19d2be83b550798e7 --- services/ans/src/advanced_notification_publish_service.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 35e5ea9ca..488409c5d 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -141,6 +141,7 @@ 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."); break; } -- Gitee From e68c4ec94f89256aff76f9aef152df7b23ae45b1 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Thu, 28 Nov 2024 14:23:05 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=8C=85=E5=90=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E7=82=B9=E7=BC=BA=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: I5a4073f9898fe99c984ae6bfecad445b32a7c36b --- services/ans/src/advanced_notification_publish_service.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 488409c5d..1f792c551 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -142,6 +142,7 @@ ErrCode AdvancedNotificationService::Publish(const std::string &label, const spt result = PrepareNotificationInfo(request, bundleOption); if (result != ERR_OK) { message.ErrorCode(result).Message("PrepareNotificationInfo failed."); + NotificationAnalyticsUtil::ReportPublishFailedEvent(request, message); break; } -- Gitee From ee60866dd3bea2c748e47a58012a6f318a744fe7 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Thu, 28 Nov 2024 14:29:10 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=8C=85=E5=90=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E7=82=B9=E7=BC=BA=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: Idcff84628372a9275f4c1e6224f9c4bae115f233 --- services/ans/src/notification_subscriber_manager.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/services/ans/src/notification_subscriber_manager.cpp b/services/ans/src/notification_subscriber_manager.cpp index 9d1ffc4ce..a35896b0a 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) { -- Gitee From 16f0a9a186ccc7ded2cfefde3b37fa6f7fb7d7f3 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Thu, 28 Nov 2024 14:44:00 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=8C=85=E5=90=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E7=82=B9=E7=BC=BA=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: Idcc6720d2d47ce1e929e3365b8df39697637c36c --- services/ans/src/advanced_notification_service.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 8b3ab5fa1..d9200209b 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -1253,10 +1253,6 @@ 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()); return ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED; } -- Gitee From 40c42d8fdb121b58f6daf4e1c93a73f9bf5daf74 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Thu, 28 Nov 2024 14:46:21 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=8C=85=E5=90=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E7=82=B9=E7=BC=BA=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: I14bb7e6ef3c93deca9635c5bf2cbb448c4d1876b --- frameworks/ans/src/notification_subscriber.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/ans/src/notification_subscriber.cpp b/frameworks/ans/src/notification_subscriber.cpp index 5e5661188..f44ee4100 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; } -- Gitee From 36f759a0d03d5f0e4321897b504b7f23e9ecea86 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Thu, 28 Nov 2024 18:47:56 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=8C=85=E5=90=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E7=82=B9=E7=BC=BA=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: I2fb9d4498309d33570151aa136d977c909a36d59 --- services/ans/src/advanced_notification_service.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index d9200209b..396473429 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -1252,8 +1252,6 @@ ErrCode AdvancedNotificationService::RemoveFromNotificationList(const sptrnotification->IsRemoveAllowed()) { ANS_LOGI("BatchRemove-FILTER-RemoveNotAllowed-%{public}s", record->notification->GetKey().c_str()); - std::string message = "notification unremove."; - ANS_LOGE("%{public}s", message.c_str()); return ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED; } notification = record->notification; @@ -1296,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("BatchRemove-FILTER-RemoveNotAllowed-%{public}s", record->notification->GetKey().c_str()); return ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED; } notification = record->notification; -- Gitee From d3b6a80d124cadbf6d87694dbf6d1b279771d3de Mon Sep 17 00:00:00 2001 From: luojingsong Date: Thu, 28 Nov 2024 18:49:34 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=8C=85=E5=90=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E7=82=B9=E7=BC=BA=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luojingsong Change-Id: I06105384b65ae64a39421146014f23f0bc82e9f1 --- services/ans/src/advanced_notification_service.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 396473429..ab12a06c0 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -1251,7 +1251,7 @@ ErrCode AdvancedNotificationService::RemoveFromNotificationList(const sptrnotification->IsRemoveAllowed()) { - ANS_LOGI("BatchRemove-FILTER-RemoveNotAllowed-%{public}s", record->notification->GetKey().c_str()); + ANS_LOGI("UnRemoved-%{public}s", record->notification->GetKey().c_str()); return ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED; } notification = record->notification; @@ -1294,7 +1294,7 @@ ErrCode AdvancedNotificationService::RemoveFromNotificationList( } if (!isCancel && !record->notification->IsRemoveAllowed()) { - ANS_LOGI("BatchRemove-FILTER-RemoveNotAllowed-%{public}s", record->notification->GetKey().c_str()); + ANS_LOGI("UnRemoved-%{public}s", record->notification->GetKey().c_str()); return ERR_ANS_NOTIFICATION_IS_UNALLOWED_REMOVEALLOWED; } notification = record->notification; -- Gitee