From a1d63cca7a7e67ea293ab2743249ab151ef0e745 Mon Sep 17 00:00:00 2001 From: xdongs Date: Wed, 16 Apr 2025 09:41:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E7=82=B9&=E6=97=A5=E5=BF=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xdongs --- .../advanced_notification_publish_service.cpp | 16 ++++++++++++---- .../ans/src/clone/notification_clone_manager.cpp | 3 +++ services/ans/src/notification_dialog.cpp | 6 +++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 0e7dd5392..7cad48922 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -1152,7 +1152,9 @@ ErrCode AdvancedNotificationService::CommonRequestEnableNotification(const std:: ANS_LOGI("%{public}s_%{public}d, deviceId: %{public}s, Request enable notification dailog result: %{public}d", bundleOption->GetBundleName().c_str(), bundleOption->GetUid(), deviceId.c_str(), result); message.ErrorCode(result); - NotificationAnalyticsUtil::ReportModifyEvent(message); + if (!innerLake || result == ERR_ANS_DIALOG_POP_SUCCEEDED) { + NotificationAnalyticsUtil::ReportModifyEvent(message); + } return result; } @@ -2704,9 +2706,15 @@ ErrCode AdvancedNotificationService::SetBadgeNumber(int32_t badgeNumber, const s ErrCode AdvancedNotificationService::SetBadgeNumberForDhByBundle( const sptr &bundleOption, int32_t badgeNumber) { - if (bundleOption == nullptr || bundleOption->GetBundleName().empty() || - bundleOption->GetUid() <= DEFAULT_UID) { - ANS_LOGE("SetBadgeNumberForDhByBundle invalid bundleOption"); + if (bundleOption == nullptr) { + ANS_LOGE("SetBadgeNumberForDhByBundle bundleOption is null"); + } + if (bundleOption->GetBundleName().empty()) { + ANS_LOGE("SetBadgeNumberForDhByBundle Invalid bundle name."); + return ERR_ANS_INVALID_PARAM; + } + if (bundleOption->GetUid() <= DEFAULT_UID) { + ANS_LOGE("SetBadgeNumberForDhByBundle invalid uid"); return ERR_ANS_INVALID_PARAM; } if (badgeNumber < BADGE_NUM_LIMIT) { diff --git a/services/ans/src/clone/notification_clone_manager.cpp b/services/ans/src/clone/notification_clone_manager.cpp index 420b60b52..a9b3a5f78 100644 --- a/services/ans/src/clone/notification_clone_manager.cpp +++ b/services/ans/src/clone/notification_clone_manager.cpp @@ -105,6 +105,7 @@ static std::string SetBackUpReply() int32_t NotificationCloneManager::OnBackup(MessageParcel& data, MessageParcel& reply) { + ANS_LOGI("OnBackup start"); HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_22, EventBranchId::BRANCH_1); if (cloneTemplates.empty()) { ANS_LOGI("Notification no need Backup."); @@ -155,6 +156,7 @@ int32_t NotificationCloneManager::OnBackup(MessageParcel& data, MessageParcel& r int32_t NotificationCloneManager::OnRestore(MessageParcel& data, MessageParcel& reply) { + ANS_LOGI("OnRestore start"); HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_22, EventBranchId::BRANCH_2); reply.WriteString(SetBackUpReply()); std::string storeMessage; @@ -186,6 +188,7 @@ int32_t NotificationCloneManager::OnRestore(MessageParcel& data, MessageParcel& iter->second->OnRestore(jsonObject.at(iter->first)); } } + ANS_LOGI("OnRestore end"); return ERR_OK; } diff --git a/services/ans/src/notification_dialog.cpp b/services/ans/src/notification_dialog.cpp index ac53a9545..5698fabc4 100644 --- a/services/ans/src/notification_dialog.cpp +++ b/services/ans/src/notification_dialog.cpp @@ -51,16 +51,16 @@ ErrCode NotificationDialog::StartEnableNotificationDialogAbility( auto topBundleName = IN_PROCESS_CALL(AAFwk::AbilityManagerClient::GetInstance()->GetTopAbility().GetBundleName()); if (topBundleName != appBundleName) { - ANS_LOGE("Current application isn't in foreground, top is %{public}s.", topBundleName.c_str()); + ANS_LOGW("Current application isn't in foreground, top is %{public}s.", topBundleName.c_str()); if (!innerLake) { return ERR_ANS_INVALID_BUNDLE; } else { - ANS_LOGE("get top ability again"); + ANS_LOGW("get top ability again"); std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME)); topBundleName = IN_PROCESS_CALL( AAFwk::AbilityManagerClient::GetInstance()->GetTopAbility().GetBundleName()); if (topBundleName != appBundleName) { - ANS_LOGE("get top ability again failed"); + ANS_LOGW("get top ability again failed"); return ERR_ANS_INVALID_BUNDLE; } } -- Gitee