From a3bdca814f2bdc0c9f2547cfa22e751b8d9aa356 Mon Sep 17 00:00:00 2001 From: liuyanzhi Date: Fri, 1 Sep 2023 06:29:06 +0000 Subject: [PATCH] fix code Signed-off-by: liuyanzhi Change-Id: I900e4bdb8393a39d054717c1b71c7447eb2a6a99 --- .../ans/src/notification_action_button.cpp | 6 ++-- .../src/notification_long_text_content.cpp | 6 ++-- .../src/notification_multiline_content.cpp | 10 +++---- frameworks/core/src/ans_image_util.cpp | 6 ++-- frameworks/core/src/ans_manager_proxy.cpp | 22 +++++++-------- frameworks/core/src/ans_manager_stub.cpp | 4 +-- frameworks/core/src/ans_notification.cpp | 28 +++++++++---------- .../ans/src/advanced_notification_service.cpp | 4 +-- .../src/notification_preferences_database.cpp | 14 +++++----- .../ans/src/notification_rdb_data_mgr.cpp | 4 +-- .../distributed/src/distributed_database.cpp | 16 +++++------ .../src/distributed_notification_manager.cpp | 16 +++++------ .../src/distributed_preferences_database.cpp | 8 +++--- 13 files changed, 72 insertions(+), 72 deletions(-) diff --git a/frameworks/ans/src/notification_action_button.cpp b/frameworks/ans/src/notification_action_button.cpp index 737676658..150e4aff4 100644 --- a/frameworks/ans/src/notification_action_button.cpp +++ b/frameworks/ans/src/notification_action_button.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -317,7 +317,7 @@ bool NotificationActionButton::Marshalling(Parcel &parcel) const if (valid) { if (!parcel.WriteParcelable(wantAgent_.get())) { - ANS_LOGE("Failed to write wantAgent"); + ANS_LOGE("Write wantAgent failed."); return false; } } @@ -391,7 +391,7 @@ bool NotificationActionButton::ReadFromParcel(Parcel &parcel) wantAgent_ = std::shared_ptr( parcel.ReadParcelable()); if (!wantAgent_) { - ANS_LOGE("Failed to read wantAgent"); + ANS_LOGE("Failed to read want agent"); return false; } } diff --git a/frameworks/ans/src/notification_long_text_content.cpp b/frameworks/ans/src/notification_long_text_content.cpp index db1119fb8..72f693110 100644 --- a/frameworks/ans/src/notification_long_text_content.cpp +++ b/frameworks/ans/src/notification_long_text_content.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -130,7 +130,7 @@ bool NotificationLongTextContent::Marshalling(Parcel &parcel) const } if (!parcel.WriteString(expandedTitle_)) { - ANS_LOGE("Failed to write expanded title"); + ANS_LOGE("Write expanded title fail."); return false; } @@ -166,7 +166,7 @@ bool NotificationLongTextContent::ReadFromParcel(Parcel &parcel) } if (!parcel.ReadString(expandedTitle_)) { - ANS_LOGE("Failed to read expanded title"); + ANS_LOGE("Read expanded title failed."); return false; } diff --git a/frameworks/ans/src/notification_multiline_content.cpp b/frameworks/ans/src/notification_multiline_content.cpp index 5e1c30ebb..f25b9841a 100644 --- a/frameworks/ans/src/notification_multiline_content.cpp +++ b/frameworks/ans/src/notification_multiline_content.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -120,7 +120,7 @@ NotificationMultiLineContent *NotificationMultiLineContent::FromJson(const nlohm bool NotificationMultiLineContent::Marshalling(Parcel &parcel) const { if (!NotificationBasicContent::Marshalling(parcel)) { - ANS_LOGE("Failed to write basic"); + ANS_LOGE("Write basic fail."); return false; } @@ -130,7 +130,7 @@ bool NotificationMultiLineContent::Marshalling(Parcel &parcel) const } if (!parcel.WriteString(briefText_)) { - ANS_LOGE("Failed to write brief text"); + ANS_LOGE("Write brief text fail."); return false; } @@ -156,7 +156,7 @@ NotificationMultiLineContent *NotificationMultiLineContent::Unmarshalling(Parcel bool NotificationMultiLineContent::ReadFromParcel(Parcel &parcel) { if (!NotificationBasicContent::ReadFromParcel(parcel)) { - ANS_LOGE("Failed to read basic"); + ANS_LOGE("Read basic failed."); return false; } @@ -166,7 +166,7 @@ bool NotificationMultiLineContent::ReadFromParcel(Parcel &parcel) } if (!parcel.ReadString(briefText_)) { - ANS_LOGE("Failed to read brief text"); + ANS_LOGE("Read brief text failed."); return false; } diff --git a/frameworks/core/src/ans_image_util.cpp b/frameworks/core/src/ans_image_util.cpp index ccce64d6d..1c410ab95 100644 --- a/frameworks/core/src/ans_image_util.cpp +++ b/frameworks/core/src/ans_image_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,7 +41,7 @@ std::string AnsImageUtil::PackImage(const std::shared_ptr &pixe std::set formats; auto ret = imagePacker.GetSupportedFormats(formats); if (ret) { - ANS_LOGE("image packer get supported format failed, ret : %{public}u", ret); + ANS_LOGE("Failed to GetSupportedFormats, ret : %{public}u", ret); return {}; } @@ -88,7 +88,7 @@ std::shared_ptr AnsImageUtil::UnPackImage(const std::string &pi Media::DecodeOptions decodeOpts; auto pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); if (errorCode || !pixelMap) { - ANS_LOGE("create pixelMap failed"); + ANS_LOGE("Failed to create pixelMap."); return {}; } diff --git a/frameworks/core/src/ans_manager_proxy.cpp b/frameworks/core/src/ans_manager_proxy.cpp index 494504b3f..e50a8445f 100644 --- a/frameworks/core/src/ans_manager_proxy.cpp +++ b/frameworks/core/src/ans_manager_proxy.cpp @@ -782,7 +782,7 @@ ErrCode AnsManagerProxy::RemoveNotification(const sptr } if (!reply.ReadInt32(result)) { - ANS_LOGE("[RemoveNotification] fail: read result failed."); + ANS_LOGE("[RemoveNotification] fail: read result error."); return ERR_ANS_PARCELABLE_FAILED; } @@ -1496,7 +1496,7 @@ ErrCode AnsManagerProxy::IsSpecialBundleAllowedNotify(const sptr } if (!reply.ReadInt32(result)) { - ANS_LOGE("[GetDoNotDisturbDate] fail: read result failed."); + ANS_LOGE("[GetDoNotDisturbDate] fail: read result error."); return ERR_ANS_PARCELABLE_FAILED; } if (result == ERR_OK) { date = reply.ReadParcelable(); if (date == nullptr) { - ANS_LOGE("[GetDoNotDisturbDate] fail: read date failed."); + ANS_LOGE("[GetDoNotDisturbDate] fail: read date error."); return ERR_ANS_PARCELABLE_FAILED; } } @@ -2094,7 +2094,7 @@ ErrCode AnsManagerProxy::InnerTransact(NotificationInterfaceCode code, MessageOp { auto remote = Remote(); if (remote == nullptr) { - ANS_LOGE("[InnerTransact] fail: get Remote fail code %{public}u", code); + ANS_LOGE("[InnerTransact] defeat: get Remote defeat code %{public}u", code); return ERR_DEAD_OBJECT; } int32_t err = remote->SendRequest(static_cast(code), data, reply, flags); @@ -2103,11 +2103,11 @@ ErrCode AnsManagerProxy::InnerTransact(NotificationInterfaceCode code, MessageOp return ERR_OK; } case DEAD_OBJECT: { - ANS_LOGE("[InnerTransact] fail: ipcErr=%{public}d code %{public}d", err, code); + ANS_LOGE("[InnerTransact] defeat: ipcErr=%{public}d code %{public}d", err, code); return ERR_DEAD_OBJECT; } default: { - ANS_LOGE("[InnerTransact] fail: ipcErr=%{public}d code %{public}d", err, code); + ANS_LOGE("[InnerTransact] defeat: ipcErr=%{public}d code %{public}d", err, code); return ERR_ANS_TRANSACT_FAILED; } } @@ -2117,13 +2117,13 @@ template bool AnsManagerProxy::WriteParcelableVector(const std::vector> &parcelableVector, MessageParcel &data) { if (!data.WriteInt32(parcelableVector.size())) { - ANS_LOGE("write ParcelableVector size failed"); + ANS_LOGE("Failed to write ParcelableVector size."); return false; } for (auto &parcelable : parcelableVector) { if (!data.WriteStrongParcelable(parcelable)) { - ANS_LOGE("write ParcelableVector failed"); + ANS_LOGE("Failed to write ParcelableVector"); return false; } } diff --git a/frameworks/core/src/ans_manager_stub.cpp b/frameworks/core/src/ans_manager_stub.cpp index f2f435117..b353d675c 100644 --- a/frameworks/core/src/ans_manager_stub.cpp +++ b/frameworks/core/src/ans_manager_stub.cpp @@ -1499,7 +1499,7 @@ bool AnsManagerStub::ReadParcelableVector(std::vector> &parcelableInfos, { int32_t infoSize = 0; if (!data.ReadInt32(infoSize)) { - ANS_LOGE("read Parcelable size failed."); + ANS_LOGE("Failed to read Parcelable size."); return false; } @@ -1508,7 +1508,7 @@ bool AnsManagerStub::ReadParcelableVector(std::vector> &parcelableInfos, for (int32_t index = 0; index < infoSize; index++) { sptr info = data.ReadStrongParcelable(); if (info == nullptr) { - ANS_LOGE("read Parcelable infos failed."); + ANS_LOGE("Failed to read Parcelable infos."); return false; } parcelableInfos.emplace_back(info); diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index 9bcbc1b6b..c9b79d153 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -111,7 +111,7 @@ ErrCode AnsNotification::GetNotificationSlotNumAsBundle(const NotificationBundle } if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); + ANS_LOGE("Fail to GetAnsManagerProxy."); return ERR_ANS_SERVICE_NOT_CONNECTED; } @@ -136,7 +136,7 @@ ErrCode AnsNotification::PublishNotification(const std::string &label, const Not } if (!CanPublishMediaContent(request)) { - ANS_LOGE("Refuse to publish the notification because the sequence numbers actions not match those assigned to " + ANS_LOGE("Refuse to publish the notification because the series numbers actions not match those assigned to " "added action buttons."); return ERR_ANS_INVALID_PARAM; } @@ -148,13 +148,13 @@ ErrCode AnsNotification::PublishNotification(const std::string &label, const Not } if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); + ANS_LOGE("Failed to GetAnsManagerProxy."); return ERR_ANS_SERVICE_NOT_CONNECTED; } sptr reqPtr = new (std::nothrow) NotificationRequest(request); if (reqPtr == nullptr) { - ANS_LOGE("Failed to create NotificationRequest ptr"); + ANS_LOGE("Create notificationRequest ptr fail."); return ERR_ANS_NO_MEMORY; } if (IsNonDistributedNotificationType(reqPtr->GetNotificationType())) { @@ -256,7 +256,7 @@ ErrCode AnsNotification::PublishNotificationAsBundle( } if (request.GetContent() == nullptr || request.GetNotificationType() == NotificationContent::Type::NONE) { - ANS_LOGE("Refuse to publish the notification without valid content"); + ANS_LOGE("Refuse to publish the notification without effective content"); return ERR_ANS_INVALID_PARAM; } @@ -268,7 +268,7 @@ ErrCode AnsNotification::PublishNotificationAsBundle( ErrCode checkErr = CheckImageSize(request); if (checkErr != ERR_OK) { - ANS_LOGE("The size of one picture exceeds the limit"); + ANS_LOGE("The size of one picture overtake the limit"); return checkErr; } @@ -382,7 +382,7 @@ ErrCode AnsNotification::SubscribeNotification( { HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); + ANS_LOGE("Failed to GetAnsManagerProxy."); return ERR_ANS_SERVICE_NOT_CONNECTED; } @@ -464,7 +464,7 @@ ErrCode AnsNotification::RemoveNotification(const NotificationBundleOption &bund } if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); + ANS_LOGE("Fail to GetAnsManagerProxy."); return ERR_ANS_SERVICE_NOT_CONNECTED; } @@ -480,7 +480,7 @@ ErrCode AnsNotification::RemoveAllNotifications(const NotificationBundleOption & } if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); + ANS_LOGE("GetAnsManagerProxy defeat."); return ERR_ANS_SERVICE_NOT_CONNECTED; } @@ -511,7 +511,7 @@ ErrCode AnsNotification::RemoveNotificationsByBundle(const NotificationBundleOpt } if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); + ANS_LOGE("Defeated to GetAnsManagerProxy."); return ERR_ANS_SERVICE_NOT_CONNECTED; } @@ -554,7 +554,7 @@ ErrCode AnsNotification::UpdateNotificationSlots( } if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); + ANS_LOGE("GetAnsManagerProxy flop."); return ERR_ANS_SERVICE_NOT_CONNECTED; } @@ -636,7 +636,7 @@ ErrCode AnsNotification::SetNotificationsEnabledForSpecifiedBundle( ErrCode AnsNotification::SetShowBadgeEnabledForBundle(const NotificationBundleOption &bundleOption, bool enabled) { if (bundleOption.GetBundleName().empty()) { - ANS_LOGE("Invalid bundle name."); + ANS_LOGE("Invalidated bundle name."); return ERR_ANS_INVALID_PARAM; } @@ -716,7 +716,7 @@ ErrCode AnsNotification::SetDoNotDisturbDate(const NotificationDoNotDisturbDate auto dndDatePtr = new (std::nothrow) NotificationDoNotDisturbDate(doNotDisturbDate); if (dndDatePtr == nullptr) { - ANS_LOGE("create DoNotDisturbDate failed."); + ANS_LOGE("Create notificationDoNotDisturbDate failed."); return ERR_ANS_NO_MEMORY; } @@ -734,7 +734,7 @@ ErrCode AnsNotification::GetDoNotDisturbDate(NotificationDoNotDisturbDate &doNot sptr dndDate = nullptr; auto ret = ansManagerProxy_->GetDoNotDisturbDate(dndDate); if (ret != ERR_OK) { - ANS_LOGE("Get DoNotDisturbDate failed."); + ANS_LOGE("GetDoNotDisturbDate failed."); return ret; } diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index ad4e64d87..7e9924100 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -1561,7 +1561,7 @@ ErrCode AdvancedNotificationService::RemoveSlotByType(const NotificationConstant } if (notificationSvrQueue_ == nullptr) { - ANS_LOGE("Serial queue is invalid."); + ANS_LOGE("notificationSvrQueue_ is nullptr."); return ERR_ANS_INVALID_PARAM; } ffrt::task_handle handler = notificationSvrQueue_->submit_h(std::bind([&]() { @@ -2643,7 +2643,7 @@ ErrCode AdvancedNotificationService::RemoveAllNotifications(const sptrsubmit_h(std::bind([&]() { diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index bbf76c1a5..40dc39b95 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -360,7 +360,7 @@ bool NotificationPreferencesDatabase::PutShowBadge( const NotificationPreferencesInfo::BundleInfo &bundleInfo, const bool &enable) { if (bundleInfo.GetBundleName().empty()) { - ANS_LOGE("Bundle name is null."); + ANS_LOGE("Bundle name is nullptr."); return false; } @@ -378,7 +378,7 @@ bool NotificationPreferencesDatabase::PutImportance( const NotificationPreferencesInfo::BundleInfo &bundleInfo, const int32_t &importance) { if (bundleInfo.GetBundleName().empty()) { - ANS_LOGE("Bundle name is null."); + ANS_LOGE("Bundle name is empty."); return false; } @@ -396,7 +396,7 @@ bool NotificationPreferencesDatabase::PutTotalBadgeNums( const NotificationPreferencesInfo::BundleInfo &bundleInfo, const int32_t &totalBadgeNum) { if (bundleInfo.GetBundleName().empty()) { - ANS_LOGE("Bundle name is null."); + ANS_LOGE("Bundle name is blank."); return false; } @@ -661,7 +661,7 @@ bool NotificationPreferencesDatabase::RemoveSlotFromDisturbeDB( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); ANS_LOGD("%{public}s", __FUNCTION__); if (bundleKey.empty()) { - ANS_LOGE("Bundle name is null."); + ANS_LOGE("Bundle name is empty."); return false; } @@ -1223,7 +1223,7 @@ void NotificationPreferencesDatabase::GetDoNotDisturbType(NotificationPreference sptr disturbDate = new (std::nothrow) NotificationDoNotDisturbDate(NotificationConstant::DoNotDisturbType::NONE, 0, 0); if (disturbDate == nullptr) { - ANS_LOGE("Failed to create NotificationDoNotDisturbDate instance"); + ANS_LOGE("Create NotificationDoNotDisturbDate instance fail."); return; } info.GetDoNotDisturbDate(userId, disturbDate); @@ -1280,7 +1280,7 @@ void NotificationPreferencesDatabase::GetDoNotDisturbEndDate(NotificationPrefere sptr disturbDate = new (std::nothrow) NotificationDoNotDisturbDate(NotificationConstant::DoNotDisturbType::NONE, 0, 0); if (disturbDate == nullptr) { - ANS_LOGE("Failed to create NotificationDoNotDisturbDate instance"); + ANS_LOGE("Defeat to create NotificationDoNotDisturbDate instance"); return; } info.GetDoNotDisturbDate(userId, disturbDate); diff --git a/services/ans/src/notification_rdb_data_mgr.cpp b/services/ans/src/notification_rdb_data_mgr.cpp index 4edd73e9f..8193db788 100644 --- a/services/ans/src/notification_rdb_data_mgr.cpp +++ b/services/ans/src/notification_rdb_data_mgr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -298,7 +298,7 @@ int32_t NotificationDataMgr::QueryDataBeginWithKey( std::string resultKey; ret = absSharedResultSet->GetString(NOTIFICATION_KEY_INDEX, resultKey); if (ret != NativeRdb::E_OK) { - ANS_LOGE("GetString key failed"); + ANS_LOGE("Failed to GetString key."); return NativeRdb::E_ERROR; } diff --git a/services/distributed/src/distributed_database.cpp b/services/distributed/src/distributed_database.cpp index 1d4c3960d..59c2ba03b 100644 --- a/services/distributed/src/distributed_database.cpp +++ b/services/distributed/src/distributed_database.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -65,7 +65,7 @@ bool DistributedDatabase::CheckKvDataManager(void) GetKvDataManager(); } if (kvDataManager_ == nullptr) { - ANS_LOGE("kvDataManager is nullptr."); + ANS_LOGE("kvDataManager_ is nullptr."); return false; } return true; @@ -89,7 +89,7 @@ void DistributedDatabase::GetKvStore(void) DistributedKv::StoreId storeId = {.storeId = STORE_ID}; DistributedKv::Status status = kvDataManager_->GetSingleKvStore(options, appId, storeId, kvStore_); if (status != DistributedKv::Status::SUCCESS) { - ANS_LOGE("kvDataManager GetSingleKvStore failed ret = 0x%{public}x", status); + ANS_LOGE("Failed to GetSingleKvStore ret = 0x%{public}x", status); kvStore_.reset(); DistributedHardware::DeviceManager::GetInstance().UnRegisterDevStateCallback(APP_ID + STORE_ID); kvDataManager_.reset(); @@ -130,7 +130,7 @@ bool DistributedDatabase::PutToDistributedDB(const std::string &key, const std:: std::lock_guard lock(mutex_); if (kvStore_ == nullptr) { - ANS_LOGE("kvStore is nullptr."); + ANS_LOGE("kvStore is null."); return false; } @@ -160,7 +160,7 @@ bool DistributedDatabase::GetFromDistributedDB(const std::string &key, std::stri } if (!KvStoreFlowControl()) { - ANS_LOGE("KvStore flow control."); + ANS_LOGE("KvStoreFlowControl is false."); return false; } @@ -182,12 +182,12 @@ bool DistributedDatabase::GetEntriesFromDistributedDB(const std::string &prefixK std::lock_guard lock(mutex_); if (kvStore_ == nullptr) { - ANS_LOGE("kvStore is nullptr."); + ANS_LOGE("kvStore_ is nullptr."); return false; } if (!KvStoreFlowControl()) { - ANS_LOGE("KvStore flow control."); + ANS_LOGE("KvStoreFlowControl is fail."); return false; } @@ -211,7 +211,7 @@ bool DistributedDatabase::DeleteToDistributedDB(const std::string &key) } if (!KvStoreFlowControl()) { - ANS_LOGE("KvStore flow control."); + ANS_LOGE("KvStoreFlowControl is defeat."); return false; } diff --git a/services/distributed/src/distributed_notification_manager.cpp b/services/distributed/src/distributed_notification_manager.cpp index 101fdebdc..1711c9c62 100644 --- a/services/distributed/src/distributed_notification_manager.cpp +++ b/services/distributed/src/distributed_notification_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -149,18 +149,18 @@ void DistributedNotificationManager::OnDatabaseInsert( ANS_LOGD("%{public}s", __FUNCTION__); ANS_LOGE("ffrt start!"); if (distributedQueue_ == nullptr) { - ANS_LOGE("Serial queue is invalid."); + ANS_LOGE("Serial queue is nullptr."); return; } distributedQueue_->submit(std::bind([=]() { ANS_LOGE("ffrt enter!"); if (!CheckDeviceId(deviceId, key)) { - ANS_LOGD("device id are not the same. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); + ANS_LOGD("device id is distinct. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); } ResolveKey resolveKey; if (!ResolveDistributedKey(key, resolveKey)) { - ANS_LOGE("key <%{public}s> is invalid.", key.c_str()); + ANS_LOGE("key <%{public}s> is invalidity.", key.c_str()); return; } @@ -342,7 +342,7 @@ ErrCode DistributedNotificationManager::Publish( ANS_LOGI("%{public}s start", __FUNCTION__); std::string key; if (!GenerateLocalDistributedKey(bundleName, label, id, key)) { - ANS_LOGE("Generate distributed key failed."); + ANS_LOGE("Failed to generate distributed key."); return ERR_ANS_DISTRIBUTED_GET_INFO_FAILED; } @@ -353,7 +353,7 @@ ErrCode DistributedNotificationManager::Publish( } if (database_ == nullptr) { - ANS_LOGE("database_ is invalid."); + ANS_LOGE("database_ is nullptr."); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } if (!database_->PutToDistributedDB(key, value)) { @@ -402,11 +402,11 @@ ErrCode DistributedNotificationManager::Delete(const std::string &bundleName, co } if (database_ == nullptr) { - ANS_LOGE("database_ is invalid."); + ANS_LOGE("database_ is nullptr."); 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("Failed to DeleteToDistributedDB. key:%{public}s", key.c_str()); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } return ERR_OK; diff --git a/services/distributed/src/distributed_preferences_database.cpp b/services/distributed/src/distributed_preferences_database.cpp index 84c81570a..375a22c72 100644 --- a/services/distributed/src/distributed_preferences_database.cpp +++ b/services/distributed/src/distributed_preferences_database.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -69,7 +69,7 @@ void DistributedPreferencesDatabase::GetKvStore(void) DistributedKv::StoreId storeId = {.storeId = STORE_ID}; DistributedKv::Status status = kvDataManager_->GetSingleKvStore(options, appId, storeId, kvStore_); if (status != DistributedKv::Status::SUCCESS) { - ANS_LOGE("kvDataManager GetSingleKvStore failed ret = 0x%{public}x", status); + ANS_LOGE("GetSingleKvStore failed ret = 0x%{public}x", status); kvStore_.reset(); kvDataManager_.reset(); } @@ -97,7 +97,7 @@ bool DistributedPreferencesDatabase::PutToDistributedDB(const std::string &key, } if (!KvStoreFlowControl()) { - ANS_LOGE("kvStore flow control."); + ANS_LOGE("KvStoreFlowControl is false."); CloseKvStore(); return false; } @@ -122,7 +122,7 @@ bool DistributedPreferencesDatabase::GetFromDistributedDB(const std::string &key } if (!KvStoreFlowControl()) { - ANS_LOGE("kvStore flow control."); + ANS_LOGE("KvStoreFlowControl is defeat."); CloseKvStore(); return false; } -- Gitee