From 580a6ba979b1efeaa43c0a1aef3dacb74a97b9d3 Mon Sep 17 00:00:00 2001 From: songbao1 Date: Fri, 1 Aug 2025 10:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BF=A1=E6=81=AF=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: songbao1 --- .../smart_reminder_center.cpp | 3 +- .../src/distributed_notification_manager.cpp | 36 +++++++++---------- .../distributed_publish_service_v2.cpp | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp index 8103a49be..f435eceeb 100644 --- a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp +++ b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp @@ -33,6 +33,7 @@ #include "notification_extension_wrapper.h" #endif #include "os_account_manager_helper.h" +#include "distributed_data_define.h" namespace OHOS { namespace Notification { @@ -488,7 +489,7 @@ void SmartReminderCenter::FillRequestExtendInfo(const string &deviceType, Device request->SetExtendInfo(extendInfo); ANS_LOGI("FillRequestExtendInfo result: %{public}s %{public}s %{public}d %{public}s %{public}d", appInfo.name.c_str(), bundleResourceInfo.label.c_str(), appInfo.appIndex, - deviceStatus.deviceId.c_str(), deviceStatus.userId); + StringAnonymous(deviceStatus.deviceId).c_str(), deviceStatus.userId); return; } ANS_LOGE("get bundleManager fail"); diff --git a/services/distributed/src/distributed_notification_manager.cpp b/services/distributed/src/distributed_notification_manager.cpp index a07645964..7467eb491 100644 --- a/services/distributed/src/distributed_notification_manager.cpp +++ b/services/distributed/src/distributed_notification_manager.cpp @@ -127,7 +127,7 @@ bool DistributedNotificationManager::CheckDeviceId(const std::string &deviceId, { ResolveKey resolveKey; if (!ResolveDistributedKey(key, resolveKey)) { - ANS_LOGE("key <%{public}s> is invalid.", key.c_str()); + ANS_LOGE("key is invalid."); return false; } @@ -144,20 +144,20 @@ void DistributedNotificationManager::OnDatabaseInsert( } distributedQueue_->submit(std::bind([=]() { if (!CheckDeviceId(deviceId, key)) { - ANS_LOGD("device id is distinct. deviceId:%{public}s key:%{public}s", - StringAnonymous(deviceId).c_str(), key.c_str()); + ANS_LOGD("device id is distinct. deviceId:%{public}s", + StringAnonymous(deviceId).c_str()); } ResolveKey resolveKey; if (!ResolveDistributedKey(key, resolveKey)) { - ANS_LOGE("key <%{public}s> is invalidity.", key.c_str()); + ANS_LOGE("key is invalidity."); return; } sptr request = NotificationJsonConverter::ConvertFromJsonString(value); if (request == nullptr) { - ANS_LOGE("convert json to request failed. key:%{public}s", key.c_str()); + ANS_LOGE("convert json to request failed."); return; } @@ -175,20 +175,20 @@ void DistributedNotificationManager::OnDatabaseUpdate( } ffrt::task_handle handler = distributedQueue_->submit_h(std::bind([=]() { if (!CheckDeviceId(deviceId, key)) { - ANS_LOGD("device id are not the same. deviceId:%{public}s key:%{public}s", - StringAnonymous(deviceId).c_str(), key.c_str()); + ANS_LOGD("device id are not the same. deviceId:%{public}s", + StringAnonymous(deviceId).c_str()); } ResolveKey resolveKey; if (!ResolveDistributedKey(key, resolveKey)) { - ANS_LOGE("key <%{public}s> is invalid.", key.c_str()); + ANS_LOGE("key is invalid."); return; } sptr request = NotificationJsonConverter::ConvertFromJsonString(value); if (request == nullptr) { - ANS_LOGE("convert json to request failed. key:%{public}s", key.c_str()); + ANS_LOGE("convert json to request failed."); return; } @@ -206,13 +206,13 @@ void DistributedNotificationManager::OnDatabaseDelete( } distributedQueue_->submit(std::bind([=]() { if (!CheckDeviceId(deviceId, key)) { - ANS_LOGD("device id are not the same. deviceId:%{public}s key:%{public}s", - StringAnonymous(deviceId).c_str(), key.c_str()); + ANS_LOGD("device id are not the same. deviceId:%{public}s", + StringAnonymous(deviceId).c_str()); } ResolveKey resolveKey; if (!ResolveDistributedKey(key, resolveKey)) { - ANS_LOGE("key <%{public}s> is invalid.", key.c_str()); + ANS_LOGE("key is invalid."); return; } @@ -328,7 +328,7 @@ ErrCode DistributedNotificationManager::Publish( std::string value; if (!NotificationJsonConverter::ConvertToJsonString(request, value)) { - ANS_LOGE("convert request to json failed. key:%{public}s", key.c_str()); + ANS_LOGE("convert request to json failed."); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } @@ -337,7 +337,7 @@ ErrCode DistributedNotificationManager::Publish( return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } if (!database_->PutToDistributedDB(key, value)) { - ANS_LOGE("put to distributed DB failed. key:%{public}s", key.c_str()); + ANS_LOGE("put to distributed DB failed."); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } @@ -356,7 +356,7 @@ ErrCode DistributedNotificationManager::Update( std::string value; if (!NotificationJsonConverter::ConvertToJsonString(request, value)) { - ANS_LOGE("convert request to json failed. key:%{public}s", key.c_str()); + ANS_LOGE("convert request to json failed."); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } @@ -365,7 +365,7 @@ ErrCode DistributedNotificationManager::Update( return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } if (!database_->PutToDistributedDB(key, value)) { - ANS_LOGE("put to distributed DB failed. key:%{public}s", key.c_str()); + ANS_LOGE("put to distributed DB failed."); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } return ERR_OK; @@ -386,7 +386,7 @@ ErrCode DistributedNotificationManager::Delete(const std::string &bundleName, co return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } if (!database_->DeleteToDistributedDB(key)) { - ANS_LOGE("Failed to DeleteToDistributedDB. key:%{public}s", key.c_str()); + ANS_LOGE("Failed to DeleteToDistributedDB."); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } return ERR_OK; @@ -406,7 +406,7 @@ ErrCode DistributedNotificationManager::DeleteRemoteNotification( return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } if (!database_->DeleteToDistributedDB(key)) { - ANS_LOGE("delete to distributed DB failed. key:%{public}s", key.c_str()); + ANS_LOGE("delete to distributed DB failed."); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } return ERR_OK; diff --git a/services/distributed/src/soft_bus/distributed_publish_service_v2.cpp b/services/distributed/src/soft_bus/distributed_publish_service_v2.cpp index d643b8413..cc83eb003 100644 --- a/services/distributed/src/soft_bus/distributed_publish_service_v2.cpp +++ b/services/distributed/src/soft_bus/distributed_publish_service_v2.cpp @@ -645,7 +645,7 @@ bool DistributedPublishService::FillSyncRequestExtendInfo(const sptrSetSmallIcon(AnsImageUtil::CreatePixelMapByString(resourceInfo.icon)); requestBox->SetReceiverUserId(userId); ANS_LOGI("Dans fill %{public}s %{public}d %{public}s %{public}d", resourceInfo.label.c_str(), appInfo.appIndex, - deviceId.c_str(), userId); + StringAnonymous(deviceId).c_str(), userId); return true; } wantParam.SetParam(EXTENDINFO_INFO_PRE + EXTENDINFO_DEVICE_ID + "_" + deviceType, AAFwk::String::Box(deviceId)); -- Gitee