From 1b99f22430afd6c9dd03721287c3cba4725540c4 Mon Sep 17 00:00:00 2001 From: z30053788 Date: Mon, 19 May 2025 16:34:07 +0800 Subject: [PATCH] update Signed-off-by: z30053788 Change-Id: Ib3bf9cd236082186c1d97061c4c1e7daa7be6627 --- .../ans/src/clone/notification_clone_manager.cpp | 6 +++--- .../src/soft_bus/distributed_publish_service.cpp | 2 +- .../soft_bus/distributed_subscribe_service.cpp | 15 ++++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/services/ans/src/clone/notification_clone_manager.cpp b/services/ans/src/clone/notification_clone_manager.cpp index 1f4d4392a..cbf791a5e 100644 --- a/services/ans/src/clone/notification_clone_manager.cpp +++ b/services/ans/src/clone/notification_clone_manager.cpp @@ -163,7 +163,7 @@ ErrCode NotificationCloneManager::LoadConfig(UniqueFd &fd, std::string& config) close(destFd); std::ifstream fs(BACKUP_CONFIG_FILE_PATH); if (!fs.is_open()) { - ANS_LOGW("Loading config file%{public}s is_open() failed!", BACKUP_CONFIG_FILE_PATH); + ANS_LOGE("Loading config file is_open() failed!"); return ANS_CLONE_ERROR; } config.clear(); @@ -181,13 +181,13 @@ ErrCode NotificationCloneManager::SaveConfig(const std::string& config) RemoveBackUpFile(); FILE* fp = fopen(BACKUP_CONFIG_FILE_PATH, "w"); if (!fp) { - ANS_LOGW("Save config file: %{public}s, fopen() failed!", BACKUP_CONFIG_FILE_PATH); + ANS_LOGE("Save config file fopen() failed!"); return ANS_CLONE_ERROR; } int ret = static_cast(fwrite(config.c_str(), 1, config.length(), fp)); if (ret != (int)config.length()) { - ANS_LOGW("Save config file: %{public}s, fwrite %{public}d failed!", BACKUP_CONFIG_FILE_PATH, ret); + ANS_LOGE("Save config file, fwrite %{public}d failed!", ret); } (void)fflush(fp); (void)fsync(fileno(fp)); diff --git a/services/distributed/src/soft_bus/distributed_publish_service.cpp b/services/distributed/src/soft_bus/distributed_publish_service.cpp index 6b685d87d..7d20b8b54 100644 --- a/services/distributed/src/soft_bus/distributed_publish_service.cpp +++ b/services/distributed/src/soft_bus/distributed_publish_service.cpp @@ -284,7 +284,7 @@ void DistributedService::PublishNotifictaion(const std::shared_ptr& boxM MakeNotifictaionIcon(requestBox, request, isCommonLiveView); MakeNotifictaionReminderFlag(requestBox, request); int result = IN_PROCESS_CALL(NotificationHelper::PublishNotification(*request)); - ANS_LOGI("Dans publish message %{public}s %{public}d.", request->Dump().c_str(), result); + ANS_LOGD("Dans publish result = %{public}d.", result); } void DistributedService::RemoveNotification(const std::shared_ptr& boxMessage) diff --git a/services/distributed/src/soft_bus/distributed_subscribe_service.cpp b/services/distributed/src/soft_bus/distributed_subscribe_service.cpp index 1a7b4b168..a6e44f7d1 100644 --- a/services/distributed/src/soft_bus/distributed_subscribe_service.cpp +++ b/services/distributed/src/soft_bus/distributed_subscribe_service.cpp @@ -213,7 +213,8 @@ void DistributedService::SendNotifictionRequest(const std::shared_ptrGetNotificationRequestPoint(); - ANS_LOGI("Dans OnConsumed %{public}s", requestPoint->Dump().c_str()); + ANS_LOGI("Dans OnConsumed Notification key = %{public}s, notificationFlag = %{public}s", request->GetKey().c_str(), + requestPoint->GetFlags() == nullptr ? "null" : requestPoint->GetFlags()->Dump().c_str()); requestBox.SetAutoDeleteTime(requestPoint->GetAutoDeletedTime()); requestBox.SetFinishTime(requestPoint->GetFinishDeadLine()); requestBox.SetNotificationHashCode(request->GetKey()); @@ -283,7 +284,9 @@ void DistributedService::OnBatchCanceled(const std::vectorDump().c_str()); + auto notificationFlags = notification->GetNotificationRequestPoint()->GetFlags(); + ANS_LOGI("Dans OnConsumed Notification key = %{public}s, notificationFlag = %{public}s", + notification->GetKey().c_str(), notificationFlags == nullptr ? "null" : notificationFlags->Dump().c_str()); keysStream << GetNotificationKey(notification) << ' '; slotTypesStream << std::to_string(notification->GetNotificationRequestPoint()->GetSlotType()) << ' '; } @@ -298,7 +301,7 @@ void DistributedService::OnBatchCanceled(const std::vector& notific std::string notificationKey = GetNotificationKey(notification); std::function task = std::bind([peerDevice, notification, notificationKey]() { NotificationRemoveBox removeBox; - ANS_LOGI("dans OnCanceled %{public}s", notification->Dump().c_str()); + auto notificationFlags = notification->GetNotificationRequestPoint()->GetFlags(); + ANS_LOGI("Dans OnCanceled Notification key = %{public}s, notificationFlag = %{public}s", + notification->GetKey().c_str(), notificationFlags == nullptr ? "null" : notificationFlags->Dump().c_str()); removeBox.SetNotificationHashCode(notificationKey); removeBox.setNotificationSlotType(notification->GetNotificationRequestPoint()->GetSlotType()); if (!removeBox.Serialize()) { - ANS_LOGW("dans OnCanceled serialize failed"); + ANS_LOGW("Dans OnCanceled serialize failed"); return; } DistributedClient::GetInstance().SendMessage(removeBox.GetByteBuffer(), removeBox.GetByteLength(), -- Gitee