From 05df7d512d41aadcb70d4fe3208bb2a2254ee737 Mon Sep 17 00:00:00 2001 From: heguokai Date: Mon, 24 Mar 2025 16:48:59 +0800 Subject: [PATCH 1/5] log Signed-off-by: heguokai --- frameworks/ans/src/notification.cpp | 2 +- .../ans/src/notification_button_option.cpp | 2 +- .../src/notification_live_view_content.cpp | 2 +- .../ans/src/notification_operation_info.cpp | 18 +++--- frameworks/ans/src/notification_request.cpp | 20 +++--- frameworks/ans/src/notification_slot.cpp | 4 +- frameworks/ans/src/notification_sorting.cpp | 2 +- .../ans/src/notification_subscriber.cpp | 2 +- frameworks/ans/src/push_callback_stub.cpp | 6 +- frameworks/core/src/ans_image_util.cpp | 18 +++--- frameworks/core/src/ans_notification.cpp | 4 +- .../src/listener/ans_subscriber_listener.cpp | 26 ++++---- .../src/listener/ans_subscriber_proxy.cpp | 4 +- .../core/src/listener/ans_subscriber_stub.cpp | 22 +++---- .../manager/ans_manager_death_recipient.cpp | 4 +- .../src/manager/ans_manager_proxy_utils.cpp | 2 +- frameworks/js/napi/src/cancel.cpp | 20 +++--- frameworks/js/napi/src/common.cpp | 4 +- .../js/napi/src/common_convert_content.cpp | 4 +- .../js/napi/src/common_convert_liveview.cpp | 6 +- .../js/napi/src/common_convert_request.cpp | 12 ++-- .../js/napi/src/disable_notification.cpp | 2 +- frameworks/js/napi/src/display_badge.cpp | 14 ++-- frameworks/js/napi/src/distributed.cpp | 6 +- .../src/distributed_operation_callback.cpp | 8 +-- frameworks/js/napi/src/disturb_mode.cpp | 14 ++-- .../js/napi/src/enable_notification.cpp | 12 ++-- .../src/manager/napi_disable_notification.cpp | 8 ++- .../src/manager/napi_distributed_enable.cpp | 22 +++---- .../src/manager/napi_enable_notification.cpp | 8 +-- .../js/napi/src/manager/napi_get_active.cpp | 6 +- .../napi/src/manager/napi_push_callback.cpp | 2 +- .../js/napi/src/manager/napi_remove_group.cpp | 8 +-- .../js/napi/src/manager/napi_sync_config.cpp | 8 +-- frameworks/js/napi/src/publish.cpp | 26 ++++---- frameworks/js/napi/src/reminder/publish.cpp | 42 ++++++------ .../js/napi/src/reminder/reminder_common.cpp | 64 +++++++++---------- frameworks/js/napi/src/remove.cpp | 26 ++++---- .../reminder/src/reminder_request_factory.cpp | 4 +- .../reminder/src/reminder_request_timer.cpp | 8 +-- .../src/reminder_service_load_callback.cpp | 2 +- interfaces/ndk/src/notification.cpp | 2 +- ...nced_notification_flow_control_service.cpp | 2 +- .../ans/src/advanced_notification_utils.cpp | 6 +- services/ans/src/bundle_manager_helper.cpp | 2 +- .../src/clone/notification_clone_manager.cpp | 16 ++--- .../common/notification_analytics_util.cpp | 8 +-- .../src/common/notification_config_parse.cpp | 10 +-- .../add_do_not_disturb_profiles.cpp | 2 +- .../get_do_not_disturb_profile.cpp | 4 +- .../remove_do_not_disturb_profiles.cpp | 2 +- .../set_do_not_disturb_date.cpp | 2 +- .../distributed_device_manager.cpp | 2 +- .../distributed_extension_service.cpp | 20 +++--- .../notification_operation_service.cpp | 2 +- .../smart_reminder_center.cpp | 6 +- .../src/reminder_swing_decision_center.cpp | 2 +- .../ans/src/utils/notifictaion_load_utils.cpp | 2 +- .../src/reminder_config_change_observer.cpp | 2 +- .../reminder/src/reminder_data_manager.cpp | 4 +- .../src/reminder_data_manager_inner.cpp | 16 ++--- 61 files changed, 294 insertions(+), 292 deletions(-) diff --git a/frameworks/ans/src/notification.cpp b/frameworks/ans/src/notification.cpp index de8e4950f..4377d7d03 100644 --- a/frameworks/ans/src/notification.cpp +++ b/frameworks/ans/src/notification.cpp @@ -315,7 +315,7 @@ bool Notification::MarshallingString(Parcel &parcel) const bool Notification::MarshallingInt32(Parcel &parcel) const { if (!parcel.WriteInt32(ledLightColor_)) { - ANS_LOGE("Can't write ledLigthColor"); + ANS_LOGE("Can't write ledLightColor"); return false; } diff --git a/frameworks/ans/src/notification_button_option.cpp b/frameworks/ans/src/notification_button_option.cpp index f125e02cb..5e2437a22 100644 --- a/frameworks/ans/src/notification_button_option.cpp +++ b/frameworks/ans/src/notification_button_option.cpp @@ -74,7 +74,7 @@ NotificationButtonOption *NotificationButtonOption::FromJson(const nlohmann::jso bool NotificationButtonOption::Marshalling(Parcel &parcel) const { if (!parcel.WriteString(buttonName_)) { - ANS_LOGE("Failed to write title"); + ANS_LOGE("Failed to write buttonName"); return false; } diff --git a/frameworks/ans/src/notification_live_view_content.cpp b/frameworks/ans/src/notification_live_view_content.cpp index dbac5cc7e..cda062ac7 100644 --- a/frameworks/ans/src/notification_live_view_content.cpp +++ b/frameworks/ans/src/notification_live_view_content.cpp @@ -220,7 +220,7 @@ bool NotificationLiveViewContent::Marshalling(Parcel &parcel) const } if (valid) { if (!parcel.WriteParcelable(extraInfo_.get())) { - ANS_LOGE("Failed to write additionalParams"); + ANS_LOGE("Failed to write extraInfo"); return false; } } diff --git a/frameworks/ans/src/notification_operation_info.cpp b/frameworks/ans/src/notification_operation_info.cpp index d02c30f2e..692e01622 100644 --- a/frameworks/ans/src/notification_operation_info.cpp +++ b/frameworks/ans/src/notification_operation_info.cpp @@ -88,27 +88,27 @@ std::string NotificationOperationInfo::Dump() bool NotificationOperationInfo::Marshalling(Parcel &parcel) const { if (!parcel.WriteString(actionName_)) { - ANS_LOGE("Failed to write action name"); + ANS_LOGE("Failed to write actionName"); return false; } if (!parcel.WriteString(userInput_)) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write userInput"); return false; } if (!parcel.WriteString(hashCode_)) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write hashCode"); return false; } if (!parcel.WriteString(eventId_)) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write eventId"); return false; } if (!parcel.WriteInt32(static_cast(operationType_))) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write operationType"); return false; } @@ -118,22 +118,22 @@ bool NotificationOperationInfo::Marshalling(Parcel &parcel) const bool NotificationOperationInfo::ReadFromParcel(Parcel &parcel) { if (!parcel.ReadString(actionName_)) { - ANS_LOGE("Failed to read action name"); + ANS_LOGE("Failed to read actionName"); return false; } if (!parcel.ReadString(userInput_)) { - ANS_LOGE("Failed to read user input"); + ANS_LOGE("Failed to read userInput"); return false; } if (!parcel.ReadString(hashCode_)) { - ANS_LOGE("Failed to read action name"); + ANS_LOGE("Failed to read hashCode"); return false; } if (!parcel.ReadString(eventId_)) { - ANS_LOGE("Failed to read user input"); + ANS_LOGE("Failed to read eventId"); return false; } diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index a7b01c4c9..c1f298089 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -236,7 +236,7 @@ void NotificationRequest::SetIsAgentNotification(bool isAgent) void NotificationRequest::AddMessageUser(const std::shared_ptr &messageUser) { if (!messageUser) { - ANS_LOGI("messageUser can not be null"); + ANS_LOGE("messageUser can not be null"); return; } @@ -364,20 +364,20 @@ bool NotificationRequest::IsColorEnabled() const // no valid content if (!notificationContent_) { - ANS_LOGI("no valid notification content"); + ANS_LOGE("no valid notification content"); return false; } // not a media content if (NotificationContent::Type::MEDIA != notificationContentType_) { - ANS_LOGI("not a media notification content"); + ANS_LOGE("not a media notification content"); return false; } auto basicContent = notificationContent_->GetNotificationContent(); auto mediaContent = std::static_pointer_cast(basicContent); if (!mediaContent->GetAVToken()) { - ANS_LOGI("AVToken has not been attached"); + ANS_LOGE("AVToken has not been attached"); return false; } @@ -1136,7 +1136,7 @@ bool NotificationRequest::Marshalling(Parcel &parcel) const } if (!parcel.WriteString(distributedHashCode_)) { - ANS_LOGE("Failed to write sound"); + ANS_LOGE("Failed to write distributedHashCode"); return false; } @@ -1618,7 +1618,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t slotTypeValue = parcel.ReadInt32(); if (slotTypeValue < 0 || slotTypeValue >= static_cast(NotificationConstant::SlotType::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid slot type value :%{public}d. It should be in [0 , %{public}d).", + ANS_LOGE("Invalid SlotType:%{public}d. It should be in [0 , %{public}d).", slotTypeValue, static_cast(NotificationConstant::SlotType::ILLEGAL_TYPE)); return false; } @@ -1626,7 +1626,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t groupAlertTypeValue = parcel.ReadInt32(); if (groupAlertTypeValue < 0 || groupAlertTypeValue >= static_cast(NotificationRequest::GroupAlertType::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid groupAlert type value :%{public}d. It should be in [0 , %{public}d).", + ANS_LOGE("Invalid GroupAlertType:%{public}d. It should be in [0 , %{public}d).", groupAlertTypeValue, static_cast(NotificationRequest::GroupAlertType::ILLEGAL_TYPE)); return false; } @@ -1634,14 +1634,14 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t visiblenessTypeValue = parcel.ReadInt32(); if (visiblenessTypeValue < 0 || visiblenessTypeValue >= static_cast(NotificationConstant::VisiblenessType::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid visibleness type value :%{public}d. It should be in [0 , %{public}d).", + ANS_LOGE("Invalid VisiblenessType:%{public}d. It should be in [0 , %{public}d).", visiblenessTypeValue, static_cast(NotificationConstant::VisiblenessType::ILLEGAL_TYPE)); return false; } visiblenessType_ = static_cast(visiblenessTypeValue); int32_t badgeStyleValue = parcel.ReadInt32(); if (badgeStyleValue < 0) { - ANS_LOGE("Invalid badge style value :%{public}d. It should be greater than 0.", badgeStyleValue); + ANS_LOGE("Invalid badgeStyle:%{public}d. It should be greater than 0.", badgeStyleValue); return false; } if (badgeStyleValue >= static_cast(NotificationRequest::BadgeStyle::ILLEGAL_TYPE)) { @@ -1653,7 +1653,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t notificationContentTypeValue = parcel.ReadInt32(); if (notificationContentTypeValue <= static_cast(NotificationContent::Type::NONE) || notificationContentTypeValue >= static_cast(NotificationContent::Type::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid notification content type value :%{public}d. It should be in (%{public}d , %{public}d)", + ANS_LOGE("Invalid notificationContent:%{public}d. It should be in (%{public}d , %{public}d)", notificationContentTypeValue, static_cast(NotificationContent::Type::NONE), static_cast(NotificationContent::Type::ILLEGAL_TYPE)); return false; diff --git a/frameworks/ans/src/notification_slot.cpp b/frameworks/ans/src/notification_slot.cpp index 61ce2be2d..59385e761 100644 --- a/frameworks/ans/src/notification_slot.cpp +++ b/frameworks/ans/src/notification_slot.cpp @@ -387,12 +387,12 @@ bool NotificationSlot::Marshalling(Parcel &parcel) const if (sound_.ToString().empty()) { if (!parcel.WriteInt32(VALUE_NULL)) { - ANS_LOGE("Failed to write int"); + ANS_LOGE("Failed to write VALUE_NULL"); return false; } } else { if (!parcel.WriteInt32(VALUE_OBJECT)) { - ANS_LOGE("Failed to write int"); + ANS_LOGE("Failed to write VALUE_OBJECT"); return false; } if (!parcel.WriteString((sound_.ToString()))) { diff --git a/frameworks/ans/src/notification_sorting.cpp b/frameworks/ans/src/notification_sorting.cpp index 6a392de8b..804e447eb 100644 --- a/frameworks/ans/src/notification_sorting.cpp +++ b/frameworks/ans/src/notification_sorting.cpp @@ -83,7 +83,7 @@ bool NotificationSorting::Marshalling(Parcel &parcel) const } if (!parcel.WriteInt32(visiblenessOverride_)) { - ANS_LOGE("Can't write importance"); + ANS_LOGE("Can't write visiblenessOverride"); return false; } diff --git a/frameworks/ans/src/notification_subscriber.cpp b/frameworks/ans/src/notification_subscriber.cpp index cd256b4fe..0ae73181b 100644 --- a/frameworks/ans/src/notification_subscriber.cpp +++ b/frameworks/ans/src/notification_subscriber.cpp @@ -85,7 +85,7 @@ bool NotificationSubscriber::ProcessSyncDecision( if (deviceType.size() <= 0 || deviceType.compare(NotificationConstant::CURRENT_DEVICE_TYPE) == 0) { return true; } - ANS_LOGI("Cannot find deviceFlags,notificationKey = %{public}s, deviceType: %{public}s.", + ANS_LOGE("Cannot find deviceFlags,notificationKey = %{public}s, deviceType: %{public}s.", request->GetKey().c_str(), deviceType.c_str()); return false; } diff --git a/frameworks/ans/src/push_callback_stub.cpp b/frameworks/ans/src/push_callback_stub.cpp index aefe12c23..7b317d7bf 100644 --- a/frameworks/ans/src/push_callback_stub.cpp +++ b/frameworks/ans/src/push_callback_stub.cpp @@ -156,12 +156,12 @@ void PushCallBackProxy::HandleEventControl( std::string eventControl, const std::shared_ptr &pushCallBackParam) { if (pushCallBackParam == nullptr) { - ANS_LOGI("pushCallBackParam is null"); + ANS_LOGE("pushCallBackParam is null"); return; } std::string event = pushCallBackParam->event; if (event.empty()) { - ANS_LOGI("event is null"); + ANS_LOGE("event is null"); return; } ANS_LOGI("eventControl:%{public}s,event:%{public}s", eventControl.c_str(), event.c_str()); @@ -174,7 +174,7 @@ void PushCallBackProxy::HandleEventControl( return; } if (jsonObject.find(event) == jsonObject.cend()) { - ANS_LOGI("This event has not eventControl"); + ANS_LOGE("This event has not eventControl"); return; } pushCallBackParam->eventControl = jsonObject.at(event).dump(); diff --git a/frameworks/core/src/ans_image_util.cpp b/frameworks/core/src/ans_image_util.cpp index 601168f1c..f5c2458bb 100644 --- a/frameworks/core/src/ans_image_util.cpp +++ b/frameworks/core/src/ans_image_util.cpp @@ -42,12 +42,12 @@ std::string AnsImageUtil::PackImage(const std::shared_ptr &pixe std::set formats; auto ret = imagePacker.GetSupportedFormats(formats); if (ret) { - ANS_LOGE("Failed to GetSupportedFormats, ret : %{public}u", ret); + ANS_LOGE("Failed to GetSupportedFormats, ret:%{public}u", ret); return {}; } auto size = static_cast(pixelMap->GetByteCount()); - ANS_LOGD("size of pixelMap : %{public}u", size); + ANS_LOGD("size of pixelMap:%{public}u", size); if (size < DEFAULT_SIZE) { size = DEFAULT_SIZE; } @@ -61,7 +61,7 @@ std::string AnsImageUtil::PackImage(const std::shared_ptr &pixe imagePacker.AddImage(*pixelMap); int64_t packedSize {0}; imagePacker.FinalizePacking(packedSize); - ANS_LOGD("packed size : %{public}" PRId64, packedSize); + ANS_LOGD("packed size:%{public}" PRId64, packedSize); std::string pixelMapStr(reinterpret_cast(pbuf), static_cast(packedSize)); delete [] pbuf; @@ -106,7 +106,7 @@ bool AnsImageUtil::PackImage2File( const std::string &format) { if (!pixelMap || outFilePath.empty() || format.empty()) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return false; } @@ -127,14 +127,14 @@ bool AnsImageUtil::PackImage2File( imagePacker.AddImage(*pixelMap); int64_t packedSize {0}; imagePacker.FinalizePacking(packedSize); - ANS_LOGI("packed size : %{public}" PRId64, packedSize); + ANS_LOGI("packed size:%{public}" PRId64, packedSize); return true; } std::shared_ptr AnsImageUtil::CreatePixelMap(const std::string &inFilePath, const std::string &format) { if (inFilePath.empty() || format.empty()) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return {}; } @@ -150,7 +150,7 @@ std::shared_ptr AnsImageUtil::CreatePixelMap(const std::string std::set formats; auto ret = imageSource->GetSupportedFormats(formats); if (ret) { - ANS_LOGE("image packer get supported format failed, ret : %{public}u", ret); + ANS_LOGE("image packer get supported format failed, ret:%{public}u", ret); return {}; } @@ -167,7 +167,7 @@ std::shared_ptr AnsImageUtil::CreatePixelMap(const std::string bool AnsImageUtil::ImageScale(const std::shared_ptr &pixelMap, int32_t width, int32_t height) { if (!pixelMap || width == 0 || height == 0) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return false; } @@ -186,7 +186,7 @@ bool AnsImageUtil::ImageScale(const std::shared_ptr &pixelMap, std::shared_ptr AnsImageUtil::CreatePixelMapByString(const std::string &imagedata) { if (imagedata.empty()) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return {}; } diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index d48a2998f..f199dd41d 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -84,7 +84,7 @@ ErrCode AnsNotification::AddNotificationSlots(const std::vector proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -1478,7 +1478,7 @@ ErrCode AnsNotification::CheckImageSize(const NotificationRequest &request) auto bigIcon = request.GetBigIcon(); if (NotificationRequest::CheckImageOverSizeForPixelMap(bigIcon, MAX_ICON_SIZE)) { request.ResetBigIcon(); - ANS_LOGI("The size of big icon exceeds limit"); + ANS_LOGW("The size of big icon exceeds limit"); } return ERR_OK; diff --git a/frameworks/core/src/listener/ans_subscriber_listener.cpp b/frameworks/core/src/listener/ans_subscriber_listener.cpp index 5b4ed3536..6621e30a9 100644 --- a/frameworks/core/src/listener/ans_subscriber_listener.cpp +++ b/frameworks/core/src/listener/ans_subscriber_listener.cpp @@ -33,7 +33,7 @@ void SubscriberListener::OnConnected() HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnConnected(); @@ -44,7 +44,7 @@ void SubscriberListener::OnDisconnected() HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnDisconnected(); @@ -56,7 +56,7 @@ void SubscriberListener::OnConsumed( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } @@ -86,7 +86,7 @@ void SubscriberListener::OnCanceled( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } if (notificationMap == nullptr) { @@ -103,7 +103,7 @@ void SubscriberListener::OnBatchCanceled(const std::vector> & { auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } std::vector> notificationList; @@ -125,7 +125,7 @@ void SubscriberListener::OnCanceledList(const std::vector> &n HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } if (subscriber->HasOnBatchCancelCallback()) { @@ -141,7 +141,7 @@ void SubscriberListener::OnUpdated(const sptr ¬ificat { auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnUpdate(std::make_shared(*notificationMap)); @@ -151,7 +151,7 @@ void SubscriberListener::OnDoNotDisturbDateChange(const sptrOnDoNotDisturbDateChange(std::make_shared(*date)); @@ -163,7 +163,7 @@ void SubscriberListener::OnEnabledNotificationChanged( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnEnabledNotificationChanged(std::make_shared(*callbackData)); @@ -174,7 +174,7 @@ void SubscriberListener::OnBadgeChanged(const sptr &bad HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnBadgeChanged(std::make_shared(*badgeData)); @@ -186,7 +186,7 @@ void SubscriberListener::OnBadgeEnabledChanged( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnBadgeEnabledChanged(callbackData); @@ -195,10 +195,10 @@ void SubscriberListener::OnBadgeEnabledChanged( void SubscriberListener::OnApplicationInfoNeedChanged(const std::string& bundleName) { HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); - ANS_LOGE("OnApplicationInfoNeedChanged SubscriberListener 1."); + ANS_LOGD("OnApplicationInfoNeedChanged SubscriberListener 1."); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnApplicationInfoNeedChanged(bundleName); diff --git a/frameworks/core/src/listener/ans_subscriber_proxy.cpp b/frameworks/core/src/listener/ans_subscriber_proxy.cpp index a4f53f45f..e1ba775b8 100644 --- a/frameworks/core/src/listener/ans_subscriber_proxy.cpp +++ b/frameworks/core/src/listener/ans_subscriber_proxy.cpp @@ -411,7 +411,7 @@ void AnsSubscriberProxy::OnApplicationInfoNeedChanged(const std::string& bundleN } if (!data.WriteString(bundleName)) { - ANS_LOGE("Write callback data failed."); + ANS_LOGE("Write bundleName failed."); return; } @@ -433,7 +433,7 @@ ErrCode AnsSubscriberProxy::OnOperationResponse(const sptr notification = data.ReadParcelable(); if (!notification) { - ANS_LOGW("[HandleOnCanceledMap] fail: notification ReadParcelable failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: notification ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } bool existMap = false; if (!data.ReadBool(existMap)) { - ANS_LOGW("[HandleOnCanceledMap] fail: read existMap failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: read existMap failed"); return ERR_ANS_PARCELABLE_FAILED; } @@ -185,14 +185,14 @@ ErrCode AnsSubscriberStub::HandleOnCanceledMap(MessageParcel &data, MessageParce if (existMap) { notificationMap = data.ReadParcelable(); if (notificationMap == nullptr) { - ANS_LOGW("[HandleOnCanceledMap] fail: read NotificationSortingMap failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: read NotificationSortingMap failed"); return ERR_ANS_PARCELABLE_FAILED; } } int32_t reason = 0; if (!data.ReadInt32(reason)) { - ANS_LOGW("[HandleOnCanceledMap] fail: read reason failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: read reason failed"); return ERR_ANS_PARCELABLE_FAILED; } @@ -240,7 +240,7 @@ bool AnsSubscriberStub::ReadParcelableVector(std::vector> &parcelableInf { int32_t infoSize = 0; if (!data.ReadInt32(infoSize)) { - ANS_LOGE("read Parcelable size failed."); + ANS_LOGE("read infoSize failed"); return false; } @@ -262,7 +262,7 @@ ErrCode AnsSubscriberStub::HandleOnUpdated(MessageParcel &data, MessageParcel &r { sptr notificationMap = data.ReadParcelable(); if (!notificationMap) { - ANS_LOGW("[HandleOnUpdated] fail: notificationMap ReadParcelable failed"); + ANS_LOGE("[HandleOnUpdated] fail: notificationMap ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } @@ -274,7 +274,7 @@ ErrCode AnsSubscriberStub::HandleOnDoNotDisturbDateChange(MessageParcel &data, M { sptr date = data.ReadParcelable(); if (!date) { - ANS_LOGW("[HandleOnDoNotDisturbDateChange] fail: date ReadParcelable failed"); + ANS_LOGE("[HandleOnDoNotDisturbDateChange] fail: date ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } OnDoNotDisturbDateChange(date); @@ -285,7 +285,7 @@ ErrCode AnsSubscriberStub::HandleOnEnabledNotificationChanged(MessageParcel &dat { sptr callbackData = data.ReadParcelable(); if (!callbackData) { - ANS_LOGW("[HandleOnEnabledNotificationChanged] fail: callbackData ReadParcelable failed"); + ANS_LOGE("[HandleOnEnabledNotificationChanged] fail: callbackData ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } OnEnabledNotificationChanged(callbackData); @@ -296,7 +296,7 @@ ErrCode AnsSubscriberStub::HandleOnBadgeChanged(MessageParcel &data, MessageParc { sptr callbackData = data.ReadParcelable(); if (!callbackData) { - ANS_LOGW("[HandleOnBadgeChanged] fail: callbackData ReadParcelable failed"); + ANS_LOGE("[HandleOnBadgeChanged] fail: callbackData ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } OnBadgeChanged(callbackData); @@ -329,7 +329,7 @@ ErrCode AnsSubscriberStub::HandleOnResponse(MessageParcel &data, MessageParcel & { sptr operationInfo = data.ReadParcelable(); if (!operationInfo) { - ANS_LOGW("notification ReadParcelable failed"); + ANS_LOGE("notification ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } ErrCode result = OnOperationResponse(operationInfo); diff --git a/frameworks/core/src/manager/ans_manager_death_recipient.cpp b/frameworks/core/src/manager/ans_manager_death_recipient.cpp index 9048f8a58..2eb9bc1d9 100644 --- a/frameworks/core/src/manager/ans_manager_death_recipient.cpp +++ b/frameworks/core/src/manager/ans_manager_death_recipient.cpp @@ -31,13 +31,13 @@ void AnsManagerDeathRecipient::SubscribeSAManager() auto samgrProxy = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); statusChangeListener_ = new (std::nothrow) AnsManagerDeathRecipient::SystemAbilityStatusChangeListener(); if (samgrProxy == nullptr || statusChangeListener_ == nullptr) { - ANS_LOGI("GetSystemAbilityManager failed or new SystemAbilityStatusChangeListener failed"); + ANS_LOGE("GetSystemAbilityManager failed or new SystemAbilityStatusChangeListener failed"); statusChangeListener_ = nullptr; return; } int32_t ret = samgrProxy->SubscribeSystemAbility(ADVANCED_NOTIFICATION_SERVICE_ABILITY_ID, statusChangeListener_); if (ret != ERR_OK) { - ANS_LOGI("SubscribeSystemAbility to sa manager failed"); + ANS_LOGE("SubscribeSystemAbility to sa manager failed"); statusChangeListener_ = nullptr; } } diff --git a/frameworks/core/src/manager/ans_manager_proxy_utils.cpp b/frameworks/core/src/manager/ans_manager_proxy_utils.cpp index a778df23b..97ed7314f 100644 --- a/frameworks/core/src/manager/ans_manager_proxy_utils.cpp +++ b/frameworks/core/src/manager/ans_manager_proxy_utils.cpp @@ -390,7 +390,7 @@ ErrCode AnsManagerProxy::AllowUseReminder(const std::string& bundleName, bool& i } if (!reply.ReadBool(isAllowUseReminder)) { - ANS_LOGE("fail: read enabled failed."); + ANS_LOGE("fail: read isAllowUseReminder failed"); return ERR_ANS_PARCELABLE_FAILED; } diff --git a/frameworks/js/napi/src/cancel.cpp b/frameworks/js/napi/src/cancel.cpp index 62839d710..162f391c1 100644 --- a/frameworks/js/napi/src/cancel.cpp +++ b/frameworks/js/napi/src/cancel.cpp @@ -34,7 +34,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < 1) { - ANS_LOGW("Wrong number of arguments"); + ANS_LOGE("Wrong number of arguments"); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -43,7 +43,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: id: number / representativeBundle: BundleOption NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_number && valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Number object expected."); + ANS_LOGE("Wrong argument type. Number object expected."); std::string msg = "Incorrect parameter types.The type of param must be number or object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -69,7 +69,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, } if (valuetype != napi_number && valuetype != napi_boolean && valuetype != napi_string && valuetype != napi_function) { - ANS_LOGW("Wrong argument type. String or function expected."); + ANS_LOGE("Wrong argument type. String or function expected."); std::string msg = "Incorrect parameter types.The type of param must be string or function."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -93,7 +93,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, } else if (argc >= CANCEL_MAX_PARA - 1 && paras.hasOption) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -105,7 +105,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= CANCEL_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM2], 1, ¶s.callback); @@ -123,7 +123,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < CANCEL_GROUP_MIN_PARA) { - ANS_LOGW("Wrong number of arguments"); + ANS_LOGE("Wrong number of arguments"); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -132,7 +132,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: groupName: string NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. String number boolean expected."); + ANS_LOGE("Wrong argument type. String number boolean expected."); std::string msg = "Incorrect parameter types.The type of param must be number or string or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -156,7 +156,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= CANCEL_GROUP_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶s.callback); @@ -414,7 +414,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc > CANCEL_AS_BUNDLEOPTION_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -425,7 +425,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= CANCEL_AS_BUNDLE_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM3], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM3], 1, ¶s.callback); diff --git a/frameworks/js/napi/src/common.cpp b/frameworks/js/napi/src/common.cpp index 4cc0cbc80..caad63fa5 100644 --- a/frameworks/js/napi/src/common.cpp +++ b/frameworks/js/napi/src/common.cpp @@ -484,7 +484,7 @@ napi_value Common::GetNotificationUserInputByInputKey( ANS_LOGI("NotificationUserInput::inputKey = %{public}s", str); userInput = NotificationUserInput::Create(str); if (!userInput) { - ANS_LOGI("Failed to create NotificationUserInput by inputKey=%{public}s", str); + ANS_LOGE("Failed to create NotificationUserInput by inputKey=%{public}s", str); return nullptr; } @@ -1218,7 +1218,7 @@ __attribute__((no_sanitize("cfi"))) napi_value Common::CreateWantAgentByJS(const const std::shared_ptr &agent) { if (agent == nullptr) { - ANS_LOGI("agent is nullptr"); + ANS_LOGE("agent is nullptr"); return nullptr; } diff --git a/frameworks/js/napi/src/common_convert_content.cpp b/frameworks/js/napi/src/common_convert_content.cpp index de61278d5..fed18c519 100644 --- a/frameworks/js/napi/src/common_convert_content.cpp +++ b/frameworks/js/napi/src/common_convert_content.cpp @@ -65,7 +65,7 @@ napi_value Common::SetNotificationContentDetailed(const napi_env &env, const Con std::shared_ptr basicContent = content->GetNotificationContent(); if (basicContent == nullptr) { - ANS_LOGE("content is null"); + ANS_LOGE("basicContent is null"); return ret; } @@ -1574,7 +1574,7 @@ napi_value Common::SetLockScreenPicture( napi_value pictureValue = Media::PixelMapNapi::CreatePixelMap(env, picture); NAPI_CALL(env, napi_typeof(env, pictureValue, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("LockScreenPicture is undefined"); + ANS_LOGE("LockScreenPicture is undefined"); napi_set_named_property(env, result, "lockscreenPicture", NapiGetNull(env)); } else { napi_set_named_property(env, result, "lockscreenPicture", pictureValue); diff --git a/frameworks/js/napi/src/common_convert_liveview.cpp b/frameworks/js/napi/src/common_convert_liveview.cpp index dd6bb0205..cf591495c 100644 --- a/frameworks/js/napi/src/common_convert_liveview.cpp +++ b/frameworks/js/napi/src/common_convert_liveview.cpp @@ -117,7 +117,7 @@ napi_value Common::SetNotificationLocalLiveViewContent( bool flag = localLiveViewContent->isFlagExist( NotificationLocalLiveViewContent::LiveViewContentInner::INITIAL_TIME); if (!SetTime(env, localLiveViewContent->GetTime(), time, flag)) { - ANS_LOGE("SetMessageUser call failed"); + ANS_LOGE("SetTime call failed"); return NapiGetBoolean(env, false); } napi_set_named_property(env, result, "time", time); @@ -151,7 +151,7 @@ napi_value Common::SetCapsule(const napi_env &env, const NotificationCapsule &ca iconResult = Media::PixelMapNapi::CreatePixelMap(env, icon); NAPI_CALL(env, napi_typeof(env, iconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGW("iconResult is undefined"); + ANS_LOGE("iconResult is undefined"); napi_set_named_property(env, result, "icon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "icon", iconResult); @@ -734,7 +734,7 @@ napi_value Common::GetNotificationIconButton( // icon?: Resource auto resource = std::make_shared(); if (Common::GetResourceObject(env, resource, iconResource) == nullptr) { - ANS_LOGI("Invalid icon resource object or not resource."); + ANS_LOGE("Invalid icon resource object or not resource."); } else { button.SetIconResource(resource); } diff --git a/frameworks/js/napi/src/common_convert_request.cpp b/frameworks/js/napi/src/common_convert_request.cpp index 1b118c77d..bf3bbfdba 100644 --- a/frameworks/js/napi/src/common_convert_request.cpp +++ b/frameworks/js/napi/src/common_convert_request.cpp @@ -247,7 +247,7 @@ napi_value Common::SetNotificationRequestByPixelMap( smallIconResult = Media::PixelMapNapi::CreatePixelMap(env, littleIcon); NAPI_CALL(env, napi_typeof(env, smallIconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("smallIconResult is undefined"); + ANS_LOGE("smallIconResult is undefined"); napi_set_named_property(env, result, "smallIcon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "smallIcon", smallIconResult); @@ -262,7 +262,7 @@ napi_value Common::SetNotificationRequestByPixelMap( largeIconResult = Media::PixelMapNapi::CreatePixelMap(env, largeIcon); NAPI_CALL(env, napi_typeof(env, largeIconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("largeIconResult is undefined"); + ANS_LOGE("largeIconResult is undefined"); napi_set_named_property(env, result, "largeIcon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "largeIcon", largeIconResult); @@ -277,7 +277,7 @@ napi_value Common::SetNotificationRequestByPixelMap( overlayIconResult = Media::PixelMapNapi::CreatePixelMap(env, overlayIcon); NAPI_CALL(env, napi_typeof(env, overlayIconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("overlayIconResult is undefined"); + ANS_LOGE("overlayIconResult is undefined"); napi_set_named_property(env, result, "overlayIcon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "overlayIcon", overlayIconResult); @@ -407,7 +407,7 @@ napi_value Common::SetNotificationActionButton( // wantAgent: WantAgent std::shared_ptr agent = actionButton->GetWantAgent(); if (agent == nullptr) { - ANS_LOGI("wantAgent is null"); + ANS_LOGE("wantAgent is null"); napi_set_named_property(env, result, "wantAgent", NapiGetNull(env)); return NapiGetBoolean(env, false); } else { @@ -424,7 +424,7 @@ napi_value Common::SetNotificationActionButton( iconResult = Media::PixelMapNapi::CreatePixelMap(env, icon); NAPI_CALL(env, napi_typeof(env, iconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGW("icon result is undefined"); + ANS_LOGE("icon result is undefined"); napi_set_named_property(env, result, "icon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "icon", iconResult); @@ -1774,7 +1774,7 @@ napi_value Common::GetNotificationActionButtons( } napi_get_array_length(env, actionButtons, &length); if (length == 0) { - ANS_LOGI("The array is empty."); + ANS_LOGE("The array is empty."); return Common::NapiGetNull(env); } for (size_t i = 0; i < length; i++) { diff --git a/frameworks/js/napi/src/disable_notification.cpp b/frameworks/js/napi/src/disable_notification.cpp index c63d42e2f..fde2792ca 100644 --- a/frameworks/js/napi/src/disable_notification.cpp +++ b/frameworks/js/napi/src/disable_notification.cpp @@ -26,7 +26,7 @@ bool ParseDisabledParameters(const napi_env &env, const napi_value &value, bool napi_valuetype valuetype = napi_undefined; NAPI_CALL_BASE(env, napi_typeof(env, value, &valuetype), false); if (valuetype != napi_boolean) { - ANS_LOGW("wrong argument type. Bool expected"); + ANS_LOGE("wrong argument type. Bool expected"); std::string msg = "Incorrect parameter types.The type of disabled must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return false; diff --git a/frameworks/js/napi/src/display_badge.cpp b/frameworks/js/napi/src/display_badge.cpp index a9bd57375..7b74a609f 100644 --- a/frameworks/js/napi/src/display_badge.cpp +++ b/frameworks/js/napi/src/display_badge.cpp @@ -32,7 +32,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < ENABLE_BADGE_DISPLAYED_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -41,7 +41,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected"); + ANS_LOGE("Wrong argument type. Object expected"); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -57,7 +57,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -68,7 +68,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= ENABLE_BADGE_DISPLAYED_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM2], 1, ¶ms.callback); @@ -87,7 +87,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < IS_DISPLAY_BADGE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -97,7 +97,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if ((valuetype != napi_function) && (valuetype != napi_object)) { - ANS_LOGW("Wrong argument type. Function or object expected, %{public}d", valuetype); + ANS_LOGE("Wrong argument type. Function or object expected, %{public}d", valuetype); std::string msg = "Incorrect parameter types.The type of param must be function or object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -119,7 +119,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= IS_DISPLAY_BADGE_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶ms.callback); diff --git a/frameworks/js/napi/src/distributed.cpp b/frameworks/js/napi/src/distributed.cpp index fd8669054..bec1594eb 100644 --- a/frameworks/js/napi/src/distributed.cpp +++ b/frameworks/js/napi/src/distributed.cpp @@ -39,7 +39,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_STATUS_PARA_NUM) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -48,7 +48,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: deviceType: string NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter deviceType. The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -67,7 +67,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: status: number NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Argument type error. number expected."); + ANS_LOGE("Argument type error. number expected."); std::string msg = "Incorrect parameter status. The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/distributed_operation_callback.cpp b/frameworks/js/napi/src/distributed_operation_callback.cpp index 93dcb1832..aa7de7d2f 100644 --- a/frameworks/js/napi/src/distributed_operation_callback.cpp +++ b/frameworks/js/napi/src/distributed_operation_callback.cpp @@ -32,7 +32,7 @@ void DistributedOperationCallback::OnOperationCallback(const int32_t operationRe { OperationOnCallBack *operationOnCallBack = new (std::nothrow) OperationOnCallBack(); if (operationOnCallBack == nullptr) { - ANS_LOGW("new operationOnCallBack failed"); + ANS_LOGE("new operationOnCallBack failed"); return; } @@ -45,19 +45,19 @@ void DistributedOperationCallback::OnOperationCallback(const int32_t operationRe operationOnCallBack->deferred = asyncCallbackInfo_.deferred; bool bRet = UvQueue::Call(asyncCallbackInfo_.env, operationOnCallBack, UvWorkOnCallBack); if (!bRet) { - ANS_LOGW("DistributedOperationCallback::OnCallBack failed"); + ANS_LOGE("DistributedOperationCallback::OnCallBack failed"); } } void DistributedOperationCallback::UvWorkOnCallBack(uv_work_t *work, int32_t status) { if (work == nullptr) { - ANS_LOGW("UvWorkOnCallBack, work is null"); + ANS_LOGE("UvWorkOnCallBack, work is null"); return; } OperationOnCallBack *callBackPtr = static_cast(work->data); if (callBackPtr == nullptr) { - ANS_LOGW("UvWorkOnCallBack, callBackPtr is null"); + ANS_LOGE("UvWorkOnCallBack, callBackPtr is null"); if (work != nullptr) { delete work; work = nullptr; diff --git a/frameworks/js/napi/src/disturb_mode.cpp b/frameworks/js/napi/src/disturb_mode.cpp index 2274d4c29..fb27497ae 100644 --- a/frameworks/js/napi/src/disturb_mode.cpp +++ b/frameworks/js/napi/src/disturb_mode.cpp @@ -34,14 +34,14 @@ napi_value GetDoNotDisturbDate(const napi_env &env, const napi_value &argv, SetD // argv[0]: date:type NAPI_CALL(env, napi_has_named_property(env, argv, "type", &hasProperty)); if (!hasProperty) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } napi_get_named_property(env, argv, "type", &value); NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -59,7 +59,7 @@ napi_value GetDoNotDisturbDate(const napi_env &env, const napi_value &argv, SetD // argv[0]: date:begin NAPI_CALL(env, napi_has_named_property(env, argv, "begin", &hasProperty)); if (!hasProperty) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -79,7 +79,7 @@ napi_value GetDoNotDisturbDate(const napi_env &env, const napi_value &argv, SetD // argv[0]: date:end NAPI_CALL(env, napi_has_named_property(env, argv, "end", &hasProperty)); if (!hasProperty) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -190,7 +190,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_DISTURB_MIN_PARA) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -199,7 +199,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -212,7 +212,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= SET_DISTURB_MAX_PARA - 1) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if ((valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Wrong argument type. Function or object expected. Excute promise."); + ANS_LOGE("Wrong argument type. Function or object expected. Excute promise."); return Common::NapiGetNull(env); } diff --git a/frameworks/js/napi/src/enable_notification.cpp b/frameworks/js/napi/src/enable_notification.cpp index 5f5d9bc95..d4fa19cd4 100644 --- a/frameworks/js/napi/src/enable_notification.cpp +++ b/frameworks/js/napi/src/enable_notification.cpp @@ -38,7 +38,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < ENABLE_NOTIFICATION_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -47,7 +47,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Parameter type error. Object expected."); + ANS_LOGE("Parameter type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -62,7 +62,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -73,7 +73,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= ENABLE_NOTIFICATION_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM2], 1, ¶ms.callback); @@ -99,7 +99,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if ((valuetype != napi_object) && (valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Parameter type error. Function or object expected. Excute promise."); + ANS_LOGE("Parameter type error. Function or object expected. Excute promise."); return Common::NapiGetNull(env); } if (valuetype == napi_object) { @@ -121,7 +121,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= IS_NOTIFICATION_ENABLE_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶ms.callback); diff --git a/frameworks/js/napi/src/manager/napi_disable_notification.cpp b/frameworks/js/napi/src/manager/napi_disable_notification.cpp index eb80040ac..d6588d7bf 100644 --- a/frameworks/js/napi/src/manager/napi_disable_notification.cpp +++ b/frameworks/js/napi/src/manager/napi_disable_notification.cpp @@ -23,7 +23,7 @@ namespace NotificationNapi { napi_value NapiDisableNotificationFeature(napi_env env, napi_callback_info info) { #ifdef DISABLE_NOTIFICATION_FEATURE_ENABLE - ANS_LOGD("enter NapiDisableNotificationFeature"); + ANS_LOGD("enter"); NotificationDisable paras; if (!ParseDisableNotificationParameters(env, info, paras)) { Common::NapiThrow(env, ERROR_PARAM_INVALID); @@ -45,7 +45,7 @@ napi_value NapiDisableNotificationFeature(napi_env env, napi_callback_info info) // Asynchronous function call napi_create_async_work(env, nullptr, resourceName, [](napi_env env, void *data) { - ANS_LOGD("Napi disable notification Feature work excute."); + ANS_LOGD("NapiDisableNotificationFeature work excute"); AsyncCallbackInfoDisableNotification *asynccallbackinfo = static_cast(data); if (asynccallbackinfo) { @@ -54,15 +54,17 @@ napi_value NapiDisableNotificationFeature(napi_env env, napi_callback_info info) } }, [](napi_env env, napi_status status, void *data) { - ANS_LOGD("Napi disable notification Feature work complete."); + ANS_LOGD("NapiDisableNotificationFeature work complete"); AsyncCallbackInfoDisableNotification *asynccallbackinfo = static_cast(data); if (asynccallbackinfo) { Common::CreateReturnValue(env, asynccallbackinfo->info, Common::NapiGetNull(env)); + ANS_LOGD("Delete NapiDisableNotificationFeature asyncWork"); napi_delete_async_work(env, asynccallbackinfo->asyncWork); delete asynccallbackinfo; asynccallbackinfo = nullptr; } + ANS_LOGD("NapiDisableNotificationFeature work complete end"); }, (void *)asynccallbackinfo, &asynccallbackinfo->asyncWork); diff --git a/frameworks/js/napi/src/manager/napi_distributed_enable.cpp b/frameworks/js/napi/src/manager/napi_distributed_enable.cpp index 3965a2dfd..782b15e69 100644 --- a/frameworks/js/napi/src/manager/napi_distributed_enable.cpp +++ b/frameworks/js/napi/src/manager/napi_distributed_enable.cpp @@ -38,7 +38,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_DISTRIBUTED_ENABLE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -47,7 +47,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Parameter type error. Object expected."); + ANS_LOGE("Parameter type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -62,7 +62,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: deviceType NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -81,7 +81,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[2]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -184,7 +184,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_SMART_REMINDER_ENABLE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -193,7 +193,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: deviceType NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. String expected."); + ANS_LOGE("Wrong argument type. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -212,7 +212,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -344,7 +344,7 @@ napi_value ParseParameters(const napi_env &env, NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if ((setOperation && argc != SET_DISTRIBUTED_ENABLE_BY_SLOT_PARA) || (!setOperation && argc != GET_DISTRIBUTED_ENABLE_BY_SLOT_PARA)) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -353,7 +353,7 @@ napi_value ParseParameters(const napi_env &env, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Parameter type error. Object expected."); + ANS_LOGE("Parameter type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -371,7 +371,7 @@ napi_value ParseParameters(const napi_env &env, // argv[1]: deviceType NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -395,7 +395,7 @@ napi_value ParseParameters(const napi_env &env, if (setOperation) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/manager/napi_enable_notification.cpp b/frameworks/js/napi/src/manager/napi_enable_notification.cpp index 0ed78bcc4..c59f7278e 100644 --- a/frameworks/js/napi/src/manager/napi_enable_notification.cpp +++ b/frameworks/js/napi/src/manager/napi_enable_notification.cpp @@ -153,14 +153,14 @@ __attribute__((no_sanitize("cfi"))) napi_value NapiIsNotificationEnabled(napi_en asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotify( asynccallbackinfo->params.option, asynccallbackinfo->allowed); } else if (asynccallbackinfo->params.hasUserId) { - ANS_LOGI("userId : %{public}d", asynccallbackinfo->params.userId); + ANS_LOGI("userId:%{public}d", asynccallbackinfo->params.userId); asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotify( asynccallbackinfo->params.userId, asynccallbackinfo->allowed); } else { asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotifySelf( asynccallbackinfo->allowed); } - ANS_LOGI("asynccallbackinfo->info.errorCode : %{public}d, allowed : %{public}d", + ANS_LOGI("asynccallbackinfo->info.errorCode:%{public}d, allowed:%{public}d", asynccallbackinfo->info.errorCode, asynccallbackinfo->allowed); } }, @@ -213,7 +213,7 @@ napi_value NapiIsNotificationEnabledSelf(napi_env env, napi_callback_info info) asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotifySelf(asynccallbackinfo->allowed); } - ANS_LOGD("asynccallbackinfo->info.errorCode = %{public}d, allowed = %{public}d", + ANS_LOGD("asynccallbackinfo->info.errorCode:%{public}d, allowed:%{public}d", asynccallbackinfo->info.errorCode, asynccallbackinfo->allowed); } }, @@ -291,7 +291,7 @@ napi_value NapiRequestEnableNotification(napi_env env, napi_callback_info info) bool canPop = false; std::string bundleName {""}; ErrCode errCode = NotificationHelper::CanPopEnableNotificationDialog(client, canPop, bundleName); - ANS_LOGI("CanPopEnableNotificationDialog result , errCode = %{public}d , canPop = %{public}d", + ANS_LOGI("CanPopEnableNotificationDialog result, errCode:%{public}d, canPop:%{public}d", errCode, canPop); if (canPop == false) { asynccallbackinfo->info.errorCode = errCode; diff --git a/frameworks/js/napi/src/manager/napi_get_active.cpp b/frameworks/js/napi/src/manager/napi_get_active.cpp index 038451ee5..02ac507e6 100644 --- a/frameworks/js/napi/src/manager/napi_get_active.cpp +++ b/frameworks/js/napi/src/manager/napi_get_active.cpp @@ -299,7 +299,7 @@ napi_value ParseGetLiveViewFilter(const napi_env &env, const napi_value &obj, Li // bundle napi_value result = AppExecFwk::GetPropertyValueByPropertyName(env, obj, "bundle", napi_object); if (result == nullptr) { - ANS_LOGW("Failed to get bundle from params."); + ANS_LOGE("Failed to get bundle from params."); return nullptr; } auto retValue = Common::GetBundleOption(env, result, filter.bundle); @@ -311,7 +311,7 @@ napi_value ParseGetLiveViewFilter(const napi_env &env, const napi_value &obj, Li // notificationKey result = AppExecFwk::GetPropertyValueByPropertyName(env, obj, "notificationKey", napi_object); if (result == nullptr) { - ANS_LOGW("Failed to get notificationKeys from params."); + ANS_LOGE("Failed to get notificationKeys from params."); return nullptr; } retValue = Common::GetNotificationKey(env, result, filter.notificationKey); @@ -322,7 +322,7 @@ napi_value ParseGetLiveViewFilter(const napi_env &env, const napi_value &obj, Li // extraInfoKeys if (AppExecFwk::IsExistsByPropertyName(env, obj, "extraInfoKeys") == false) { - ANS_LOGI("No extraInfoKeys in filter"); + ANS_LOGW("No extraInfoKeys in filter"); return Common::NapiGetNull(env); } diff --git a/frameworks/js/napi/src/manager/napi_push_callback.cpp b/frameworks/js/napi/src/manager/napi_push_callback.cpp index 066c6796a..e93a6bbeb 100644 --- a/frameworks/js/napi/src/manager/napi_push_callback.cpp +++ b/frameworks/js/napi/src/manager/napi_push_callback.cpp @@ -283,7 +283,7 @@ int32_t JSPushCallBack::ConvertFunctionResult(napi_env env, napi_value funcResul return false; } - ANS_LOGI("code : %{public}d ,message : %{public}s", code, message.c_str()); + ANS_LOGI("code:%{public}d, message:%{public}s", code, message.c_str()); return code; } } // namespace Notification diff --git a/frameworks/js/napi/src/manager/napi_remove_group.cpp b/frameworks/js/napi/src/manager/napi_remove_group.cpp index cf504b265..7bac7aa36 100644 --- a/frameworks/js/napi/src/manager/napi_remove_group.cpp +++ b/frameworks/js/napi/src/manager/napi_remove_group.cpp @@ -35,7 +35,7 @@ napi_value ParseParameters( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < REMOVE_GROUP_BY_BUNDLE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -43,7 +43,7 @@ napi_value ParseParameters( // argv[0]: bundle NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Argument type error. Object expected."); + ANS_LOGE("Argument type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -58,7 +58,7 @@ napi_value ParseParameters( // argv[1]: groupName: string NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. String number boolean expected."); + ANS_LOGE("Wrong argument type. String number boolean expected."); std::string msg = "Incorrect parameter types.The type of param must be string or number or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -138,7 +138,7 @@ napi_value NapiRemoveGroupByBundle(napi_env env, napi_callback_info info) AsyncCallbackInfoRemoveGroupByBundle *asynccallbackinfo = static_cast(data); if (asynccallbackinfo) { - ANS_LOGI("option.bundle : %{public}s, option.uid : %{public}d, groupName : %{public}s", + ANS_LOGI("option.bundle:%{public}s, option.uid:%{public}d, groupName:%{public}s", asynccallbackinfo->params.option.GetBundleName().c_str(), asynccallbackinfo->params.option.GetUid(), asynccallbackinfo->params.groupName.c_str()); diff --git a/frameworks/js/napi/src/manager/napi_sync_config.cpp b/frameworks/js/napi/src/manager/napi_sync_config.cpp index c90484908..b023048fe 100644 --- a/frameworks/js/napi/src/manager/napi_sync_config.cpp +++ b/frameworks/js/napi/src/manager/napi_sync_config.cpp @@ -50,7 +50,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SETADDITION_CONFIG_NUM) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -59,7 +59,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: key: string NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -71,7 +71,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (std::strlen(keyStr) == 0 || (strcmp(keyStr, KEY_NAME) != 0 && strcmp(keyStr, RING_LIST_KEY_NAME) != 0 && strcmp(keyStr, CTRL_LIST_KEY_NAME) != 0)) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -80,7 +80,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: value: string NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/publish.cpp b/frameworks/js/napi/src/publish.cpp index 7ccf804d0..398713471 100644 --- a/frameworks/js/napi/src/publish.cpp +++ b/frameworks/js/napi/src/publish.cpp @@ -38,7 +38,7 @@ napi_value GetCallback(const napi_env &env, const napi_value &value, ParametersI napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, value, 1, ¶ms.callback); @@ -54,7 +54,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value argv[PUBLISH_NOTIFICATION_MAX] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); if (argc < 1) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -62,7 +62,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Argument type error. Object expected."); + ANS_LOGE("Argument type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -77,7 +77,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= PUBLISH_NOTIFICATION_MAX - 1) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if ((valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Wrong argument type. Function or object expected. Execute promise"); + ANS_LOGE("Wrong argument type. Function or object expected. Execute promise"); return Common::NapiGetNull(env); } @@ -198,7 +198,7 @@ napi_value GetStringProperty( napi_get_named_property(env, content, property.data(), &value); NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. String expected."); + ANS_LOGE("Wrong argument type. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -222,7 +222,7 @@ napi_value GetObjectProperty( napi_get_named_property(env, content, property.data(), &result); NAPI_CALL(env, napi_typeof(env, result, &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected."); + ANS_LOGE("Wrong argument type. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -238,7 +238,7 @@ napi_value ParseShowOptions(const napi_env &env, const napi_callback_info &info, napi_value argv[SHOW_NOTIFICATION_MAX] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); if (argc == 0) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); return nullptr; } @@ -246,7 +246,7 @@ napi_value ParseShowOptions(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected."); + ANS_LOGE("Wrong argument type. Object expected."); return nullptr; } @@ -312,13 +312,13 @@ napi_value ShowNotification(napi_env env, napi_callback_info info) ParametersInfoPublish params; if (ParseShowOptions(env, info, params) == nullptr) { - ANS_LOGW("parse showOptions failed"); + ANS_LOGE("parse showOptions failed"); return Common::NapiGetUndefined(env); } auto asynccallbackinfo = new (std::nothrow) AsyncCallbackInfoPublish {.env = env, .asyncWork = nullptr}; if (!asynccallbackinfo) { - ANS_LOGW("failed to create asynccallbackinfo"); + ANS_LOGE("failed to create asynccallbackinfo"); return Common::JSParaError(env, params.callback); } @@ -382,7 +382,7 @@ napi_value ParsePublishAsBundleParameters( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected."); + ANS_LOGE("Wrong argument type. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -408,7 +408,7 @@ napi_value ParsePublishAsBundleParameters( // argv[1] : bundleName / NotificationRequest NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean && valuetype != napi_object) { - ANS_LOGW("Error argument type. String number boolean object expected."); + ANS_LOGE("Error argument type. String number boolean object expected."); std::string msg = "Incorrect parameter types.The type of param must be string or number or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -438,7 +438,7 @@ napi_value ParsePublishAsBundleParameters( if (argc > PUBLISH_AS_BUNDLEOPTION_MAX) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/reminder/publish.cpp b/frameworks/js/napi/src/reminder/publish.cpp index 3ce96921d..124ec328f 100644 --- a/frameworks/js/napi/src/reminder/publish.cpp +++ b/frameworks/js/napi/src/reminder/publish.cpp @@ -77,7 +77,7 @@ napi_value GetCallback(const napi_env &env, const napi_value &value, AsyncCallba napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_function) { - ANSR_LOGW("Wrong argument type. Function expected."); + ANSR_LOGE("Wrong argument type. Function expected."); return nullptr; } napi_create_reference(env, value, 1, &asyncCallbackInfo.callback); @@ -97,7 +97,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value argv[PUBLISH_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < 1) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -107,7 +107,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: callback if (argc >= PUBLISH_PARAM_LEN) { if (GetCallback(env, argv[1], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("[reminderAgent]GetCallbak returns nullptr"); + ANSR_LOGE("[reminderAgent]GetCallbak returns nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -117,7 +117,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0] : reminderRequest if (ReminderCommon::GetReminderRequest(env, argv[0], params.reminder) == nullptr) { - ANSR_LOGW("[reminderAgent]CreateReminder returns nullptr"); + ANSR_LOGE("[reminderAgent]CreateReminder returns nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -134,7 +134,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in napi_value argv[ADD_SLOT_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < 1) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -144,7 +144,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in // argv[1]: callback if (argc >= ADD_SLOT_PARAM_LEN) { if (GetCallback(env, argv[1], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("GetCallbak returns nullptr"); + ANSR_LOGE("GetCallbak returns nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -159,7 +159,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in int32_t propertyVal = 0; if (!ReminderCommon::GetInt32(env, argv[0], propertyKey, propertyVal, false) && !ReminderCommon::GetInt32(env, argv[0], propertyNewKey, propertyVal, false)) { - ANSR_LOGW("Failed to get valid slot type."); + ANSR_LOGE("Failed to get valid slot type."); params.errCode = ERR_REMINDER_INVALID_PARAM; if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); @@ -168,7 +168,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in } if (!NotificationNapi::AnsEnumUtil::SlotTypeJSToC(NotificationNapi::SlotType(propertyVal), params.inType)) { - ANSR_LOGW("Failed to get valid slot type"); + ANSR_LOGE("Failed to get valid slot type"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -185,7 +185,7 @@ napi_value ParseCanCelParameter(const napi_env &env, const napi_callback_info &i napi_value argv[CANCEL_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < 1) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -195,7 +195,7 @@ napi_value ParseCanCelParameter(const napi_env &env, const napi_callback_info &i // argv[1]: callback if (argc >= CANCEL_PARAM_LEN) { if (GetCallback(env, argv[1], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("GetCallbak is nullptr"); + ANSR_LOGE("GetCallbak is nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -212,7 +212,7 @@ napi_value ParseCanCelParameter(const napi_env &env, const napi_callback_info &i return nullptr; } if (reminderId < 0) { - ANSR_LOGW("Param id of cancels Reminder is illegal."); + ANSR_LOGE("Param id of cancels Reminder is illegal."); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -234,7 +234,7 @@ napi_value ParseCanCelAllParameter(const napi_env &env, const napi_callback_info // argv[0]: callback if (argc >= CANCEL_ALL_PARAM_LEN) { if (GetCallback(env, argv[0], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("getCallbak is nullptr"); + ANSR_LOGE("getCallbak is nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -254,7 +254,7 @@ napi_value ParseGetValidParameter(const napi_env &env, const napi_callback_info // argv[0]: callback if (argc >= GET_VALID_PARAM_LEN) { if (GetCallback(env, argv[0], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("getCallbak is nullptr"); + ANSR_LOGE("getCallbak is nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -1154,7 +1154,7 @@ napi_value ParseAddExcludeDateParameter(const napi_env &env, const napi_callback napi_value argv[ADD_EXCLUDE_DATE_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < ADD_EXCLUDE_DATE_PARAM_LEN) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1162,12 +1162,12 @@ napi_value ParseAddExcludeDateParameter(const napi_env &env, const napi_callback // argv[0]: reminder id int32_t reminderId = -1; if (!ReminderCommon::GetInt32(env, argv[0], nullptr, reminderId, true)) { - ANSR_LOGW("Parse reminder id failed."); + ANSR_LOGE("Parse reminder id failed."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } if (reminderId < 0) { - ANSR_LOGW("Param reminder id is illegal."); + ANSR_LOGE("Param reminder id is illegal."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1176,12 +1176,12 @@ napi_value ParseAddExcludeDateParameter(const napi_env &env, const napi_callback // argv[1]: exclude date double date = 0.0; if (!ReminderCommon::GetDate(env, argv[1], nullptr, date)) { - ANSR_LOGW("Parse exclude date failed."); + ANSR_LOGE("Parse exclude date failed."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } if (date < 0.0) { - ANSR_LOGW("Param exclude date is illegal."); + ANSR_LOGE("Param exclude date is illegal."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1255,7 +1255,7 @@ napi_value ParseReminderIdParameter(const napi_env &env, const napi_callback_inf napi_value argv[DEL_EXCLUDE_DATE_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < DEL_EXCLUDE_DATE_PARAM_LEN) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1263,12 +1263,12 @@ napi_value ParseReminderIdParameter(const napi_env &env, const napi_callback_inf // argv[0]: reminder id int32_t reminderId = -1; if (!ReminderCommon::GetInt32(env, argv[0], nullptr, reminderId, true)) { - ANSR_LOGW("Parse reminder id failed."); + ANSR_LOGE("Parse reminder id failed."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } if (reminderId < 0) { - ANSR_LOGW("Param reminder id is illegal."); + ANSR_LOGE("Param reminder id is illegal."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } diff --git a/frameworks/js/napi/src/reminder/reminder_common.cpp b/frameworks/js/napi/src/reminder/reminder_common.cpp index ce7037672..682f623ee 100644 --- a/frameworks/js/napi/src/reminder/reminder_common.cpp +++ b/frameworks/js/napi/src/reminder/reminder_common.cpp @@ -36,7 +36,7 @@ napi_value ReminderCommon::GetReminderRequest( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_object) { - ANSR_LOGW("Wrong argument type. Object expected."); + ANSR_LOGE("Wrong argument type. Object expected."); return nullptr; } @@ -59,7 +59,7 @@ bool ReminderCommon::GenActionButtons( bool isArray = false; napi_is_array(env, actionButtons, &isArray); if (!isArray) { - ANSR_LOGW("Wrong argument type:%{public}s. array expected.", ACTION_BUTTON); + ANSR_LOGE("Wrong argument type:%{public}s. array expected.", ACTION_BUTTON); return false; } @@ -70,7 +70,7 @@ bool ReminderCommon::GenActionButtons( napi_get_element(env, actionButtons, i, &actionButton); NAPI_CALL_BASE(env, napi_typeof(env, actionButton, &valuetype), false); if (valuetype != napi_object) { - ANSR_LOGW("Wrong element type:%{public}s. object expected.", ACTION_BUTTON); + ANSR_LOGE("Wrong element type:%{public}s. object expected.", ACTION_BUTTON); return false; } @@ -82,12 +82,12 @@ bool ReminderCommon::GenActionButtons( ReminderRequest::ActionButtonType(buttonType) == ReminderRequest::ActionButtonType::SNOOZE || (ReminderRequest::ActionButtonType(buttonType) == ReminderRequest::ActionButtonType::CUSTOM && isSysApp))) { - ANSR_LOGW("Wrong argument type:%{public}s. buttonType not support.", ACTION_BUTTON); + ANSR_LOGE("Wrong argument type:%{public}s. buttonType not support.", ACTION_BUTTON); return false; } HandleActionButtonTitle(env, actionButton, reminder, str, buttonType); } else { - ANSR_LOGW("Parse action button error."); + ANSR_LOGE("Parse action button error."); return false; } } @@ -124,7 +124,7 @@ bool ReminderCommon::IsSelfSystemApp() { auto selfToken = IPCSkeleton::GetSelfTokenID(); if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(selfToken)) { - ANSR_LOGW("This application is not system-app, can not use system-api"); + ANSR_LOGE("This application is not system-app, can not use system-api"); return false; } return true; @@ -193,7 +193,7 @@ bool ReminderCommon::GetValueBucketObject(std::string &valueBucketString, const uint32_t arrlen = 0; napi_status status = napi_get_array_length(env, keys, &arrlen); if (status != napi_ok) { - ANSR_LOGW("get the valuesBucket length err"); + ANSR_LOGE("get the valuesBucket length err"); return false; } for (size_t i = 0; i < arrlen; ++i) { @@ -206,7 +206,7 @@ bool ReminderCommon::GetValueBucketObject(std::string &valueBucketString, const } std::string keyStr = GetStringFromJS(env, key); if (!ValidateString(keyStr)) { - ANSR_LOGW("The key contains separator"); + ANSR_LOGE("The key contains separator"); return false; } // value @@ -220,7 +220,7 @@ bool ReminderCommon::GetValueBucketObject(std::string &valueBucketString, const continue; } if (!ValidateString(valueObject)) { - ANSR_LOGW("The value contains separator"); + ANSR_LOGE("The value contains separator"); return false; } valueBucketString += keyStr + ReminderRequest::SEP_BUTTON_VALUE + type @@ -439,11 +439,11 @@ bool ReminderCommon::CreateReminder( CreateReminderCalendar(env, value, isSysApp, reminder); break; default: - ANSR_LOGW("Reminder type is not support. (type:%{public}d)", reminderType); + ANSR_LOGE("Reminder type is not support. (type:%{public}d)", reminderType); break; } if (reminder == nullptr) { - ANSR_LOGW("Instance of reminder error."); + ANSR_LOGE("Instance of reminder error."); return false; } return true; @@ -456,7 +456,7 @@ napi_value ReminderCommon::GenReminder( bool hasProperty = false; NAPI_CALL(env, napi_has_named_property(env, value, ReminderAgentNapi::REMINDER_TYPE, &hasProperty)); if (!hasProperty) { - ANSR_LOGW("Property %{public}s expected.", ReminderAgentNapi::REMINDER_TYPE); + ANSR_LOGE("Property %{public}s expected.", ReminderAgentNapi::REMINDER_TYPE); return nullptr; } @@ -584,7 +584,7 @@ bool ReminderCommon::GenReminderIntInner( if (GetInt32(env, value, ReminderAgentNapi::SLOT_TYPE, slotType, false)) { enum NotificationConstant::SlotType actureType = NotificationConstant::SlotType::OTHER; if (!NotificationNapi::AnsEnumUtil::SlotTypeJSToC(NotificationNapi::SlotType(slotType), actureType)) { - ANSR_LOGW("slot type not support."); + ANSR_LOGE("slot type not support."); return false; } reminder->SetSlotType(actureType); @@ -651,7 +651,7 @@ bool ReminderCommon::GetStringUtf8(const napi_env &env, const napi_value &value, napi_get_named_property(env, value, propertyName, &result); NAPI_CALL_BASE(env, napi_typeof(env, result, &valuetype), false); if (valuetype != napi_string) { - ANSR_LOGW("Wrong argument type:%{public}s. string expected.", propertyName); + ANSR_LOGE("Wrong argument type:%{public}s. string expected.", propertyName); return false; } NAPI_CALL_BASE(env, napi_get_value_string_utf8(env, result, propertyVal, size - 1, &strLen), false); @@ -667,13 +667,13 @@ bool ReminderCommon::GetBool(const napi_env &env, const napi_value &value, napi_valuetype valuetype = napi_undefined; NAPI_CALL_BASE(env, napi_has_named_property(env, value, propertyName, &hasProperty), false); if (!hasProperty) { - ANSR_LOGW("Does not have argument type:%{public}s.", propertyName); + ANSR_LOGE("Does not have argument type:%{public}s.", propertyName); return false; } napi_get_named_property(env, value, propertyName, &result); NAPI_CALL_BASE(env, napi_typeof(env, result, &valuetype), false); if (valuetype != napi_boolean) { - ANSR_LOGW("Wrong argument type:%{public}s. boolean expected.", propertyName); + ANSR_LOGE("Wrong argument type:%{public}s. boolean expected.", propertyName); return false; } napi_get_value_bool(env, result, &propertyVal); @@ -744,7 +744,7 @@ bool ReminderCommon::GetObject(const napi_env &env, const napi_value &value, napi_get_named_property(env, value, propertyName, &propertyVal); NAPI_CALL_BASE(env, napi_typeof(env, propertyVal, &valuetype), false); if (valuetype != napi_object) { - ANSR_LOGW("Wrong argument type:%{public}s. object expected.", propertyName); + ANSR_LOGE("Wrong argument type:%{public}s. object expected.", propertyName); return false; } return true; @@ -786,7 +786,7 @@ napi_value ReminderCommon::CreateReminderTimer( auto countDownTimeInSeconds = static_cast(propertyCountDownTime); if (propertyCountDownTime <= 0 || countDownTimeInSeconds >= (UINT64_MAX / ReminderRequest::MILLI_SECONDS)) { - ANSR_LOGW("Create countDown reminder fail: designated %{public}s is illegal.", + ANSR_LOGE("Create countDown reminder fail: designated %{public}s is illegal.", ReminderAgentNapi::TIMER_COUNT_DOWN_TIME); return nullptr; } @@ -813,13 +813,13 @@ napi_value ReminderCommon::CreateReminderAlarm( } if ((propertyHourVal < 0) || (propertyHourVal > maxHour)) { - ANSR_LOGW("Create alarm reminder fail: designated %{public}s must between [0, 23].", + ANSR_LOGE("Create alarm reminder fail: designated %{public}s must between [0, 23].", ReminderAgentNapi::ALARM_HOUR); return nullptr; } if ((propertyMinuteVal < 0) || (propertyMinuteVal > maxMinute)) { - ANSR_LOGW("Create alarm reminder fail: designated %{public}s must between [0, 59].", + ANSR_LOGE("Create alarm reminder fail: designated %{public}s must between [0, 59].", ReminderAgentNapi::ALARM_MINUTE); return nullptr; } @@ -841,12 +841,12 @@ napi_value ReminderCommon::CreateReminderCalendar( struct tm dateTime; napi_value dateTimeObj = nullptr; if (!GetObject(env, value, ReminderAgentNapi::CALENDAR_DATE_TIME, dateTimeObj)) { - ANSR_LOGW("Create calendar reminder fail: dateTime must be setted."); + ANSR_LOGE("Create calendar reminder fail: dateTime must be setted."); return nullptr; } if (!ParseLocalDateTime(env, dateTimeObj, dateTime)) { - ANSR_LOGW("Parce DateTime failed."); + ANSR_LOGE("Parce DateTime failed."); return nullptr; } @@ -880,7 +880,7 @@ napi_value ReminderCommon::CreateReminderCalendar( return nullptr; } if (!reminderCalendar->SetEndDateTime(ReminderRequest::GetDurationSinceEpochInMilli(endTime))) { - ANSR_LOGW("The end time must be greater than start time"); + ANSR_LOGE("The end time must be greater than start time"); return nullptr; } } @@ -897,30 +897,30 @@ bool ReminderCommon::CheckCalendarParams(const int32_t &year, const int32_t &mon const int32_t &hour, const int32_t &min) { if ((year < 0) || (year > UINT16_MAX)) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [0, %{public}d]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [0, %{public}d]", ReminderAgentNapi::CALENDAR_YEAR, UINT16_MAX); return false; } if ((month < 1) || (month > ReminderRequestCalendar::MAX_MONTHS_OF_YEAR)) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", ReminderAgentNapi::CALENDAR_MONTH, ReminderRequestCalendar::MAX_MONTHS_OF_YEAR); return false; } uint8_t maxDaysOfMonth = ReminderRequestCalendar::GetDaysOfMonth(static_cast(year), month); if ((day < 1) || (day > maxDaysOfMonth)) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", ReminderAgentNapi::CALENDAR_DAY, maxDaysOfMonth); return false; } uint8_t maxHour = 23; if (hour < 0 || hour > maxHour) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", ReminderAgentNapi::CALENDAR_HOUR, maxHour); return false; } uint8_t maxMinute = 59; if (min < 0 || min > maxMinute) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", ReminderAgentNapi::CALENDAR_MINUTE, maxMinute); return false; } @@ -992,13 +992,13 @@ napi_value ReminderCommon::ParseInt32Array(const napi_env &env, const napi_value bool isArray = false; napi_is_array(env, result, &isArray); if (!isArray) { - ANSR_LOGW("Property %{public}s is expected to be an array.", propertyName); + ANSR_LOGE("Property %{public}s is expected to be an array.", propertyName); return nullptr; } uint32_t length = 0; napi_get_array_length(env, result, &length); if (length > maxLen) { - ANSR_LOGW("The max length of array of %{public}s is %{public}hhu.", propertyName, maxLen); + ANSR_LOGE("The max length of array of %{public}s is %{public}hhu.", propertyName, maxLen); return nullptr; } napi_valuetype valuetype = napi_undefined; @@ -1008,12 +1008,12 @@ napi_value ReminderCommon::ParseInt32Array(const napi_env &env, const napi_value napi_get_element(env, result, i, &repeatDayVal); NAPI_CALL(env, napi_typeof(env, repeatDayVal, &valuetype)); if (valuetype != napi_number) { - ANSR_LOGW("%{public}s's element is expected to be number.", propertyName); + ANSR_LOGE("%{public}s's element is expected to be number.", propertyName); return nullptr; } napi_get_value_int32(env, repeatDayVal, &propertyDayVal); if (propertyDayVal < 1 || propertyDayVal > static_cast(maxLen)) { - ANSR_LOGW("%{public}s's element must between [1, %{public}d].", propertyName, maxLen); + ANSR_LOGE("%{public}s's element must between [1, %{public}d].", propertyName, maxLen); return nullptr; } propertyVal.push_back(static_cast(propertyDayVal)); diff --git a/frameworks/js/napi/src/remove.cpp b/frameworks/js/napi/src/remove.cpp index dccf0cee8..b6942edbf 100644 --- a/frameworks/js/napi/src/remove.cpp +++ b/frameworks/js/napi/src/remove.cpp @@ -35,13 +35,13 @@ bool ParseRemoveReason(const napi_env &env, const napi_value &value, RemoveParam napi_valuetype valueType = napi_undefined; NAPI_CALL_BASE(env, napi_typeof(env, value, &valueType), false); if (valueType != napi_number) { - ANS_LOGW("RemoveReason valueType unexpected."); + ANS_LOGE("RemoveReason valueType unexpected."); return false; } int32_t removeReason = 0; napi_get_value_int32(env, value, &removeReason); if (!Common::IsValidRemoveReason(removeReason)) { - ANS_LOGW("RemoveReason value unexpected."); + ANS_LOGE("RemoveReason value unexpected."); return false; } params.removeReason = removeReason; @@ -54,7 +54,7 @@ bool ParseCallbackFunc(const napi_env &env, const napi_value &value, napi_valuetype valueType = napi_undefined; NAPI_CALL_BASE(env, napi_typeof(env, value, &valueType), false); if (valueType != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return true; } napi_create_reference(env, value, 1, ¶ms.callback); @@ -71,7 +71,7 @@ bool ParseHashcodeTypeParams( std::vector hashcodes; auto retValue = Common::GetHashCodes(env, argv[PARAM0], hashcodes); if (retValue == nullptr) { - ANS_LOGW("GetHashCodes failed."); + ANS_LOGE("GetHashCodes failed."); return false; } params.hashcodes = hashcodes; @@ -105,7 +105,7 @@ bool ParseHashcodeTypeParams( bool ParseBundleOptionTypeParams(const napi_env &env, napi_value* argv, size_t argc, RemoveParams ¶ms) { if (argc < REMOVE_BY_BUNDLE_AND_KEY_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); return false; } BundleAndKeyInfo bundleInfo {}; @@ -137,7 +137,7 @@ bool ParseParameters(const napi_env &env, const napi_callback_info &info, Remove napi_value thisVar = nullptr; NAPI_CALL_BASE(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL), false); if (argc < REMOVE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return false; } @@ -147,7 +147,7 @@ bool ParseParameters(const napi_env &env, const napi_callback_info &info, Remove NAPI_CALL_BASE(env, napi_typeof(env, argv[PARAM0], &valueType), false); if ((valueType != napi_string) && (valueType != napi_object) && (valueType != napi_number) && (valueType != napi_boolean) && !isArray) { - ANS_LOGW("Wrong argument type. String or object expected."); + ANS_LOGE("Wrong argument type. String or object expected."); std::string msg = "Incorrect parameter types.The type of param must be object or string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return false; @@ -175,14 +175,14 @@ napi_value ParseParametersByRemoveAll(const napi_env &env, const napi_callback_i napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if ((valuetype != napi_object) && (valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Wrong argument type. Function or object expected. Excute promise."); + ANS_LOGE("Wrong argument type. Function or object expected. Excute promise."); return Common::NapiGetNull(env); } if (valuetype == napi_object) { BundleAndKeyInfo bundleandKeyInfo {}; auto retValue = Common::GetBundleOption(env, argv[PARAM0], bundleandKeyInfo.option); if (retValue == nullptr) { - ANS_LOGW("GetBundleOption failed."); + ANS_LOGE("GetBundleOption failed."); Common::NapiThrow(env, ERROR_PARAM_INVALID, PARAMETER_VERIFICATION_FAILED); return nullptr; } @@ -198,7 +198,7 @@ napi_value ParseParametersByRemoveAll(const napi_env &env, const napi_callback_i if (argc >= REMOVE_ALL_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶ms.callback); @@ -218,7 +218,7 @@ napi_value ParseParameters( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < REMOVE_GROUP_BY_BUNDLE_MIN_PARA) { - ANS_LOGW("Error number of arguments."); + ANS_LOGE("Error number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -226,7 +226,7 @@ napi_value ParseParameters( // argv[0]: bundle NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Valuetype is not object."); + ANS_LOGE("Valuetype is not object."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -241,7 +241,7 @@ napi_value ParseParameters( // argv[1]: groupName: string NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean) { - ANS_LOGW("Error argument type. String number boolean anticipate."); + ANS_LOGE("Error argument type. String number boolean anticipate."); std::string msg = "Incorrect parameter types.The type of param must be string or number or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/reminder/src/reminder_request_factory.cpp b/frameworks/reminder/src/reminder_request_factory.cpp index 9cf50fd57..b257db47c 100644 --- a/frameworks/reminder/src/reminder_request_factory.cpp +++ b/frameworks/reminder/src/reminder_request_factory.cpp @@ -46,12 +46,12 @@ ReminderRequest* ReminderRequestFactory::CreateReminderRequest(ReminderRequest:: break; } default: { - ANSR_LOGW("Create ReminderRequest fail."); + ANSR_LOGE("Create ReminderRequest fail."); return nullptr; } } if (reminderRequest == nullptr) { - ANSR_LOGW("CreateReminderRequest fail."); + ANSR_LOGE("CreateReminderRequest fail."); return nullptr; } reminderRequest->SetReminderType(reminderType); diff --git a/frameworks/reminder/src/reminder_request_timer.cpp b/frameworks/reminder/src/reminder_request_timer.cpp index fb581fde4..9358fc834 100644 --- a/frameworks/reminder/src/reminder_request_timer.cpp +++ b/frameworks/reminder/src/reminder_request_timer.cpp @@ -34,13 +34,13 @@ ReminderRequestTimer::ReminderRequestTimer(uint64_t countDownTimeInSeconds) ReminderRequest::GetDurationSinceEpochInMilli(now) + countDownTimeInSeconds_ * ReminderRequest::MILLI_SECONDS); sptr timer = MiscServices::TimeServiceClient::GetInstance(); if (timer == nullptr) { - ANSR_LOGW("Failed to get boot time due to TimeServiceClient is null."); + ANSR_LOGE("Failed to get boot time due to TimeServiceClient is null."); } else { int64_t bootTimeMs = timer->GetBootTimeMs(); if (bootTimeMs >= 0) { firstRealTimeInMilliSeconds_ = static_cast(bootTimeMs); } else { - ANSR_LOGW("Get boot time error."); + ANSR_LOGE("Get boot time error."); } } } @@ -106,12 +106,12 @@ void ReminderRequestTimer::UpdateTimeInfo(const std::string &description) whenToChangeSysTime_ = ReminderRequest::GetDurationSinceEpochInMilli(now); sptr timer = MiscServices::TimeServiceClient::GetInstance(); if (timer == nullptr) { - ANSR_LOGW("Failed to updateTime info due to TimeServiceClient is null."); + ANSR_LOGE("Failed to updateTime info due to TimeServiceClient is null."); return; } int64_t bootTime = timer->GetBootTimeMs(); if (bootTime < 0) { - ANSR_LOGW("BootTime is illegal"); + ANSR_LOGE("BootTime is illegal"); return; } SetTriggerTimeInMilli(whenToChangeSysTime_ + countDownTimeInSeconds_ * MILLI_SECONDS - diff --git a/frameworks/reminder/src/reminder_service_load_callback.cpp b/frameworks/reminder/src/reminder_service_load_callback.cpp index ffda91ae1..24bfb7283 100644 --- a/frameworks/reminder/src/reminder_service_load_callback.cpp +++ b/frameworks/reminder/src/reminder_service_load_callback.cpp @@ -33,7 +33,7 @@ void ReminderServiceCallback::OnLoadSystemAbilitySuccess( void ReminderServiceCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { DelayedSingleton::GetInstance()->LoadSystemAbilityFail(); - ANS_LOGI("on load system ability failed!"); + ANS_LOGE("on load system ability failed!"); } } } \ No newline at end of file diff --git a/interfaces/ndk/src/notification.cpp b/interfaces/ndk/src/notification.cpp index 1b1fe73aa..22ad319de 100644 --- a/interfaces/ndk/src/notification.cpp +++ b/interfaces/ndk/src/notification.cpp @@ -27,7 +27,7 @@ bool OH_Notification_IsNotificationEnabled(void) bool isEnable = false; int32_t result = OHOS::Notification::NotificationHelper::IsAllowedNotifySelf(isEnable); if (result != OHOS::ERR_OK) { - ANS_LOGW("Get notification enable failed %{public}d", result); + ANS_LOGE("Get notification enable failed %{public}d", result); return false; } return isEnable; diff --git a/services/ans/src/advanced_notification_flow_control_service.cpp b/services/ans/src/advanced_notification_flow_control_service.cpp index 2c47d90bf..78ffa1be3 100644 --- a/services/ans/src/advanced_notification_flow_control_service.cpp +++ b/services/ans/src/advanced_notification_flow_control_service.cpp @@ -40,7 +40,7 @@ ErrCode FlowControlService::FlowControl(const std::shared_ptrrequest->IsUpdateOnly()) { - ANS_LOGW("Notification not exists when update"); + ANS_LOGE("Notification not exists when update"); return ERR_ANS_NOTIFICATION_NOT_EXISTS; } result = PublishFlowCtrl(record, callingUid); diff --git a/services/ans/src/advanced_notification_utils.cpp b/services/ans/src/advanced_notification_utils.cpp index 74c1c6816..fa38c41e9 100644 --- a/services/ans/src/advanced_notification_utils.cpp +++ b/services/ans/src/advanced_notification_utils.cpp @@ -293,7 +293,7 @@ ErrCode AdvancedNotificationService::GetActiveNotificationByFilter( bundle->GetUid(), IPCSkeleton::GetCallingUid()); } else { if (!AccessTokenHelper::CheckPermission(OHOS_PERMISSION_NOTIFICATION_CONTROLLER)) { - ANS_LOGW("Get live view by filter failed because check permission is false."); + ANS_LOGE("Get live view by filter failed because check permission is false."); return ERR_ANS_PERMISSION_DENIED; } } @@ -337,7 +337,7 @@ void AdvancedNotificationService::SetAgentNotification(sptr auto bundleManager = BundleManagerHelper::GetInstance(); int32_t activeUserId = -1; if (OsAccountManagerHelper::GetInstance().GetCurrentActiveUserId(activeUserId) != ERR_OK) { - ANSR_LOGW("Failed to get active user id!"); + ANSR_LOGE("Failed to get active user id!"); return; } @@ -540,7 +540,7 @@ void AdvancedNotificationService::OnBundleRemoved(const sptrRemoveNotificationForBundle(bundleOption); if (result != ERR_OK) { - ANS_LOGW("NotificationPreferences::RemoveNotificationForBundle failed: %{public}d", result); + ANS_LOGE("NotificationPreferences::RemoveNotificationForBundle failed: %{public}d", result); } #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED DistributedPreferences::GetInstance()->DeleteDistributedBundleInfo(bundleOption); diff --git a/services/ans/src/bundle_manager_helper.cpp b/services/ans/src/bundle_manager_helper.cpp index 2605e2ada..a5c34e305 100644 --- a/services/ans/src/bundle_manager_helper.cpp +++ b/services/ans/src/bundle_manager_helper.cpp @@ -93,7 +93,7 @@ bool BundleManagerHelper::CheckApiCompatibility(const std::string &bundleName, c int32_t callingUserId; AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(uid, callingUserId); if (!GetBundleInfoByBundleName(bundleName, callingUserId, bundleInfo)) { - ANS_LOGW("Failed to GetBundleInfoByBundleName, bundlename = %{public}s", + ANS_LOGE("Failed to GetBundleInfoByBundleName, bundlename = %{public}s", bundleName.c_str()); return false; } diff --git a/services/ans/src/clone/notification_clone_manager.cpp b/services/ans/src/clone/notification_clone_manager.cpp index 51ac15dae..f085944b1 100644 --- a/services/ans/src/clone/notification_clone_manager.cpp +++ b/services/ans/src/clone/notification_clone_manager.cpp @@ -88,13 +88,13 @@ int32_t NotificationCloneManager::OnBackup(MessageParcel& data, MessageParcel& r FILE *fdfile = fopen(BACKUP_CONFIG_FILE_PATH, "r"); if (fdfile == nullptr) { - ANS_LOGW("Notification open file failed."); + ANS_LOGE("Notification open file failed."); return ANS_CLONE_ERROR; } auto fd = fileno(fdfile); if (reply.WriteFileDescriptor(fd) == false) { (void)fclose(fdfile); - ANS_LOGW("Notification write file descriptor failed!"); + ANS_LOGE("Notification write file descriptor failed!"); return ANS_CLONE_ERROR; } @@ -149,24 +149,24 @@ ErrCode NotificationCloneManager::LoadConfig(UniqueFd &fd, std::string& config) ANS_LOGI("Load notification config."); struct stat statBuf; if (fstat(fd.Get(), &statBuf) < 0) { - ANS_LOGW("LoadConfig fstat fd fail %{public}d.", fd.Get()); + ANS_LOGE("LoadConfig fstat fd fail %{public}d.", fd.Get()); return ANS_CLONE_ERROR; } int destFd = open(BACKUP_CONFIG_FILE_PATH, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (destFd < 0) { - ANS_LOGW("LoadConfig open file fail."); + ANS_LOGE("LoadConfig open file fail."); return ANS_CLONE_ERROR; } fdsan_exchange_owner_tag(destFd, COMMON_FDSAN_TAG, NOTIFICATION_FDSAN_TAG); if (sendfile(destFd, fd.Get(), nullptr, statBuf.st_size) < 0) { - ANS_LOGW("LoadConfig fd sendfile(size: %{public}d) to destFd fail.", static_cast(statBuf.st_size)); + ANS_LOGE("LoadConfig fd sendfile(size: %{public}d) to destFd fail.", static_cast(statBuf.st_size)); fdsan_close_with_tag(destFd, NOTIFICATION_FDSAN_TAG); return ANS_CLONE_ERROR; } fdsan_close_with_tag(destFd, NOTIFICATION_FDSAN_TAG); 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%{public}s is_open() failed!", BACKUP_CONFIG_FILE_PATH); return ANS_CLONE_ERROR; } config.clear(); @@ -184,13 +184,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: %{public}s, fopen() failed!", BACKUP_CONFIG_FILE_PATH); 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: %{public}s, fwrite %{public}d failed!", BACKUP_CONFIG_FILE_PATH, ret); } (void)fflush(fp); (void)fsync(fileno(fp)); diff --git a/services/ans/src/common/notification_analytics_util.cpp b/services/ans/src/common/notification_analytics_util.cpp index e3a520ca4..7582479bb 100644 --- a/services/ans/src/common/notification_analytics_util.cpp +++ b/services/ans/src/common/notification_analytics_util.cpp @@ -461,7 +461,7 @@ void NotificationAnalyticsUtil::ReportModifyEvent(const HaMetaMessage& message) void NotificationAnalyticsUtil::ReportDeleteFailedEvent(const HaMetaMessage& message) { if (!ReportFlowControl(DELETE_ERROR_EVENT_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; @@ -859,7 +859,7 @@ int64_t NotificationAnalyticsUtil::GetCurrentTime() void NotificationAnalyticsUtil::ReportOperationsDotEvent(const HaMetaMessage& message) { if (!ReportFlowControl(ANS_CUSTOMIZE_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; @@ -876,7 +876,7 @@ void NotificationAnalyticsUtil::ReportOperationsDotEvent(const HaMetaMessage& me void NotificationAnalyticsUtil::ReportPublishFailedEvent(const HaMetaMessage& message) { if (!ReportFlowControl(PUBLISH_ERROR_EVENT_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; @@ -954,7 +954,7 @@ std::string NotificationAnalyticsUtil::BuildAnsData(const HaMetaMessage& message void NotificationAnalyticsUtil::ReportSkipFailedEvent(const HaMetaMessage& message) { if (!ReportFlowControl(MODIFY_ERROR_EVENT_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; diff --git a/services/ans/src/common/notification_config_parse.cpp b/services/ans/src/common/notification_config_parse.cpp index aef8410f5..e9adb280f 100644 --- a/services/ans/src/common/notification_config_parse.cpp +++ b/services/ans/src/common/notification_config_parse.cpp @@ -53,7 +53,7 @@ std::shared_ptr NotificationConfigParse::GetAppPrivil return nullptr; } if (!root.contains(APP_PRIVILEGES)) { - ANS_LOGW("not found jsonKey appPrivileges"); + ANS_LOGE("not found jsonKey appPrivileges"); return nullptr; } nlohmann::json affects = root[APP_PRIVILEGES]; @@ -208,7 +208,7 @@ void NotificationConfigParse::GetFlowCtrlConfigFromCCM(FlowControlThreshold &thr return; } if (!root.contains(CFG_KEY_NOTIFICATION_SERVICE)) { - ANS_LOGW("GetFlowCtrlConfigFromCCM not found jsonKey"); + ANS_LOGE("GetFlowCtrlConfigFromCCM not found jsonKey"); return; } nlohmann::json affects = root[CFG_KEY_NOTIFICATION_SERVICE]; @@ -399,7 +399,7 @@ void NotificationConfigParse::GetCollaborationFilter() bool NotificationConfigParse::IsInCollaborationFilter(const std::string& bundleName, int32_t uid) const { if (uidList_.empty() && bundleNameList_.empty()) { - ANS_LOGW("UidList and bundleNameList empty."); + ANS_LOGE("UidList and bundleNameList empty."); return false; } @@ -413,7 +413,7 @@ bool NotificationConfigParse::IsInCollaborationFilter(const std::string& bundleN return true; } - ANS_LOGI("Uid <%{public}d> and BundleName <%{public}s> not in CollaborationFilter.", uid, bundleName.c_str()); + ANS_LOGE("Uid <%{public}d> and BundleName <%{public}s> not in CollaborationFilter.", uid, bundleName.c_str()); return false; } @@ -427,7 +427,7 @@ uint32_t NotificationConfigParse::GetStartAbilityTimeout() return 0; } if (!root.contains(CFG_KEY_NOTIFICATION_SERVICE)) { - ANS_LOGW("GetStartAbilityTimeout not found jsonKey"); + ANS_LOGE("GetStartAbilityTimeout not found jsonKey"); return 0; } nlohmann::json affects = root[CFG_KEY_NOTIFICATION_SERVICE]; diff --git a/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp b/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp index b5034d17e..daf9d1054 100644 --- a/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp +++ b/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp @@ -52,7 +52,7 @@ ErrCode DisturbManager::AddDoNotDisturbProfilesSyncQueue( { int32_t userId = SUBSCRIBE_USER_INIT; if (OsAccountManagerHelper::GetInstance().GetCurrentActiveUserId(userId) != ERR_OK) { - ANS_LOGW("No active user found."); + ANS_LOGE("No active user found."); return ERR_ANS_GET_ACTIVE_USER_FAILED; } AdvancedNotificationService::GetInstance()->SubmitSyncTask( diff --git a/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp b/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp index 3acd1fbbd..365271f6a 100644 --- a/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp +++ b/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp @@ -38,7 +38,7 @@ ErrCode DisturbManager::HandleGetDoNotDisturbProfile(MessageParcel &data, Messag if (result == ERR_OK) { if (!reply.WriteParcelable(profile)) { - ANS_LOGE("HandleGetDoNotDisturbProfile write slot failed."); + ANS_LOGE("HandleGetDoNotDisturbProfile write profile failed."); return ERR_ANS_PARCELABLE_FAILED; } } @@ -49,7 +49,7 @@ ErrCode DisturbManager::GetDoNotDisturbProfileInner(int64_t id, sptrSubmitSyncTask( diff --git a/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp b/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp index a1b2f6317..52b42d0b4 100644 --- a/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp +++ b/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp @@ -74,7 +74,7 @@ ErrCode DisturbManager::SetDoNotDisturbDate(const sptr("ans_extension"); if (distributedQueue_ == nullptr) { - ANS_LOGW("ffrt create failed!"); + ANS_LOGE("ffrt create failed!"); return; } } @@ -234,7 +234,7 @@ void DistributedExtensionService::OnDeviceOnline(const DmDeviceInfo &deviceInfo) { std::string name = TransDeviceTypeToName(deviceInfo.deviceTypeId); if (deviceConfig_.supportPeerDevice.find(name) == deviceConfig_.supportPeerDevice.end()) { - ANS_LOGI("The current device type not support %{public}d.", deviceInfo.deviceTypeId); + ANS_LOGE("The current device type not support %{public}d.", deviceInfo.deviceTypeId); return; } if (distributedQueue_ == nullptr) { @@ -242,13 +242,13 @@ void DistributedExtensionService::OnDeviceOnline(const DmDeviceInfo &deviceInfo) } std::function onlineTask = std::bind([&, deviceInfo]() { if (InitDans() != 0) { - ANS_LOGW("OnDeviceOnline init dans failed."); + ANS_LOGE("OnDeviceOnline init dans failed."); return; }; ADD_DEVICE handler = (ADD_DEVICE)dansHandler_->GetProxyFunc("AddDevice"); if (handler == nullptr) { - ANS_LOGW("Dans handler is null ptr."); + ANS_LOGE("Dans handler is null ptr."); return; } std::lock_guard lock(mapLock_); @@ -331,16 +331,16 @@ void DistributedExtensionService::OnDeviceOffline(const DmDeviceInfo &deviceInfo std::function offlineTask = std::bind([&, deviceInfo]() { std::lock_guard lock(mapLock_); if (deviceMap_.count(deviceInfo.deviceId) == 0) { - ANS_LOGI("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); + ANS_LOGE("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); return; } if (!dansRunning_.load() || dansHandler_ == nullptr || !dansHandler_->IsValid()) { - ANS_LOGW("Dans state not normal %{public}d", dansRunning_.load()); + ANS_LOGE("Dans state not normal %{public}d", dansRunning_.load()); return; } RELEASE_DEVICE handler = (RELEASE_DEVICE)dansHandler_->GetProxyFunc("ReleaseDevice"); if (handler == nullptr) { - ANS_LOGW("Dans handler is null ptr."); + ANS_LOGE("Dans handler is null ptr."); return; } handler(deviceInfo.deviceId, deviceInfo.deviceTypeId); @@ -360,16 +360,16 @@ void DistributedExtensionService::OnDeviceChanged(const DmDeviceInfo &deviceInfo std::function changeTask = std::bind([&, deviceInfo]() { std::lock_guard lock(mapLock_); if (deviceMap_.count(deviceInfo.deviceId) == 0) { - ANS_LOGI("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); + ANS_LOGE("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); return; } if (!dansRunning_.load() || dansHandler_ == nullptr || !dansHandler_->IsValid()) { - ANS_LOGW("Dans state not normal %{public}d", dansRunning_.load()); + ANS_LOGE("Dans state not normal %{public}d", dansRunning_.load()); return; } REFRESH_DEVICE handler = (REFRESH_DEVICE)dansHandler_->GetProxyFunc("RefreshDevice"); if (handler == nullptr) { - ANS_LOGW("Dans handler is null ptr."); + ANS_LOGE("Dans handler is null ptr."); return; } handler(deviceInfo.deviceId, deviceInfo.deviceTypeId, deviceInfo.networkId); diff --git a/services/ans/src/notification_extension/notification_operation_service.cpp b/services/ans/src/notification_extension/notification_operation_service.cpp index 9535890d4..da309df44 100644 --- a/services/ans/src/notification_extension/notification_operation_service.cpp +++ b/services/ans/src/notification_extension/notification_operation_service.cpp @@ -41,7 +41,7 @@ DistributedOperationService::DistributedOperationService() { operationQueue_ = std::make_shared("ans_operation"); if (operationQueue_ == nullptr) { - ANS_LOGW("ffrt create failed!"); + ANS_LOGE("ffrt create failed!"); return; } ANS_LOGI("Operation service init successfully."); 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 575a4b66b..e0f23ab95 100644 --- a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp +++ b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp @@ -50,19 +50,19 @@ void SmartReminderCenter::GetMultiDeviceReminder() multiJsonPoint.append("/"); multiJsonPoint.append(MULTI_DEVICE_REMINDER); if (!DelayedSingleton::GetInstance()->GetConfigJson(multiJsonPoint, root)) { - ANS_LOGW("Failed to get multiDeviceReminder CCM config file."); + ANS_LOGE("Failed to get multiDeviceReminder CCM config file."); return; } if (root.find(NotificationConfigParse::CFG_KEY_NOTIFICATION_SERVICE) == root.end()) { - ANS_LOGW("GetMultiDeviceReminder failed as can not find notificationService."); + ANS_LOGE("GetMultiDeviceReminder failed as can not find notificationService."); return; } nlohmann::json multiDeviceRemindJson = root[NotificationConfigParse::CFG_KEY_NOTIFICATION_SERVICE][MULTI_DEVICE_REMINDER]; if (multiDeviceRemindJson.is_null() || !multiDeviceRemindJson.is_array() || multiDeviceRemindJson.empty()) { - ANS_LOGW("GetMultiDeviceReminder failed as invalid multiDeviceReminder json."); + ANS_LOGE("GetMultiDeviceReminder failed as invalid multiDeviceReminder json."); return; } diff --git a/services/ans/src/reminder_swing_decision_center.cpp b/services/ans/src/reminder_swing_decision_center.cpp index 3749c8b71..ec2894ccd 100644 --- a/services/ans/src/reminder_swing_decision_center.cpp +++ b/services/ans/src/reminder_swing_decision_center.cpp @@ -37,7 +37,7 @@ ReminderSwingDecisionCenter &ReminderSwingDecisionCenter::GetInstance() ErrCode ReminderSwingDecisionCenter::RegisterSwingCallback(const sptr &swingCallback) { if (swingCallback == nullptr) { - ANS_LOGW("swingCallback is null."); + ANS_LOGE("swingCallback is null."); return ERR_INVALID_VALUE; } swingRecipient_ = new (nothrow) SwingCallbackRecipient(); diff --git a/services/ans/src/utils/notifictaion_load_utils.cpp b/services/ans/src/utils/notifictaion_load_utils.cpp index 83edd6ec6..908a12a61 100644 --- a/services/ans/src/utils/notifictaion_load_utils.cpp +++ b/services/ans/src/utils/notifictaion_load_utils.cpp @@ -43,7 +43,7 @@ NotificationLoadUtils::~NotificationLoadUtils() void* NotificationLoadUtils::GetProxyFunc(const std::string& func) { if (proxyHandle_ == nullptr) { - ANS_LOGW("Get func failed: %{public}s %{public}s", path_.c_str(), func.c_str()); + ANS_LOGE("Get func failed: %{public}s %{public}s", path_.c_str(), func.c_str()); return nullptr; } diff --git a/services/reminder/src/reminder_config_change_observer.cpp b/services/reminder/src/reminder_config_change_observer.cpp index e0efc126f..a19712fb0 100644 --- a/services/reminder/src/reminder_config_change_observer.cpp +++ b/services/reminder/src/reminder_config_change_observer.cpp @@ -26,7 +26,7 @@ void ReminderConfigChangeObserver::OnConfigurationUpdated(const AppExecFwk::Conf ANSR_LOGD("OnConfigurationUpdated."); auto reminderDataMgr = ReminderDataManager::GetInstance(); if (reminderDataMgr == nullptr) { - ANSR_LOGW("Reminder data manager is nullptr"); + ANSR_LOGE("Reminder data manager is nullptr"); return; } std::string newLanguageInfo = configuration.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_LANGUAGE); diff --git a/services/reminder/src/reminder_data_manager.cpp b/services/reminder/src/reminder_data_manager.cpp index 50d44a7c4..93569ba02 100644 --- a/services/reminder/src/reminder_data_manager.cpp +++ b/services/reminder/src/reminder_data_manager.cpp @@ -1175,12 +1175,12 @@ void ReminderDataManager::StartRecentReminder() std::lock_guard lock(ReminderDataManager::MUTEX); sptr reminder = GetRecentReminder(); if (reminder == nullptr) { - ANSR_LOGI("No reminder need to start"); + ANSR_LOGW("No reminder need to start"); SetActiveReminder(reminder); return; } if (activeReminderId_ == reminder->GetReminderId()) { - ANSR_LOGI("Recent reminder has already run, no need to start again."); + ANSR_LOGW("Recent reminder has already run, no need to start again."); return; } if (activeReminderId_ != -1) { diff --git a/services/reminder/src/reminder_data_manager_inner.cpp b/services/reminder/src/reminder_data_manager_inner.cpp index f71bfb87a..1e0eb507a 100644 --- a/services/reminder/src/reminder_data_manager_inner.cpp +++ b/services/reminder/src/reminder_data_manager_inner.cpp @@ -139,12 +139,12 @@ void ReminderDataManager::CloseCustomRingFileDesc(const int32_t reminderId, cons { std::lock_guard locker(resourceMutex_); if (soundResource_ == nullptr) { - ANSR_LOGW("ResourceManager is nullptr."); + ANSR_LOGE("ResourceManager is nullptr."); return; } auto result = soundResource_->CloseRawFileDescriptor(customRingUri); if (result != Global::Resource::SUCCESS) { - ANSR_LOGW("CloseRawFileDescriptor fail[%{public}d]", static_cast(result)); + ANSR_LOGE("CloseRawFileDescriptor fail[%{public}d]", static_cast(result)); } ANSR_LOGI("Stop custom sound, reminderId:[%{public}d].", reminderId); soundResource_ = nullptr; @@ -170,7 +170,7 @@ bool ReminderDataManager::CheckShowLimit(std::unordered_map& reminder) { if (totalCount > TOTAL_MAX_NUMBER_SHOW_AT_ONCE) { - ANSR_LOGW("The maximum number of displays that can be displayed at a time has been reached."); + ANSR_LOGE("The maximum number of displays that can be displayed at a time has been reached."); return false; } ++totalCount; @@ -181,7 +181,7 @@ bool ReminderDataManager::CheckShowLimit(std::unordered_mapsecond > ONE_HAP_MAX_NUMBER_SHOW_AT_ONCE) { - ANSR_LOGW("The maximum number of displays that can be displayed in a single app[%{public}s] has been reached", + ANSR_LOGE("The maximum number of displays that can be displayed in a single app[%{public}s] has been reached", reminder->GetBundleName().c_str()); return false; } @@ -230,19 +230,19 @@ void ReminderDataManager::AsyncStartExtensionAbility(const sptr { auto manager = ReminderDataManager::GetInstance(); if (manager == nullptr) { - ANSR_LOGW("ReminderDataManager is nullptr."); + ANSR_LOGE("ReminderDataManager is nullptr."); return; } if (!manager->IsSystemReady()) { - ANSR_LOGW("bundle service or ability service not ready."); + ANSR_LOGE("bundle service or ability service not ready."); return; } if (!reminder->IsSystemApp()) { - ANSR_LOGI("Start extension ability failed, is not system app"); + ANSR_LOGE("Start extension ability failed, is not system app"); return; } if (count > TOTAL_MAX_NUMBER_START_EXTENSION) { - ANSR_LOGW("The maximum number of start extension has been reached."); + ANSR_LOGE("The maximum number of start extension has been reached."); return; } ++count; -- Gitee From 4db0967d9894774747bee47aa4e69501b092ec96 Mon Sep 17 00:00:00 2001 From: heguokai Date: Mon, 24 Mar 2025 16:56:06 +0800 Subject: [PATCH 2/5] log change Signed-off-by: heguokai --- frameworks/ans/src/notification.cpp | 2 +- .../ans/src/notification_button_option.cpp | 2 +- .../src/notification_live_view_content.cpp | 2 +- .../ans/src/notification_operation_info.cpp | 18 +++--- frameworks/ans/src/notification_request.cpp | 20 +++--- frameworks/ans/src/notification_slot.cpp | 4 +- frameworks/ans/src/notification_sorting.cpp | 2 +- .../ans/src/notification_subscriber.cpp | 2 +- frameworks/ans/src/push_callback_stub.cpp | 6 +- frameworks/core/src/ans_image_util.cpp | 18 +++--- frameworks/core/src/ans_notification.cpp | 4 +- .../src/listener/ans_subscriber_listener.cpp | 26 ++++---- .../src/listener/ans_subscriber_proxy.cpp | 4 +- .../core/src/listener/ans_subscriber_stub.cpp | 22 +++---- .../manager/ans_manager_death_recipient.cpp | 4 +- .../src/manager/ans_manager_proxy_utils.cpp | 2 +- frameworks/js/napi/src/cancel.cpp | 20 +++--- frameworks/js/napi/src/common.cpp | 4 +- .../js/napi/src/common_convert_content.cpp | 4 +- .../js/napi/src/common_convert_liveview.cpp | 6 +- .../js/napi/src/common_convert_request.cpp | 12 ++-- .../js/napi/src/disable_notification.cpp | 2 +- frameworks/js/napi/src/display_badge.cpp | 14 ++-- frameworks/js/napi/src/distributed.cpp | 6 +- .../src/distributed_operation_callback.cpp | 8 +-- frameworks/js/napi/src/disturb_mode.cpp | 14 ++-- .../js/napi/src/enable_notification.cpp | 12 ++-- .../src/manager/napi_disable_notification.cpp | 8 ++- .../src/manager/napi_distributed_enable.cpp | 22 +++---- .../src/manager/napi_enable_notification.cpp | 8 +-- .../js/napi/src/manager/napi_get_active.cpp | 6 +- .../napi/src/manager/napi_push_callback.cpp | 2 +- .../js/napi/src/manager/napi_remove_group.cpp | 8 +-- .../js/napi/src/manager/napi_sync_config.cpp | 8 +-- frameworks/js/napi/src/publish.cpp | 26 ++++---- frameworks/js/napi/src/reminder/publish.cpp | 42 ++++++------ .../js/napi/src/reminder/reminder_common.cpp | 64 +++++++++---------- frameworks/js/napi/src/remove.cpp | 26 ++++---- .../reminder/src/reminder_request_factory.cpp | 4 +- .../reminder/src/reminder_request_timer.cpp | 8 +-- .../src/reminder_service_load_callback.cpp | 2 +- interfaces/ndk/src/notification.cpp | 2 +- ...nced_notification_flow_control_service.cpp | 2 +- .../ans/src/advanced_notification_utils.cpp | 6 +- services/ans/src/bundle_manager_helper.cpp | 2 +- .../src/clone/notification_clone_manager.cpp | 16 ++--- .../common/notification_analytics_util.cpp | 8 +-- .../src/common/notification_config_parse.cpp | 10 +-- .../add_do_not_disturb_profiles.cpp | 2 +- .../get_do_not_disturb_profile.cpp | 4 +- .../remove_do_not_disturb_profiles.cpp | 2 +- .../set_do_not_disturb_date.cpp | 2 +- .../distributed_device_manager.cpp | 2 +- .../distributed_extension_service.cpp | 20 +++--- .../notification_operation_service.cpp | 2 +- .../smart_reminder_center.cpp | 6 +- .../src/reminder_swing_decision_center.cpp | 2 +- .../ans/src/utils/notifictaion_load_utils.cpp | 2 +- .../src/reminder_config_change_observer.cpp | 2 +- .../reminder/src/reminder_data_manager.cpp | 4 +- .../src/reminder_data_manager_inner.cpp | 16 ++--- 61 files changed, 294 insertions(+), 292 deletions(-) diff --git a/frameworks/ans/src/notification.cpp b/frameworks/ans/src/notification.cpp index de8e4950f..4377d7d03 100644 --- a/frameworks/ans/src/notification.cpp +++ b/frameworks/ans/src/notification.cpp @@ -315,7 +315,7 @@ bool Notification::MarshallingString(Parcel &parcel) const bool Notification::MarshallingInt32(Parcel &parcel) const { if (!parcel.WriteInt32(ledLightColor_)) { - ANS_LOGE("Can't write ledLigthColor"); + ANS_LOGE("Can't write ledLightColor"); return false; } diff --git a/frameworks/ans/src/notification_button_option.cpp b/frameworks/ans/src/notification_button_option.cpp index f125e02cb..5e2437a22 100644 --- a/frameworks/ans/src/notification_button_option.cpp +++ b/frameworks/ans/src/notification_button_option.cpp @@ -74,7 +74,7 @@ NotificationButtonOption *NotificationButtonOption::FromJson(const nlohmann::jso bool NotificationButtonOption::Marshalling(Parcel &parcel) const { if (!parcel.WriteString(buttonName_)) { - ANS_LOGE("Failed to write title"); + ANS_LOGE("Failed to write buttonName"); return false; } diff --git a/frameworks/ans/src/notification_live_view_content.cpp b/frameworks/ans/src/notification_live_view_content.cpp index dbac5cc7e..cda062ac7 100644 --- a/frameworks/ans/src/notification_live_view_content.cpp +++ b/frameworks/ans/src/notification_live_view_content.cpp @@ -220,7 +220,7 @@ bool NotificationLiveViewContent::Marshalling(Parcel &parcel) const } if (valid) { if (!parcel.WriteParcelable(extraInfo_.get())) { - ANS_LOGE("Failed to write additionalParams"); + ANS_LOGE("Failed to write extraInfo"); return false; } } diff --git a/frameworks/ans/src/notification_operation_info.cpp b/frameworks/ans/src/notification_operation_info.cpp index d02c30f2e..692e01622 100644 --- a/frameworks/ans/src/notification_operation_info.cpp +++ b/frameworks/ans/src/notification_operation_info.cpp @@ -88,27 +88,27 @@ std::string NotificationOperationInfo::Dump() bool NotificationOperationInfo::Marshalling(Parcel &parcel) const { if (!parcel.WriteString(actionName_)) { - ANS_LOGE("Failed to write action name"); + ANS_LOGE("Failed to write actionName"); return false; } if (!parcel.WriteString(userInput_)) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write userInput"); return false; } if (!parcel.WriteString(hashCode_)) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write hashCode"); return false; } if (!parcel.WriteString(eventId_)) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write eventId"); return false; } if (!parcel.WriteInt32(static_cast(operationType_))) { - ANS_LOGE("Failed to write user input"); + ANS_LOGE("Failed to write operationType"); return false; } @@ -118,22 +118,22 @@ bool NotificationOperationInfo::Marshalling(Parcel &parcel) const bool NotificationOperationInfo::ReadFromParcel(Parcel &parcel) { if (!parcel.ReadString(actionName_)) { - ANS_LOGE("Failed to read action name"); + ANS_LOGE("Failed to read actionName"); return false; } if (!parcel.ReadString(userInput_)) { - ANS_LOGE("Failed to read user input"); + ANS_LOGE("Failed to read userInput"); return false; } if (!parcel.ReadString(hashCode_)) { - ANS_LOGE("Failed to read action name"); + ANS_LOGE("Failed to read hashCode"); return false; } if (!parcel.ReadString(eventId_)) { - ANS_LOGE("Failed to read user input"); + ANS_LOGE("Failed to read eventId"); return false; } diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index a7b01c4c9..c1f298089 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -236,7 +236,7 @@ void NotificationRequest::SetIsAgentNotification(bool isAgent) void NotificationRequest::AddMessageUser(const std::shared_ptr &messageUser) { if (!messageUser) { - ANS_LOGI("messageUser can not be null"); + ANS_LOGE("messageUser can not be null"); return; } @@ -364,20 +364,20 @@ bool NotificationRequest::IsColorEnabled() const // no valid content if (!notificationContent_) { - ANS_LOGI("no valid notification content"); + ANS_LOGE("no valid notification content"); return false; } // not a media content if (NotificationContent::Type::MEDIA != notificationContentType_) { - ANS_LOGI("not a media notification content"); + ANS_LOGE("not a media notification content"); return false; } auto basicContent = notificationContent_->GetNotificationContent(); auto mediaContent = std::static_pointer_cast(basicContent); if (!mediaContent->GetAVToken()) { - ANS_LOGI("AVToken has not been attached"); + ANS_LOGE("AVToken has not been attached"); return false; } @@ -1136,7 +1136,7 @@ bool NotificationRequest::Marshalling(Parcel &parcel) const } if (!parcel.WriteString(distributedHashCode_)) { - ANS_LOGE("Failed to write sound"); + ANS_LOGE("Failed to write distributedHashCode"); return false; } @@ -1618,7 +1618,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t slotTypeValue = parcel.ReadInt32(); if (slotTypeValue < 0 || slotTypeValue >= static_cast(NotificationConstant::SlotType::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid slot type value :%{public}d. It should be in [0 , %{public}d).", + ANS_LOGE("Invalid SlotType:%{public}d. It should be in [0 , %{public}d).", slotTypeValue, static_cast(NotificationConstant::SlotType::ILLEGAL_TYPE)); return false; } @@ -1626,7 +1626,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t groupAlertTypeValue = parcel.ReadInt32(); if (groupAlertTypeValue < 0 || groupAlertTypeValue >= static_cast(NotificationRequest::GroupAlertType::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid groupAlert type value :%{public}d. It should be in [0 , %{public}d).", + ANS_LOGE("Invalid GroupAlertType:%{public}d. It should be in [0 , %{public}d).", groupAlertTypeValue, static_cast(NotificationRequest::GroupAlertType::ILLEGAL_TYPE)); return false; } @@ -1634,14 +1634,14 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t visiblenessTypeValue = parcel.ReadInt32(); if (visiblenessTypeValue < 0 || visiblenessTypeValue >= static_cast(NotificationConstant::VisiblenessType::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid visibleness type value :%{public}d. It should be in [0 , %{public}d).", + ANS_LOGE("Invalid VisiblenessType:%{public}d. It should be in [0 , %{public}d).", visiblenessTypeValue, static_cast(NotificationConstant::VisiblenessType::ILLEGAL_TYPE)); return false; } visiblenessType_ = static_cast(visiblenessTypeValue); int32_t badgeStyleValue = parcel.ReadInt32(); if (badgeStyleValue < 0) { - ANS_LOGE("Invalid badge style value :%{public}d. It should be greater than 0.", badgeStyleValue); + ANS_LOGE("Invalid badgeStyle:%{public}d. It should be greater than 0.", badgeStyleValue); return false; } if (badgeStyleValue >= static_cast(NotificationRequest::BadgeStyle::ILLEGAL_TYPE)) { @@ -1653,7 +1653,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) int32_t notificationContentTypeValue = parcel.ReadInt32(); if (notificationContentTypeValue <= static_cast(NotificationContent::Type::NONE) || notificationContentTypeValue >= static_cast(NotificationContent::Type::ILLEGAL_TYPE)) { - ANS_LOGE("Invalid notification content type value :%{public}d. It should be in (%{public}d , %{public}d)", + ANS_LOGE("Invalid notificationContent:%{public}d. It should be in (%{public}d , %{public}d)", notificationContentTypeValue, static_cast(NotificationContent::Type::NONE), static_cast(NotificationContent::Type::ILLEGAL_TYPE)); return false; diff --git a/frameworks/ans/src/notification_slot.cpp b/frameworks/ans/src/notification_slot.cpp index 61ce2be2d..59385e761 100644 --- a/frameworks/ans/src/notification_slot.cpp +++ b/frameworks/ans/src/notification_slot.cpp @@ -387,12 +387,12 @@ bool NotificationSlot::Marshalling(Parcel &parcel) const if (sound_.ToString().empty()) { if (!parcel.WriteInt32(VALUE_NULL)) { - ANS_LOGE("Failed to write int"); + ANS_LOGE("Failed to write VALUE_NULL"); return false; } } else { if (!parcel.WriteInt32(VALUE_OBJECT)) { - ANS_LOGE("Failed to write int"); + ANS_LOGE("Failed to write VALUE_OBJECT"); return false; } if (!parcel.WriteString((sound_.ToString()))) { diff --git a/frameworks/ans/src/notification_sorting.cpp b/frameworks/ans/src/notification_sorting.cpp index 6a392de8b..804e447eb 100644 --- a/frameworks/ans/src/notification_sorting.cpp +++ b/frameworks/ans/src/notification_sorting.cpp @@ -83,7 +83,7 @@ bool NotificationSorting::Marshalling(Parcel &parcel) const } if (!parcel.WriteInt32(visiblenessOverride_)) { - ANS_LOGE("Can't write importance"); + ANS_LOGE("Can't write visiblenessOverride"); return false; } diff --git a/frameworks/ans/src/notification_subscriber.cpp b/frameworks/ans/src/notification_subscriber.cpp index cd256b4fe..0ae73181b 100644 --- a/frameworks/ans/src/notification_subscriber.cpp +++ b/frameworks/ans/src/notification_subscriber.cpp @@ -85,7 +85,7 @@ bool NotificationSubscriber::ProcessSyncDecision( if (deviceType.size() <= 0 || deviceType.compare(NotificationConstant::CURRENT_DEVICE_TYPE) == 0) { return true; } - ANS_LOGI("Cannot find deviceFlags,notificationKey = %{public}s, deviceType: %{public}s.", + ANS_LOGE("Cannot find deviceFlags,notificationKey = %{public}s, deviceType: %{public}s.", request->GetKey().c_str(), deviceType.c_str()); return false; } diff --git a/frameworks/ans/src/push_callback_stub.cpp b/frameworks/ans/src/push_callback_stub.cpp index aefe12c23..7b317d7bf 100644 --- a/frameworks/ans/src/push_callback_stub.cpp +++ b/frameworks/ans/src/push_callback_stub.cpp @@ -156,12 +156,12 @@ void PushCallBackProxy::HandleEventControl( std::string eventControl, const std::shared_ptr &pushCallBackParam) { if (pushCallBackParam == nullptr) { - ANS_LOGI("pushCallBackParam is null"); + ANS_LOGE("pushCallBackParam is null"); return; } std::string event = pushCallBackParam->event; if (event.empty()) { - ANS_LOGI("event is null"); + ANS_LOGE("event is null"); return; } ANS_LOGI("eventControl:%{public}s,event:%{public}s", eventControl.c_str(), event.c_str()); @@ -174,7 +174,7 @@ void PushCallBackProxy::HandleEventControl( return; } if (jsonObject.find(event) == jsonObject.cend()) { - ANS_LOGI("This event has not eventControl"); + ANS_LOGE("This event has not eventControl"); return; } pushCallBackParam->eventControl = jsonObject.at(event).dump(); diff --git a/frameworks/core/src/ans_image_util.cpp b/frameworks/core/src/ans_image_util.cpp index 601168f1c..f5c2458bb 100644 --- a/frameworks/core/src/ans_image_util.cpp +++ b/frameworks/core/src/ans_image_util.cpp @@ -42,12 +42,12 @@ std::string AnsImageUtil::PackImage(const std::shared_ptr &pixe std::set formats; auto ret = imagePacker.GetSupportedFormats(formats); if (ret) { - ANS_LOGE("Failed to GetSupportedFormats, ret : %{public}u", ret); + ANS_LOGE("Failed to GetSupportedFormats, ret:%{public}u", ret); return {}; } auto size = static_cast(pixelMap->GetByteCount()); - ANS_LOGD("size of pixelMap : %{public}u", size); + ANS_LOGD("size of pixelMap:%{public}u", size); if (size < DEFAULT_SIZE) { size = DEFAULT_SIZE; } @@ -61,7 +61,7 @@ std::string AnsImageUtil::PackImage(const std::shared_ptr &pixe imagePacker.AddImage(*pixelMap); int64_t packedSize {0}; imagePacker.FinalizePacking(packedSize); - ANS_LOGD("packed size : %{public}" PRId64, packedSize); + ANS_LOGD("packed size:%{public}" PRId64, packedSize); std::string pixelMapStr(reinterpret_cast(pbuf), static_cast(packedSize)); delete [] pbuf; @@ -106,7 +106,7 @@ bool AnsImageUtil::PackImage2File( const std::string &format) { if (!pixelMap || outFilePath.empty() || format.empty()) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return false; } @@ -127,14 +127,14 @@ bool AnsImageUtil::PackImage2File( imagePacker.AddImage(*pixelMap); int64_t packedSize {0}; imagePacker.FinalizePacking(packedSize); - ANS_LOGI("packed size : %{public}" PRId64, packedSize); + ANS_LOGI("packed size:%{public}" PRId64, packedSize); return true; } std::shared_ptr AnsImageUtil::CreatePixelMap(const std::string &inFilePath, const std::string &format) { if (inFilePath.empty() || format.empty()) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return {}; } @@ -150,7 +150,7 @@ std::shared_ptr AnsImageUtil::CreatePixelMap(const std::string std::set formats; auto ret = imageSource->GetSupportedFormats(formats); if (ret) { - ANS_LOGE("image packer get supported format failed, ret : %{public}u", ret); + ANS_LOGE("image packer get supported format failed, ret:%{public}u", ret); return {}; } @@ -167,7 +167,7 @@ std::shared_ptr AnsImageUtil::CreatePixelMap(const std::string bool AnsImageUtil::ImageScale(const std::shared_ptr &pixelMap, int32_t width, int32_t height) { if (!pixelMap || width == 0 || height == 0) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return false; } @@ -186,7 +186,7 @@ bool AnsImageUtil::ImageScale(const std::shared_ptr &pixelMap, std::shared_ptr AnsImageUtil::CreatePixelMapByString(const std::string &imagedata) { if (imagedata.empty()) { - ANS_LOGW("invalid parameters"); + ANS_LOGE("invalid parameters"); return {}; } diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index d48a2998f..f199dd41d 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -84,7 +84,7 @@ ErrCode AnsNotification::AddNotificationSlots(const std::vector proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("GetAnsManagerProxy fail."); @@ -1478,7 +1478,7 @@ ErrCode AnsNotification::CheckImageSize(const NotificationRequest &request) auto bigIcon = request.GetBigIcon(); if (NotificationRequest::CheckImageOverSizeForPixelMap(bigIcon, MAX_ICON_SIZE)) { request.ResetBigIcon(); - ANS_LOGI("The size of big icon exceeds limit"); + ANS_LOGW("The size of big icon exceeds limit"); } return ERR_OK; diff --git a/frameworks/core/src/listener/ans_subscriber_listener.cpp b/frameworks/core/src/listener/ans_subscriber_listener.cpp index 5b4ed3536..f35946283 100644 --- a/frameworks/core/src/listener/ans_subscriber_listener.cpp +++ b/frameworks/core/src/listener/ans_subscriber_listener.cpp @@ -33,7 +33,7 @@ void SubscriberListener::OnConnected() HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnConnected(); @@ -44,7 +44,7 @@ void SubscriberListener::OnDisconnected() HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnDisconnected(); @@ -56,7 +56,7 @@ void SubscriberListener::OnConsumed( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } @@ -86,7 +86,7 @@ void SubscriberListener::OnCanceled( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } if (notificationMap == nullptr) { @@ -103,7 +103,7 @@ void SubscriberListener::OnBatchCanceled(const std::vector> & { auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } std::vector> notificationList; @@ -125,7 +125,7 @@ void SubscriberListener::OnCanceledList(const std::vector> &n HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } if (subscriber->HasOnBatchCancelCallback()) { @@ -141,7 +141,7 @@ void SubscriberListener::OnUpdated(const sptr ¬ificat { auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnUpdate(std::make_shared(*notificationMap)); @@ -151,7 +151,7 @@ void SubscriberListener::OnDoNotDisturbDateChange(const sptrOnDoNotDisturbDateChange(std::make_shared(*date)); @@ -163,7 +163,7 @@ void SubscriberListener::OnEnabledNotificationChanged( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnEnabledNotificationChanged(std::make_shared(*callbackData)); @@ -174,7 +174,7 @@ void SubscriberListener::OnBadgeChanged(const sptr &bad HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnBadgeChanged(std::make_shared(*badgeData)); @@ -186,7 +186,7 @@ void SubscriberListener::OnBadgeEnabledChanged( HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnBadgeEnabledChanged(callbackData); @@ -195,10 +195,10 @@ void SubscriberListener::OnBadgeEnabledChanged( void SubscriberListener::OnApplicationInfoNeedChanged(const std::string& bundleName) { HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); - ANS_LOGE("OnApplicationInfoNeedChanged SubscriberListener 1."); + ANS_LOGW("OnApplicationInfoNeedChanged SubscriberListener 1."); auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { - ANS_LOGW("Subscriber is nullptr"); + ANS_LOGE("Subscriber is nullptr"); return; } subscriber->OnApplicationInfoNeedChanged(bundleName); diff --git a/frameworks/core/src/listener/ans_subscriber_proxy.cpp b/frameworks/core/src/listener/ans_subscriber_proxy.cpp index a4f53f45f..e1ba775b8 100644 --- a/frameworks/core/src/listener/ans_subscriber_proxy.cpp +++ b/frameworks/core/src/listener/ans_subscriber_proxy.cpp @@ -411,7 +411,7 @@ void AnsSubscriberProxy::OnApplicationInfoNeedChanged(const std::string& bundleN } if (!data.WriteString(bundleName)) { - ANS_LOGE("Write callback data failed."); + ANS_LOGE("Write bundleName failed."); return; } @@ -433,7 +433,7 @@ ErrCode AnsSubscriberProxy::OnOperationResponse(const sptr notification = data.ReadParcelable(); if (!notification) { - ANS_LOGW("[HandleOnCanceledMap] fail: notification ReadParcelable failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: notification ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } bool existMap = false; if (!data.ReadBool(existMap)) { - ANS_LOGW("[HandleOnCanceledMap] fail: read existMap failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: read existMap failed"); return ERR_ANS_PARCELABLE_FAILED; } @@ -185,14 +185,14 @@ ErrCode AnsSubscriberStub::HandleOnCanceledMap(MessageParcel &data, MessageParce if (existMap) { notificationMap = data.ReadParcelable(); if (notificationMap == nullptr) { - ANS_LOGW("[HandleOnCanceledMap] fail: read NotificationSortingMap failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: read NotificationSortingMap failed"); return ERR_ANS_PARCELABLE_FAILED; } } int32_t reason = 0; if (!data.ReadInt32(reason)) { - ANS_LOGW("[HandleOnCanceledMap] fail: read reason failed"); + ANS_LOGE("[HandleOnCanceledMap] fail: read reason failed"); return ERR_ANS_PARCELABLE_FAILED; } @@ -240,7 +240,7 @@ bool AnsSubscriberStub::ReadParcelableVector(std::vector> &parcelableInf { int32_t infoSize = 0; if (!data.ReadInt32(infoSize)) { - ANS_LOGE("read Parcelable size failed."); + ANS_LOGE("read infoSize failed"); return false; } @@ -262,7 +262,7 @@ ErrCode AnsSubscriberStub::HandleOnUpdated(MessageParcel &data, MessageParcel &r { sptr notificationMap = data.ReadParcelable(); if (!notificationMap) { - ANS_LOGW("[HandleOnUpdated] fail: notificationMap ReadParcelable failed"); + ANS_LOGE("[HandleOnUpdated] fail: notificationMap ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } @@ -274,7 +274,7 @@ ErrCode AnsSubscriberStub::HandleOnDoNotDisturbDateChange(MessageParcel &data, M { sptr date = data.ReadParcelable(); if (!date) { - ANS_LOGW("[HandleOnDoNotDisturbDateChange] fail: date ReadParcelable failed"); + ANS_LOGE("[HandleOnDoNotDisturbDateChange] fail: date ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } OnDoNotDisturbDateChange(date); @@ -285,7 +285,7 @@ ErrCode AnsSubscriberStub::HandleOnEnabledNotificationChanged(MessageParcel &dat { sptr callbackData = data.ReadParcelable(); if (!callbackData) { - ANS_LOGW("[HandleOnEnabledNotificationChanged] fail: callbackData ReadParcelable failed"); + ANS_LOGE("[HandleOnEnabledNotificationChanged] fail: callbackData ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } OnEnabledNotificationChanged(callbackData); @@ -296,7 +296,7 @@ ErrCode AnsSubscriberStub::HandleOnBadgeChanged(MessageParcel &data, MessageParc { sptr callbackData = data.ReadParcelable(); if (!callbackData) { - ANS_LOGW("[HandleOnBadgeChanged] fail: callbackData ReadParcelable failed"); + ANS_LOGE("[HandleOnBadgeChanged] fail: callbackData ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } OnBadgeChanged(callbackData); @@ -329,7 +329,7 @@ ErrCode AnsSubscriberStub::HandleOnResponse(MessageParcel &data, MessageParcel & { sptr operationInfo = data.ReadParcelable(); if (!operationInfo) { - ANS_LOGW("notification ReadParcelable failed"); + ANS_LOGE("notification ReadParcelable failed"); return ERR_ANS_PARCELABLE_FAILED; } ErrCode result = OnOperationResponse(operationInfo); diff --git a/frameworks/core/src/manager/ans_manager_death_recipient.cpp b/frameworks/core/src/manager/ans_manager_death_recipient.cpp index 9048f8a58..2eb9bc1d9 100644 --- a/frameworks/core/src/manager/ans_manager_death_recipient.cpp +++ b/frameworks/core/src/manager/ans_manager_death_recipient.cpp @@ -31,13 +31,13 @@ void AnsManagerDeathRecipient::SubscribeSAManager() auto samgrProxy = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); statusChangeListener_ = new (std::nothrow) AnsManagerDeathRecipient::SystemAbilityStatusChangeListener(); if (samgrProxy == nullptr || statusChangeListener_ == nullptr) { - ANS_LOGI("GetSystemAbilityManager failed or new SystemAbilityStatusChangeListener failed"); + ANS_LOGE("GetSystemAbilityManager failed or new SystemAbilityStatusChangeListener failed"); statusChangeListener_ = nullptr; return; } int32_t ret = samgrProxy->SubscribeSystemAbility(ADVANCED_NOTIFICATION_SERVICE_ABILITY_ID, statusChangeListener_); if (ret != ERR_OK) { - ANS_LOGI("SubscribeSystemAbility to sa manager failed"); + ANS_LOGE("SubscribeSystemAbility to sa manager failed"); statusChangeListener_ = nullptr; } } diff --git a/frameworks/core/src/manager/ans_manager_proxy_utils.cpp b/frameworks/core/src/manager/ans_manager_proxy_utils.cpp index a778df23b..97ed7314f 100644 --- a/frameworks/core/src/manager/ans_manager_proxy_utils.cpp +++ b/frameworks/core/src/manager/ans_manager_proxy_utils.cpp @@ -390,7 +390,7 @@ ErrCode AnsManagerProxy::AllowUseReminder(const std::string& bundleName, bool& i } if (!reply.ReadBool(isAllowUseReminder)) { - ANS_LOGE("fail: read enabled failed."); + ANS_LOGE("fail: read isAllowUseReminder failed"); return ERR_ANS_PARCELABLE_FAILED; } diff --git a/frameworks/js/napi/src/cancel.cpp b/frameworks/js/napi/src/cancel.cpp index 62839d710..162f391c1 100644 --- a/frameworks/js/napi/src/cancel.cpp +++ b/frameworks/js/napi/src/cancel.cpp @@ -34,7 +34,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < 1) { - ANS_LOGW("Wrong number of arguments"); + ANS_LOGE("Wrong number of arguments"); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -43,7 +43,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: id: number / representativeBundle: BundleOption NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_number && valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Number object expected."); + ANS_LOGE("Wrong argument type. Number object expected."); std::string msg = "Incorrect parameter types.The type of param must be number or object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -69,7 +69,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, } if (valuetype != napi_number && valuetype != napi_boolean && valuetype != napi_string && valuetype != napi_function) { - ANS_LOGW("Wrong argument type. String or function expected."); + ANS_LOGE("Wrong argument type. String or function expected."); std::string msg = "Incorrect parameter types.The type of param must be string or function."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -93,7 +93,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, } else if (argc >= CANCEL_MAX_PARA - 1 && paras.hasOption) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -105,7 +105,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= CANCEL_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM2], 1, ¶s.callback); @@ -123,7 +123,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < CANCEL_GROUP_MIN_PARA) { - ANS_LOGW("Wrong number of arguments"); + ANS_LOGE("Wrong number of arguments"); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -132,7 +132,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: groupName: string NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. String number boolean expected."); + ANS_LOGE("Wrong argument type. String number boolean expected."); std::string msg = "Incorrect parameter types.The type of param must be number or string or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -156,7 +156,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= CANCEL_GROUP_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶s.callback); @@ -414,7 +414,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc > CANCEL_AS_BUNDLEOPTION_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -425,7 +425,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= CANCEL_AS_BUNDLE_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM3], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM3], 1, ¶s.callback); diff --git a/frameworks/js/napi/src/common.cpp b/frameworks/js/napi/src/common.cpp index 4cc0cbc80..caad63fa5 100644 --- a/frameworks/js/napi/src/common.cpp +++ b/frameworks/js/napi/src/common.cpp @@ -484,7 +484,7 @@ napi_value Common::GetNotificationUserInputByInputKey( ANS_LOGI("NotificationUserInput::inputKey = %{public}s", str); userInput = NotificationUserInput::Create(str); if (!userInput) { - ANS_LOGI("Failed to create NotificationUserInput by inputKey=%{public}s", str); + ANS_LOGE("Failed to create NotificationUserInput by inputKey=%{public}s", str); return nullptr; } @@ -1218,7 +1218,7 @@ __attribute__((no_sanitize("cfi"))) napi_value Common::CreateWantAgentByJS(const const std::shared_ptr &agent) { if (agent == nullptr) { - ANS_LOGI("agent is nullptr"); + ANS_LOGE("agent is nullptr"); return nullptr; } diff --git a/frameworks/js/napi/src/common_convert_content.cpp b/frameworks/js/napi/src/common_convert_content.cpp index de61278d5..fed18c519 100644 --- a/frameworks/js/napi/src/common_convert_content.cpp +++ b/frameworks/js/napi/src/common_convert_content.cpp @@ -65,7 +65,7 @@ napi_value Common::SetNotificationContentDetailed(const napi_env &env, const Con std::shared_ptr basicContent = content->GetNotificationContent(); if (basicContent == nullptr) { - ANS_LOGE("content is null"); + ANS_LOGE("basicContent is null"); return ret; } @@ -1574,7 +1574,7 @@ napi_value Common::SetLockScreenPicture( napi_value pictureValue = Media::PixelMapNapi::CreatePixelMap(env, picture); NAPI_CALL(env, napi_typeof(env, pictureValue, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("LockScreenPicture is undefined"); + ANS_LOGE("LockScreenPicture is undefined"); napi_set_named_property(env, result, "lockscreenPicture", NapiGetNull(env)); } else { napi_set_named_property(env, result, "lockscreenPicture", pictureValue); diff --git a/frameworks/js/napi/src/common_convert_liveview.cpp b/frameworks/js/napi/src/common_convert_liveview.cpp index dd6bb0205..cf591495c 100644 --- a/frameworks/js/napi/src/common_convert_liveview.cpp +++ b/frameworks/js/napi/src/common_convert_liveview.cpp @@ -117,7 +117,7 @@ napi_value Common::SetNotificationLocalLiveViewContent( bool flag = localLiveViewContent->isFlagExist( NotificationLocalLiveViewContent::LiveViewContentInner::INITIAL_TIME); if (!SetTime(env, localLiveViewContent->GetTime(), time, flag)) { - ANS_LOGE("SetMessageUser call failed"); + ANS_LOGE("SetTime call failed"); return NapiGetBoolean(env, false); } napi_set_named_property(env, result, "time", time); @@ -151,7 +151,7 @@ napi_value Common::SetCapsule(const napi_env &env, const NotificationCapsule &ca iconResult = Media::PixelMapNapi::CreatePixelMap(env, icon); NAPI_CALL(env, napi_typeof(env, iconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGW("iconResult is undefined"); + ANS_LOGE("iconResult is undefined"); napi_set_named_property(env, result, "icon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "icon", iconResult); @@ -734,7 +734,7 @@ napi_value Common::GetNotificationIconButton( // icon?: Resource auto resource = std::make_shared(); if (Common::GetResourceObject(env, resource, iconResource) == nullptr) { - ANS_LOGI("Invalid icon resource object or not resource."); + ANS_LOGE("Invalid icon resource object or not resource."); } else { button.SetIconResource(resource); } diff --git a/frameworks/js/napi/src/common_convert_request.cpp b/frameworks/js/napi/src/common_convert_request.cpp index 1b118c77d..bf3bbfdba 100644 --- a/frameworks/js/napi/src/common_convert_request.cpp +++ b/frameworks/js/napi/src/common_convert_request.cpp @@ -247,7 +247,7 @@ napi_value Common::SetNotificationRequestByPixelMap( smallIconResult = Media::PixelMapNapi::CreatePixelMap(env, littleIcon); NAPI_CALL(env, napi_typeof(env, smallIconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("smallIconResult is undefined"); + ANS_LOGE("smallIconResult is undefined"); napi_set_named_property(env, result, "smallIcon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "smallIcon", smallIconResult); @@ -262,7 +262,7 @@ napi_value Common::SetNotificationRequestByPixelMap( largeIconResult = Media::PixelMapNapi::CreatePixelMap(env, largeIcon); NAPI_CALL(env, napi_typeof(env, largeIconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("largeIconResult is undefined"); + ANS_LOGE("largeIconResult is undefined"); napi_set_named_property(env, result, "largeIcon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "largeIcon", largeIconResult); @@ -277,7 +277,7 @@ napi_value Common::SetNotificationRequestByPixelMap( overlayIconResult = Media::PixelMapNapi::CreatePixelMap(env, overlayIcon); NAPI_CALL(env, napi_typeof(env, overlayIconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGI("overlayIconResult is undefined"); + ANS_LOGE("overlayIconResult is undefined"); napi_set_named_property(env, result, "overlayIcon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "overlayIcon", overlayIconResult); @@ -407,7 +407,7 @@ napi_value Common::SetNotificationActionButton( // wantAgent: WantAgent std::shared_ptr agent = actionButton->GetWantAgent(); if (agent == nullptr) { - ANS_LOGI("wantAgent is null"); + ANS_LOGE("wantAgent is null"); napi_set_named_property(env, result, "wantAgent", NapiGetNull(env)); return NapiGetBoolean(env, false); } else { @@ -424,7 +424,7 @@ napi_value Common::SetNotificationActionButton( iconResult = Media::PixelMapNapi::CreatePixelMap(env, icon); NAPI_CALL(env, napi_typeof(env, iconResult, &valuetype)); if (valuetype == napi_undefined) { - ANS_LOGW("icon result is undefined"); + ANS_LOGE("icon result is undefined"); napi_set_named_property(env, result, "icon", NapiGetNull(env)); } else { napi_set_named_property(env, result, "icon", iconResult); @@ -1774,7 +1774,7 @@ napi_value Common::GetNotificationActionButtons( } napi_get_array_length(env, actionButtons, &length); if (length == 0) { - ANS_LOGI("The array is empty."); + ANS_LOGE("The array is empty."); return Common::NapiGetNull(env); } for (size_t i = 0; i < length; i++) { diff --git a/frameworks/js/napi/src/disable_notification.cpp b/frameworks/js/napi/src/disable_notification.cpp index c63d42e2f..fde2792ca 100644 --- a/frameworks/js/napi/src/disable_notification.cpp +++ b/frameworks/js/napi/src/disable_notification.cpp @@ -26,7 +26,7 @@ bool ParseDisabledParameters(const napi_env &env, const napi_value &value, bool napi_valuetype valuetype = napi_undefined; NAPI_CALL_BASE(env, napi_typeof(env, value, &valuetype), false); if (valuetype != napi_boolean) { - ANS_LOGW("wrong argument type. Bool expected"); + ANS_LOGE("wrong argument type. Bool expected"); std::string msg = "Incorrect parameter types.The type of disabled must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return false; diff --git a/frameworks/js/napi/src/display_badge.cpp b/frameworks/js/napi/src/display_badge.cpp index a9bd57375..7b74a609f 100644 --- a/frameworks/js/napi/src/display_badge.cpp +++ b/frameworks/js/napi/src/display_badge.cpp @@ -32,7 +32,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < ENABLE_BADGE_DISPLAYED_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -41,7 +41,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected"); + ANS_LOGE("Wrong argument type. Object expected"); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -57,7 +57,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -68,7 +68,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= ENABLE_BADGE_DISPLAYED_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM2], 1, ¶ms.callback); @@ -87,7 +87,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < IS_DISPLAY_BADGE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -97,7 +97,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if ((valuetype != napi_function) && (valuetype != napi_object)) { - ANS_LOGW("Wrong argument type. Function or object expected, %{public}d", valuetype); + ANS_LOGE("Wrong argument type. Function or object expected, %{public}d", valuetype); std::string msg = "Incorrect parameter types.The type of param must be function or object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -119,7 +119,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= IS_DISPLAY_BADGE_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶ms.callback); diff --git a/frameworks/js/napi/src/distributed.cpp b/frameworks/js/napi/src/distributed.cpp index fd8669054..bec1594eb 100644 --- a/frameworks/js/napi/src/distributed.cpp +++ b/frameworks/js/napi/src/distributed.cpp @@ -39,7 +39,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_STATUS_PARA_NUM) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -48,7 +48,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: deviceType: string NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter deviceType. The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -67,7 +67,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: status: number NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Argument type error. number expected."); + ANS_LOGE("Argument type error. number expected."); std::string msg = "Incorrect parameter status. The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/distributed_operation_callback.cpp b/frameworks/js/napi/src/distributed_operation_callback.cpp index 93dcb1832..aa7de7d2f 100644 --- a/frameworks/js/napi/src/distributed_operation_callback.cpp +++ b/frameworks/js/napi/src/distributed_operation_callback.cpp @@ -32,7 +32,7 @@ void DistributedOperationCallback::OnOperationCallback(const int32_t operationRe { OperationOnCallBack *operationOnCallBack = new (std::nothrow) OperationOnCallBack(); if (operationOnCallBack == nullptr) { - ANS_LOGW("new operationOnCallBack failed"); + ANS_LOGE("new operationOnCallBack failed"); return; } @@ -45,19 +45,19 @@ void DistributedOperationCallback::OnOperationCallback(const int32_t operationRe operationOnCallBack->deferred = asyncCallbackInfo_.deferred; bool bRet = UvQueue::Call(asyncCallbackInfo_.env, operationOnCallBack, UvWorkOnCallBack); if (!bRet) { - ANS_LOGW("DistributedOperationCallback::OnCallBack failed"); + ANS_LOGE("DistributedOperationCallback::OnCallBack failed"); } } void DistributedOperationCallback::UvWorkOnCallBack(uv_work_t *work, int32_t status) { if (work == nullptr) { - ANS_LOGW("UvWorkOnCallBack, work is null"); + ANS_LOGE("UvWorkOnCallBack, work is null"); return; } OperationOnCallBack *callBackPtr = static_cast(work->data); if (callBackPtr == nullptr) { - ANS_LOGW("UvWorkOnCallBack, callBackPtr is null"); + ANS_LOGE("UvWorkOnCallBack, callBackPtr is null"); if (work != nullptr) { delete work; work = nullptr; diff --git a/frameworks/js/napi/src/disturb_mode.cpp b/frameworks/js/napi/src/disturb_mode.cpp index 2274d4c29..fb27497ae 100644 --- a/frameworks/js/napi/src/disturb_mode.cpp +++ b/frameworks/js/napi/src/disturb_mode.cpp @@ -34,14 +34,14 @@ napi_value GetDoNotDisturbDate(const napi_env &env, const napi_value &argv, SetD // argv[0]: date:type NAPI_CALL(env, napi_has_named_property(env, argv, "type", &hasProperty)); if (!hasProperty) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } napi_get_named_property(env, argv, "type", &value); NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -59,7 +59,7 @@ napi_value GetDoNotDisturbDate(const napi_env &env, const napi_value &argv, SetD // argv[0]: date:begin NAPI_CALL(env, napi_has_named_property(env, argv, "begin", &hasProperty)); if (!hasProperty) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -79,7 +79,7 @@ napi_value GetDoNotDisturbDate(const napi_env &env, const napi_value &argv, SetD // argv[0]: date:end NAPI_CALL(env, napi_has_named_property(env, argv, "end", &hasProperty)); if (!hasProperty) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -190,7 +190,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_DISTURB_MIN_PARA) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -199,7 +199,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Property type expected."); + ANS_LOGE("Wrong argument type. Property type expected."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -212,7 +212,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= SET_DISTURB_MAX_PARA - 1) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if ((valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Wrong argument type. Function or object expected. Excute promise."); + ANS_LOGE("Wrong argument type. Function or object expected. Excute promise."); return Common::NapiGetNull(env); } diff --git a/frameworks/js/napi/src/enable_notification.cpp b/frameworks/js/napi/src/enable_notification.cpp index 5f5d9bc95..d4fa19cd4 100644 --- a/frameworks/js/napi/src/enable_notification.cpp +++ b/frameworks/js/napi/src/enable_notification.cpp @@ -38,7 +38,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < ENABLE_NOTIFICATION_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -47,7 +47,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Parameter type error. Object expected."); + ANS_LOGE("Parameter type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -62,7 +62,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -73,7 +73,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= ENABLE_NOTIFICATION_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM2], 1, ¶ms.callback); @@ -99,7 +99,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if ((valuetype != napi_object) && (valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Parameter type error. Function or object expected. Excute promise."); + ANS_LOGE("Parameter type error. Function or object expected. Excute promise."); return Common::NapiGetNull(env); } if (valuetype == napi_object) { @@ -121,7 +121,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= IS_NOTIFICATION_ENABLE_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶ms.callback); diff --git a/frameworks/js/napi/src/manager/napi_disable_notification.cpp b/frameworks/js/napi/src/manager/napi_disable_notification.cpp index eb80040ac..d6588d7bf 100644 --- a/frameworks/js/napi/src/manager/napi_disable_notification.cpp +++ b/frameworks/js/napi/src/manager/napi_disable_notification.cpp @@ -23,7 +23,7 @@ namespace NotificationNapi { napi_value NapiDisableNotificationFeature(napi_env env, napi_callback_info info) { #ifdef DISABLE_NOTIFICATION_FEATURE_ENABLE - ANS_LOGD("enter NapiDisableNotificationFeature"); + ANS_LOGD("enter"); NotificationDisable paras; if (!ParseDisableNotificationParameters(env, info, paras)) { Common::NapiThrow(env, ERROR_PARAM_INVALID); @@ -45,7 +45,7 @@ napi_value NapiDisableNotificationFeature(napi_env env, napi_callback_info info) // Asynchronous function call napi_create_async_work(env, nullptr, resourceName, [](napi_env env, void *data) { - ANS_LOGD("Napi disable notification Feature work excute."); + ANS_LOGD("NapiDisableNotificationFeature work excute"); AsyncCallbackInfoDisableNotification *asynccallbackinfo = static_cast(data); if (asynccallbackinfo) { @@ -54,15 +54,17 @@ napi_value NapiDisableNotificationFeature(napi_env env, napi_callback_info info) } }, [](napi_env env, napi_status status, void *data) { - ANS_LOGD("Napi disable notification Feature work complete."); + ANS_LOGD("NapiDisableNotificationFeature work complete"); AsyncCallbackInfoDisableNotification *asynccallbackinfo = static_cast(data); if (asynccallbackinfo) { Common::CreateReturnValue(env, asynccallbackinfo->info, Common::NapiGetNull(env)); + ANS_LOGD("Delete NapiDisableNotificationFeature asyncWork"); napi_delete_async_work(env, asynccallbackinfo->asyncWork); delete asynccallbackinfo; asynccallbackinfo = nullptr; } + ANS_LOGD("NapiDisableNotificationFeature work complete end"); }, (void *)asynccallbackinfo, &asynccallbackinfo->asyncWork); diff --git a/frameworks/js/napi/src/manager/napi_distributed_enable.cpp b/frameworks/js/napi/src/manager/napi_distributed_enable.cpp index 3965a2dfd..782b15e69 100644 --- a/frameworks/js/napi/src/manager/napi_distributed_enable.cpp +++ b/frameworks/js/napi/src/manager/napi_distributed_enable.cpp @@ -38,7 +38,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_DISTRIBUTED_ENABLE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -47,7 +47,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Parameter type error. Object expected."); + ANS_LOGE("Parameter type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -62,7 +62,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: deviceType NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -81,7 +81,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[2]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -184,7 +184,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SET_SMART_REMINDER_ENABLE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -193,7 +193,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: deviceType NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. String expected."); + ANS_LOGE("Wrong argument type. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -212,7 +212,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: enable NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -344,7 +344,7 @@ napi_value ParseParameters(const napi_env &env, NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if ((setOperation && argc != SET_DISTRIBUTED_ENABLE_BY_SLOT_PARA) || (!setOperation && argc != GET_DISTRIBUTED_ENABLE_BY_SLOT_PARA)) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -353,7 +353,7 @@ napi_value ParseParameters(const napi_env &env, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Parameter type error. Object expected."); + ANS_LOGE("Parameter type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -371,7 +371,7 @@ napi_value ParseParameters(const napi_env &env, // argv[1]: deviceType NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -395,7 +395,7 @@ napi_value ParseParameters(const napi_env &env, if (setOperation) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. Bool expected."); + ANS_LOGE("Wrong argument type. Bool expected."); std::string msg = "Incorrect parameter types.The type of param must be boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/manager/napi_enable_notification.cpp b/frameworks/js/napi/src/manager/napi_enable_notification.cpp index 0ed78bcc4..c59f7278e 100644 --- a/frameworks/js/napi/src/manager/napi_enable_notification.cpp +++ b/frameworks/js/napi/src/manager/napi_enable_notification.cpp @@ -153,14 +153,14 @@ __attribute__((no_sanitize("cfi"))) napi_value NapiIsNotificationEnabled(napi_en asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotify( asynccallbackinfo->params.option, asynccallbackinfo->allowed); } else if (asynccallbackinfo->params.hasUserId) { - ANS_LOGI("userId : %{public}d", asynccallbackinfo->params.userId); + ANS_LOGI("userId:%{public}d", asynccallbackinfo->params.userId); asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotify( asynccallbackinfo->params.userId, asynccallbackinfo->allowed); } else { asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotifySelf( asynccallbackinfo->allowed); } - ANS_LOGI("asynccallbackinfo->info.errorCode : %{public}d, allowed : %{public}d", + ANS_LOGI("asynccallbackinfo->info.errorCode:%{public}d, allowed:%{public}d", asynccallbackinfo->info.errorCode, asynccallbackinfo->allowed); } }, @@ -213,7 +213,7 @@ napi_value NapiIsNotificationEnabledSelf(napi_env env, napi_callback_info info) asynccallbackinfo->info.errorCode = NotificationHelper::IsAllowedNotifySelf(asynccallbackinfo->allowed); } - ANS_LOGD("asynccallbackinfo->info.errorCode = %{public}d, allowed = %{public}d", + ANS_LOGD("asynccallbackinfo->info.errorCode:%{public}d, allowed:%{public}d", asynccallbackinfo->info.errorCode, asynccallbackinfo->allowed); } }, @@ -291,7 +291,7 @@ napi_value NapiRequestEnableNotification(napi_env env, napi_callback_info info) bool canPop = false; std::string bundleName {""}; ErrCode errCode = NotificationHelper::CanPopEnableNotificationDialog(client, canPop, bundleName); - ANS_LOGI("CanPopEnableNotificationDialog result , errCode = %{public}d , canPop = %{public}d", + ANS_LOGI("CanPopEnableNotificationDialog result, errCode:%{public}d, canPop:%{public}d", errCode, canPop); if (canPop == false) { asynccallbackinfo->info.errorCode = errCode; diff --git a/frameworks/js/napi/src/manager/napi_get_active.cpp b/frameworks/js/napi/src/manager/napi_get_active.cpp index 038451ee5..02ac507e6 100644 --- a/frameworks/js/napi/src/manager/napi_get_active.cpp +++ b/frameworks/js/napi/src/manager/napi_get_active.cpp @@ -299,7 +299,7 @@ napi_value ParseGetLiveViewFilter(const napi_env &env, const napi_value &obj, Li // bundle napi_value result = AppExecFwk::GetPropertyValueByPropertyName(env, obj, "bundle", napi_object); if (result == nullptr) { - ANS_LOGW("Failed to get bundle from params."); + ANS_LOGE("Failed to get bundle from params."); return nullptr; } auto retValue = Common::GetBundleOption(env, result, filter.bundle); @@ -311,7 +311,7 @@ napi_value ParseGetLiveViewFilter(const napi_env &env, const napi_value &obj, Li // notificationKey result = AppExecFwk::GetPropertyValueByPropertyName(env, obj, "notificationKey", napi_object); if (result == nullptr) { - ANS_LOGW("Failed to get notificationKeys from params."); + ANS_LOGE("Failed to get notificationKeys from params."); return nullptr; } retValue = Common::GetNotificationKey(env, result, filter.notificationKey); @@ -322,7 +322,7 @@ napi_value ParseGetLiveViewFilter(const napi_env &env, const napi_value &obj, Li // extraInfoKeys if (AppExecFwk::IsExistsByPropertyName(env, obj, "extraInfoKeys") == false) { - ANS_LOGI("No extraInfoKeys in filter"); + ANS_LOGW("No extraInfoKeys in filter"); return Common::NapiGetNull(env); } diff --git a/frameworks/js/napi/src/manager/napi_push_callback.cpp b/frameworks/js/napi/src/manager/napi_push_callback.cpp index 066c6796a..e93a6bbeb 100644 --- a/frameworks/js/napi/src/manager/napi_push_callback.cpp +++ b/frameworks/js/napi/src/manager/napi_push_callback.cpp @@ -283,7 +283,7 @@ int32_t JSPushCallBack::ConvertFunctionResult(napi_env env, napi_value funcResul return false; } - ANS_LOGI("code : %{public}d ,message : %{public}s", code, message.c_str()); + ANS_LOGI("code:%{public}d, message:%{public}s", code, message.c_str()); return code; } } // namespace Notification diff --git a/frameworks/js/napi/src/manager/napi_remove_group.cpp b/frameworks/js/napi/src/manager/napi_remove_group.cpp index cf504b265..7bac7aa36 100644 --- a/frameworks/js/napi/src/manager/napi_remove_group.cpp +++ b/frameworks/js/napi/src/manager/napi_remove_group.cpp @@ -35,7 +35,7 @@ napi_value ParseParameters( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < REMOVE_GROUP_BY_BUNDLE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -43,7 +43,7 @@ napi_value ParseParameters( // argv[0]: bundle NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Argument type error. Object expected."); + ANS_LOGE("Argument type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -58,7 +58,7 @@ napi_value ParseParameters( // argv[1]: groupName: string NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean) { - ANS_LOGW("Wrong argument type. String number boolean expected."); + ANS_LOGE("Wrong argument type. String number boolean expected."); std::string msg = "Incorrect parameter types.The type of param must be string or number or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -138,7 +138,7 @@ napi_value NapiRemoveGroupByBundle(napi_env env, napi_callback_info info) AsyncCallbackInfoRemoveGroupByBundle *asynccallbackinfo = static_cast(data); if (asynccallbackinfo) { - ANS_LOGI("option.bundle : %{public}s, option.uid : %{public}d, groupName : %{public}s", + ANS_LOGI("option.bundle:%{public}s, option.uid:%{public}d, groupName:%{public}s", asynccallbackinfo->params.option.GetBundleName().c_str(), asynccallbackinfo->params.option.GetUid(), asynccallbackinfo->params.groupName.c_str()); diff --git a/frameworks/js/napi/src/manager/napi_sync_config.cpp b/frameworks/js/napi/src/manager/napi_sync_config.cpp index c90484908..b023048fe 100644 --- a/frameworks/js/napi/src/manager/napi_sync_config.cpp +++ b/frameworks/js/napi/src/manager/napi_sync_config.cpp @@ -50,7 +50,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < SETADDITION_CONFIG_NUM) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -59,7 +59,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0]: key: string NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -71,7 +71,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (std::strlen(keyStr) == 0 || (strcmp(keyStr, KEY_NAME) != 0 && strcmp(keyStr, RING_LIST_KEY_NAME) != 0 && strcmp(keyStr, CTRL_LIST_KEY_NAME) != 0)) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -80,7 +80,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: value: string NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Argument type error. String expected."); + ANS_LOGE("Argument type error. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/publish.cpp b/frameworks/js/napi/src/publish.cpp index 7ccf804d0..398713471 100644 --- a/frameworks/js/napi/src/publish.cpp +++ b/frameworks/js/napi/src/publish.cpp @@ -38,7 +38,7 @@ napi_value GetCallback(const napi_env &env, const napi_value &value, ParametersI napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, value, 1, ¶ms.callback); @@ -54,7 +54,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value argv[PUBLISH_NOTIFICATION_MAX] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); if (argc < 1) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -62,7 +62,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Argument type error. Object expected."); + ANS_LOGE("Argument type error. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -77,7 +77,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, if (argc >= PUBLISH_NOTIFICATION_MAX - 1) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if ((valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Wrong argument type. Function or object expected. Execute promise"); + ANS_LOGE("Wrong argument type. Function or object expected. Execute promise"); return Common::NapiGetNull(env); } @@ -198,7 +198,7 @@ napi_value GetStringProperty( napi_get_named_property(env, content, property.data(), &value); NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_string) { - ANS_LOGW("Wrong argument type. String expected."); + ANS_LOGE("Wrong argument type. String expected."); std::string msg = "Incorrect parameter types.The type of param must be string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -222,7 +222,7 @@ napi_value GetObjectProperty( napi_get_named_property(env, content, property.data(), &result); NAPI_CALL(env, napi_typeof(env, result, &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected."); + ANS_LOGE("Wrong argument type. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -238,7 +238,7 @@ napi_value ParseShowOptions(const napi_env &env, const napi_callback_info &info, napi_value argv[SHOW_NOTIFICATION_MAX] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); if (argc == 0) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); return nullptr; } @@ -246,7 +246,7 @@ napi_value ParseShowOptions(const napi_env &env, const napi_callback_info &info, napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected."); + ANS_LOGE("Wrong argument type. Object expected."); return nullptr; } @@ -312,13 +312,13 @@ napi_value ShowNotification(napi_env env, napi_callback_info info) ParametersInfoPublish params; if (ParseShowOptions(env, info, params) == nullptr) { - ANS_LOGW("parse showOptions failed"); + ANS_LOGE("parse showOptions failed"); return Common::NapiGetUndefined(env); } auto asynccallbackinfo = new (std::nothrow) AsyncCallbackInfoPublish {.env = env, .asyncWork = nullptr}; if (!asynccallbackinfo) { - ANS_LOGW("failed to create asynccallbackinfo"); + ANS_LOGE("failed to create asynccallbackinfo"); return Common::JSParaError(env, params.callback); } @@ -382,7 +382,7 @@ napi_value ParsePublishAsBundleParameters( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Wrong argument type. Object expected."); + ANS_LOGE("Wrong argument type. Object expected."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -408,7 +408,7 @@ napi_value ParsePublishAsBundleParameters( // argv[1] : bundleName / NotificationRequest NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean && valuetype != napi_object) { - ANS_LOGW("Error argument type. String number boolean object expected."); + ANS_LOGE("Error argument type. String number boolean object expected."); std::string msg = "Incorrect parameter types.The type of param must be string or number or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -438,7 +438,7 @@ napi_value ParsePublishAsBundleParameters( if (argc > PUBLISH_AS_BUNDLEOPTION_MAX) { NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); if (valuetype != napi_number) { - ANS_LOGW("Wrong argument type. Number expected."); + ANS_LOGE("Wrong argument type. Number expected."); std::string msg = "Incorrect parameter types.The type of param must be number."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/js/napi/src/reminder/publish.cpp b/frameworks/js/napi/src/reminder/publish.cpp index 3ce96921d..124ec328f 100644 --- a/frameworks/js/napi/src/reminder/publish.cpp +++ b/frameworks/js/napi/src/reminder/publish.cpp @@ -77,7 +77,7 @@ napi_value GetCallback(const napi_env &env, const napi_value &value, AsyncCallba napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_function) { - ANSR_LOGW("Wrong argument type. Function expected."); + ANSR_LOGE("Wrong argument type. Function expected."); return nullptr; } napi_create_reference(env, value, 1, &asyncCallbackInfo.callback); @@ -97,7 +97,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, napi_value argv[PUBLISH_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < 1) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -107,7 +107,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[1]: callback if (argc >= PUBLISH_PARAM_LEN) { if (GetCallback(env, argv[1], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("[reminderAgent]GetCallbak returns nullptr"); + ANSR_LOGE("[reminderAgent]GetCallbak returns nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -117,7 +117,7 @@ napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, // argv[0] : reminderRequest if (ReminderCommon::GetReminderRequest(env, argv[0], params.reminder) == nullptr) { - ANSR_LOGW("[reminderAgent]CreateReminder returns nullptr"); + ANSR_LOGE("[reminderAgent]CreateReminder returns nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -134,7 +134,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in napi_value argv[ADD_SLOT_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < 1) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -144,7 +144,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in // argv[1]: callback if (argc >= ADD_SLOT_PARAM_LEN) { if (GetCallback(env, argv[1], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("GetCallbak returns nullptr"); + ANSR_LOGE("GetCallbak returns nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -159,7 +159,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in int32_t propertyVal = 0; if (!ReminderCommon::GetInt32(env, argv[0], propertyKey, propertyVal, false) && !ReminderCommon::GetInt32(env, argv[0], propertyNewKey, propertyVal, false)) { - ANSR_LOGW("Failed to get valid slot type."); + ANSR_LOGE("Failed to get valid slot type."); params.errCode = ERR_REMINDER_INVALID_PARAM; if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); @@ -168,7 +168,7 @@ napi_value ParseSlotParameters(const napi_env &env, const napi_callback_info &in } if (!NotificationNapi::AnsEnumUtil::SlotTypeJSToC(NotificationNapi::SlotType(propertyVal), params.inType)) { - ANSR_LOGW("Failed to get valid slot type"); + ANSR_LOGE("Failed to get valid slot type"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -185,7 +185,7 @@ napi_value ParseCanCelParameter(const napi_env &env, const napi_callback_info &i napi_value argv[CANCEL_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < 1) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -195,7 +195,7 @@ napi_value ParseCanCelParameter(const napi_env &env, const napi_callback_info &i // argv[1]: callback if (argc >= CANCEL_PARAM_LEN) { if (GetCallback(env, argv[1], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("GetCallbak is nullptr"); + ANSR_LOGE("GetCallbak is nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -212,7 +212,7 @@ napi_value ParseCanCelParameter(const napi_env &env, const napi_callback_info &i return nullptr; } if (reminderId < 0) { - ANSR_LOGW("Param id of cancels Reminder is illegal."); + ANSR_LOGE("Param id of cancels Reminder is illegal."); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -234,7 +234,7 @@ napi_value ParseCanCelAllParameter(const napi_env &env, const napi_callback_info // argv[0]: callback if (argc >= CANCEL_ALL_PARAM_LEN) { if (GetCallback(env, argv[0], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("getCallbak is nullptr"); + ANSR_LOGE("getCallbak is nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -254,7 +254,7 @@ napi_value ParseGetValidParameter(const napi_env &env, const napi_callback_info // argv[0]: callback if (argc >= GET_VALID_PARAM_LEN) { if (GetCallback(env, argv[0], asyncCallbackInfo) == nullptr) { - ANSR_LOGW("getCallbak is nullptr"); + ANSR_LOGE("getCallbak is nullptr"); if (isThrow) { ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); } @@ -1154,7 +1154,7 @@ napi_value ParseAddExcludeDateParameter(const napi_env &env, const napi_callback napi_value argv[ADD_EXCLUDE_DATE_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < ADD_EXCLUDE_DATE_PARAM_LEN) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1162,12 +1162,12 @@ napi_value ParseAddExcludeDateParameter(const napi_env &env, const napi_callback // argv[0]: reminder id int32_t reminderId = -1; if (!ReminderCommon::GetInt32(env, argv[0], nullptr, reminderId, true)) { - ANSR_LOGW("Parse reminder id failed."); + ANSR_LOGE("Parse reminder id failed."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } if (reminderId < 0) { - ANSR_LOGW("Param reminder id is illegal."); + ANSR_LOGE("Param reminder id is illegal."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1176,12 +1176,12 @@ napi_value ParseAddExcludeDateParameter(const napi_env &env, const napi_callback // argv[1]: exclude date double date = 0.0; if (!ReminderCommon::GetDate(env, argv[1], nullptr, date)) { - ANSR_LOGW("Parse exclude date failed."); + ANSR_LOGE("Parse exclude date failed."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } if (date < 0.0) { - ANSR_LOGW("Param exclude date is illegal."); + ANSR_LOGE("Param exclude date is illegal."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1255,7 +1255,7 @@ napi_value ParseReminderIdParameter(const napi_env &env, const napi_callback_inf napi_value argv[DEL_EXCLUDE_DATE_PARAM_LEN] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); if (argc < DEL_EXCLUDE_DATE_PARAM_LEN) { - ANSR_LOGW("Wrong number of arguments"); + ANSR_LOGE("Wrong number of arguments"); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } @@ -1263,12 +1263,12 @@ napi_value ParseReminderIdParameter(const napi_env &env, const napi_callback_inf // argv[0]: reminder id int32_t reminderId = -1; if (!ReminderCommon::GetInt32(env, argv[0], nullptr, reminderId, true)) { - ANSR_LOGW("Parse reminder id failed."); + ANSR_LOGE("Parse reminder id failed."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } if (reminderId < 0) { - ANSR_LOGW("Param reminder id is illegal."); + ANSR_LOGE("Param reminder id is illegal."); ReminderCommon::HandleErrCode(env, ERR_REMINDER_INVALID_PARAM); return nullptr; } diff --git a/frameworks/js/napi/src/reminder/reminder_common.cpp b/frameworks/js/napi/src/reminder/reminder_common.cpp index ce7037672..682f623ee 100644 --- a/frameworks/js/napi/src/reminder/reminder_common.cpp +++ b/frameworks/js/napi/src/reminder/reminder_common.cpp @@ -36,7 +36,7 @@ napi_value ReminderCommon::GetReminderRequest( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, value, &valuetype)); if (valuetype != napi_object) { - ANSR_LOGW("Wrong argument type. Object expected."); + ANSR_LOGE("Wrong argument type. Object expected."); return nullptr; } @@ -59,7 +59,7 @@ bool ReminderCommon::GenActionButtons( bool isArray = false; napi_is_array(env, actionButtons, &isArray); if (!isArray) { - ANSR_LOGW("Wrong argument type:%{public}s. array expected.", ACTION_BUTTON); + ANSR_LOGE("Wrong argument type:%{public}s. array expected.", ACTION_BUTTON); return false; } @@ -70,7 +70,7 @@ bool ReminderCommon::GenActionButtons( napi_get_element(env, actionButtons, i, &actionButton); NAPI_CALL_BASE(env, napi_typeof(env, actionButton, &valuetype), false); if (valuetype != napi_object) { - ANSR_LOGW("Wrong element type:%{public}s. object expected.", ACTION_BUTTON); + ANSR_LOGE("Wrong element type:%{public}s. object expected.", ACTION_BUTTON); return false; } @@ -82,12 +82,12 @@ bool ReminderCommon::GenActionButtons( ReminderRequest::ActionButtonType(buttonType) == ReminderRequest::ActionButtonType::SNOOZE || (ReminderRequest::ActionButtonType(buttonType) == ReminderRequest::ActionButtonType::CUSTOM && isSysApp))) { - ANSR_LOGW("Wrong argument type:%{public}s. buttonType not support.", ACTION_BUTTON); + ANSR_LOGE("Wrong argument type:%{public}s. buttonType not support.", ACTION_BUTTON); return false; } HandleActionButtonTitle(env, actionButton, reminder, str, buttonType); } else { - ANSR_LOGW("Parse action button error."); + ANSR_LOGE("Parse action button error."); return false; } } @@ -124,7 +124,7 @@ bool ReminderCommon::IsSelfSystemApp() { auto selfToken = IPCSkeleton::GetSelfTokenID(); if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(selfToken)) { - ANSR_LOGW("This application is not system-app, can not use system-api"); + ANSR_LOGE("This application is not system-app, can not use system-api"); return false; } return true; @@ -193,7 +193,7 @@ bool ReminderCommon::GetValueBucketObject(std::string &valueBucketString, const uint32_t arrlen = 0; napi_status status = napi_get_array_length(env, keys, &arrlen); if (status != napi_ok) { - ANSR_LOGW("get the valuesBucket length err"); + ANSR_LOGE("get the valuesBucket length err"); return false; } for (size_t i = 0; i < arrlen; ++i) { @@ -206,7 +206,7 @@ bool ReminderCommon::GetValueBucketObject(std::string &valueBucketString, const } std::string keyStr = GetStringFromJS(env, key); if (!ValidateString(keyStr)) { - ANSR_LOGW("The key contains separator"); + ANSR_LOGE("The key contains separator"); return false; } // value @@ -220,7 +220,7 @@ bool ReminderCommon::GetValueBucketObject(std::string &valueBucketString, const continue; } if (!ValidateString(valueObject)) { - ANSR_LOGW("The value contains separator"); + ANSR_LOGE("The value contains separator"); return false; } valueBucketString += keyStr + ReminderRequest::SEP_BUTTON_VALUE + type @@ -439,11 +439,11 @@ bool ReminderCommon::CreateReminder( CreateReminderCalendar(env, value, isSysApp, reminder); break; default: - ANSR_LOGW("Reminder type is not support. (type:%{public}d)", reminderType); + ANSR_LOGE("Reminder type is not support. (type:%{public}d)", reminderType); break; } if (reminder == nullptr) { - ANSR_LOGW("Instance of reminder error."); + ANSR_LOGE("Instance of reminder error."); return false; } return true; @@ -456,7 +456,7 @@ napi_value ReminderCommon::GenReminder( bool hasProperty = false; NAPI_CALL(env, napi_has_named_property(env, value, ReminderAgentNapi::REMINDER_TYPE, &hasProperty)); if (!hasProperty) { - ANSR_LOGW("Property %{public}s expected.", ReminderAgentNapi::REMINDER_TYPE); + ANSR_LOGE("Property %{public}s expected.", ReminderAgentNapi::REMINDER_TYPE); return nullptr; } @@ -584,7 +584,7 @@ bool ReminderCommon::GenReminderIntInner( if (GetInt32(env, value, ReminderAgentNapi::SLOT_TYPE, slotType, false)) { enum NotificationConstant::SlotType actureType = NotificationConstant::SlotType::OTHER; if (!NotificationNapi::AnsEnumUtil::SlotTypeJSToC(NotificationNapi::SlotType(slotType), actureType)) { - ANSR_LOGW("slot type not support."); + ANSR_LOGE("slot type not support."); return false; } reminder->SetSlotType(actureType); @@ -651,7 +651,7 @@ bool ReminderCommon::GetStringUtf8(const napi_env &env, const napi_value &value, napi_get_named_property(env, value, propertyName, &result); NAPI_CALL_BASE(env, napi_typeof(env, result, &valuetype), false); if (valuetype != napi_string) { - ANSR_LOGW("Wrong argument type:%{public}s. string expected.", propertyName); + ANSR_LOGE("Wrong argument type:%{public}s. string expected.", propertyName); return false; } NAPI_CALL_BASE(env, napi_get_value_string_utf8(env, result, propertyVal, size - 1, &strLen), false); @@ -667,13 +667,13 @@ bool ReminderCommon::GetBool(const napi_env &env, const napi_value &value, napi_valuetype valuetype = napi_undefined; NAPI_CALL_BASE(env, napi_has_named_property(env, value, propertyName, &hasProperty), false); if (!hasProperty) { - ANSR_LOGW("Does not have argument type:%{public}s.", propertyName); + ANSR_LOGE("Does not have argument type:%{public}s.", propertyName); return false; } napi_get_named_property(env, value, propertyName, &result); NAPI_CALL_BASE(env, napi_typeof(env, result, &valuetype), false); if (valuetype != napi_boolean) { - ANSR_LOGW("Wrong argument type:%{public}s. boolean expected.", propertyName); + ANSR_LOGE("Wrong argument type:%{public}s. boolean expected.", propertyName); return false; } napi_get_value_bool(env, result, &propertyVal); @@ -744,7 +744,7 @@ bool ReminderCommon::GetObject(const napi_env &env, const napi_value &value, napi_get_named_property(env, value, propertyName, &propertyVal); NAPI_CALL_BASE(env, napi_typeof(env, propertyVal, &valuetype), false); if (valuetype != napi_object) { - ANSR_LOGW("Wrong argument type:%{public}s. object expected.", propertyName); + ANSR_LOGE("Wrong argument type:%{public}s. object expected.", propertyName); return false; } return true; @@ -786,7 +786,7 @@ napi_value ReminderCommon::CreateReminderTimer( auto countDownTimeInSeconds = static_cast(propertyCountDownTime); if (propertyCountDownTime <= 0 || countDownTimeInSeconds >= (UINT64_MAX / ReminderRequest::MILLI_SECONDS)) { - ANSR_LOGW("Create countDown reminder fail: designated %{public}s is illegal.", + ANSR_LOGE("Create countDown reminder fail: designated %{public}s is illegal.", ReminderAgentNapi::TIMER_COUNT_DOWN_TIME); return nullptr; } @@ -813,13 +813,13 @@ napi_value ReminderCommon::CreateReminderAlarm( } if ((propertyHourVal < 0) || (propertyHourVal > maxHour)) { - ANSR_LOGW("Create alarm reminder fail: designated %{public}s must between [0, 23].", + ANSR_LOGE("Create alarm reminder fail: designated %{public}s must between [0, 23].", ReminderAgentNapi::ALARM_HOUR); return nullptr; } if ((propertyMinuteVal < 0) || (propertyMinuteVal > maxMinute)) { - ANSR_LOGW("Create alarm reminder fail: designated %{public}s must between [0, 59].", + ANSR_LOGE("Create alarm reminder fail: designated %{public}s must between [0, 59].", ReminderAgentNapi::ALARM_MINUTE); return nullptr; } @@ -841,12 +841,12 @@ napi_value ReminderCommon::CreateReminderCalendar( struct tm dateTime; napi_value dateTimeObj = nullptr; if (!GetObject(env, value, ReminderAgentNapi::CALENDAR_DATE_TIME, dateTimeObj)) { - ANSR_LOGW("Create calendar reminder fail: dateTime must be setted."); + ANSR_LOGE("Create calendar reminder fail: dateTime must be setted."); return nullptr; } if (!ParseLocalDateTime(env, dateTimeObj, dateTime)) { - ANSR_LOGW("Parce DateTime failed."); + ANSR_LOGE("Parce DateTime failed."); return nullptr; } @@ -880,7 +880,7 @@ napi_value ReminderCommon::CreateReminderCalendar( return nullptr; } if (!reminderCalendar->SetEndDateTime(ReminderRequest::GetDurationSinceEpochInMilli(endTime))) { - ANSR_LOGW("The end time must be greater than start time"); + ANSR_LOGE("The end time must be greater than start time"); return nullptr; } } @@ -897,30 +897,30 @@ bool ReminderCommon::CheckCalendarParams(const int32_t &year, const int32_t &mon const int32_t &hour, const int32_t &min) { if ((year < 0) || (year > UINT16_MAX)) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [0, %{public}d]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [0, %{public}d]", ReminderAgentNapi::CALENDAR_YEAR, UINT16_MAX); return false; } if ((month < 1) || (month > ReminderRequestCalendar::MAX_MONTHS_OF_YEAR)) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", ReminderAgentNapi::CALENDAR_MONTH, ReminderRequestCalendar::MAX_MONTHS_OF_YEAR); return false; } uint8_t maxDaysOfMonth = ReminderRequestCalendar::GetDaysOfMonth(static_cast(year), month); if ((day < 1) || (day > maxDaysOfMonth)) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [1, %{public}hhu]", ReminderAgentNapi::CALENDAR_DAY, maxDaysOfMonth); return false; } uint8_t maxHour = 23; if (hour < 0 || hour > maxHour) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", ReminderAgentNapi::CALENDAR_HOUR, maxHour); return false; } uint8_t maxMinute = 59; if (min < 0 || min > maxMinute) { - ANSR_LOGW("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", + ANSR_LOGE("Create calendar reminder fail: designated %{public}s must between [0, %{public}hhu]", ReminderAgentNapi::CALENDAR_MINUTE, maxMinute); return false; } @@ -992,13 +992,13 @@ napi_value ReminderCommon::ParseInt32Array(const napi_env &env, const napi_value bool isArray = false; napi_is_array(env, result, &isArray); if (!isArray) { - ANSR_LOGW("Property %{public}s is expected to be an array.", propertyName); + ANSR_LOGE("Property %{public}s is expected to be an array.", propertyName); return nullptr; } uint32_t length = 0; napi_get_array_length(env, result, &length); if (length > maxLen) { - ANSR_LOGW("The max length of array of %{public}s is %{public}hhu.", propertyName, maxLen); + ANSR_LOGE("The max length of array of %{public}s is %{public}hhu.", propertyName, maxLen); return nullptr; } napi_valuetype valuetype = napi_undefined; @@ -1008,12 +1008,12 @@ napi_value ReminderCommon::ParseInt32Array(const napi_env &env, const napi_value napi_get_element(env, result, i, &repeatDayVal); NAPI_CALL(env, napi_typeof(env, repeatDayVal, &valuetype)); if (valuetype != napi_number) { - ANSR_LOGW("%{public}s's element is expected to be number.", propertyName); + ANSR_LOGE("%{public}s's element is expected to be number.", propertyName); return nullptr; } napi_get_value_int32(env, repeatDayVal, &propertyDayVal); if (propertyDayVal < 1 || propertyDayVal > static_cast(maxLen)) { - ANSR_LOGW("%{public}s's element must between [1, %{public}d].", propertyName, maxLen); + ANSR_LOGE("%{public}s's element must between [1, %{public}d].", propertyName, maxLen); return nullptr; } propertyVal.push_back(static_cast(propertyDayVal)); diff --git a/frameworks/js/napi/src/remove.cpp b/frameworks/js/napi/src/remove.cpp index dccf0cee8..b6942edbf 100644 --- a/frameworks/js/napi/src/remove.cpp +++ b/frameworks/js/napi/src/remove.cpp @@ -35,13 +35,13 @@ bool ParseRemoveReason(const napi_env &env, const napi_value &value, RemoveParam napi_valuetype valueType = napi_undefined; NAPI_CALL_BASE(env, napi_typeof(env, value, &valueType), false); if (valueType != napi_number) { - ANS_LOGW("RemoveReason valueType unexpected."); + ANS_LOGE("RemoveReason valueType unexpected."); return false; } int32_t removeReason = 0; napi_get_value_int32(env, value, &removeReason); if (!Common::IsValidRemoveReason(removeReason)) { - ANS_LOGW("RemoveReason value unexpected."); + ANS_LOGE("RemoveReason value unexpected."); return false; } params.removeReason = removeReason; @@ -54,7 +54,7 @@ bool ParseCallbackFunc(const napi_env &env, const napi_value &value, napi_valuetype valueType = napi_undefined; NAPI_CALL_BASE(env, napi_typeof(env, value, &valueType), false); if (valueType != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return true; } napi_create_reference(env, value, 1, ¶ms.callback); @@ -71,7 +71,7 @@ bool ParseHashcodeTypeParams( std::vector hashcodes; auto retValue = Common::GetHashCodes(env, argv[PARAM0], hashcodes); if (retValue == nullptr) { - ANS_LOGW("GetHashCodes failed."); + ANS_LOGE("GetHashCodes failed."); return false; } params.hashcodes = hashcodes; @@ -105,7 +105,7 @@ bool ParseHashcodeTypeParams( bool ParseBundleOptionTypeParams(const napi_env &env, napi_value* argv, size_t argc, RemoveParams ¶ms) { if (argc < REMOVE_BY_BUNDLE_AND_KEY_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); return false; } BundleAndKeyInfo bundleInfo {}; @@ -137,7 +137,7 @@ bool ParseParameters(const napi_env &env, const napi_callback_info &info, Remove napi_value thisVar = nullptr; NAPI_CALL_BASE(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL), false); if (argc < REMOVE_MIN_PARA) { - ANS_LOGW("Wrong number of arguments."); + ANS_LOGE("Wrong number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return false; } @@ -147,7 +147,7 @@ bool ParseParameters(const napi_env &env, const napi_callback_info &info, Remove NAPI_CALL_BASE(env, napi_typeof(env, argv[PARAM0], &valueType), false); if ((valueType != napi_string) && (valueType != napi_object) && (valueType != napi_number) && (valueType != napi_boolean) && !isArray) { - ANS_LOGW("Wrong argument type. String or object expected."); + ANS_LOGE("Wrong argument type. String or object expected."); std::string msg = "Incorrect parameter types.The type of param must be object or string."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return false; @@ -175,14 +175,14 @@ napi_value ParseParametersByRemoveAll(const napi_env &env, const napi_callback_i napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if ((valuetype != napi_object) && (valuetype != napi_number) && (valuetype != napi_function)) { - ANS_LOGW("Wrong argument type. Function or object expected. Excute promise."); + ANS_LOGE("Wrong argument type. Function or object expected. Excute promise."); return Common::NapiGetNull(env); } if (valuetype == napi_object) { BundleAndKeyInfo bundleandKeyInfo {}; auto retValue = Common::GetBundleOption(env, argv[PARAM0], bundleandKeyInfo.option); if (retValue == nullptr) { - ANS_LOGW("GetBundleOption failed."); + ANS_LOGE("GetBundleOption failed."); Common::NapiThrow(env, ERROR_PARAM_INVALID, PARAMETER_VERIFICATION_FAILED); return nullptr; } @@ -198,7 +198,7 @@ napi_value ParseParametersByRemoveAll(const napi_env &env, const napi_callback_i if (argc >= REMOVE_ALL_MAX_PARA) { NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_function) { - ANS_LOGW("Callback is not function excute promise."); + ANS_LOGE("Callback is not function excute promise."); return Common::NapiGetNull(env); } napi_create_reference(env, argv[PARAM1], 1, ¶ms.callback); @@ -218,7 +218,7 @@ napi_value ParseParameters( napi_valuetype valuetype = napi_undefined; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); if (argc < REMOVE_GROUP_BY_BUNDLE_MIN_PARA) { - ANS_LOGW("Error number of arguments."); + ANS_LOGE("Error number of arguments."); Common::NapiThrow(env, ERROR_PARAM_INVALID, MANDATORY_PARAMETER_ARE_LEFT_UNSPECIFIED); return nullptr; } @@ -226,7 +226,7 @@ napi_value ParseParameters( // argv[0]: bundle NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); if (valuetype != napi_object) { - ANS_LOGW("Valuetype is not object."); + ANS_LOGE("Valuetype is not object."); std::string msg = "Incorrect parameter types.The type of param must be object."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; @@ -241,7 +241,7 @@ napi_value ParseParameters( // argv[1]: groupName: string NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); if (valuetype != napi_string && valuetype != napi_number && valuetype != napi_boolean) { - ANS_LOGW("Error argument type. String number boolean anticipate."); + ANS_LOGE("Error argument type. String number boolean anticipate."); std::string msg = "Incorrect parameter types.The type of param must be string or number or boolean."; Common::NapiThrow(env, ERROR_PARAM_INVALID, msg); return nullptr; diff --git a/frameworks/reminder/src/reminder_request_factory.cpp b/frameworks/reminder/src/reminder_request_factory.cpp index 9cf50fd57..b257db47c 100644 --- a/frameworks/reminder/src/reminder_request_factory.cpp +++ b/frameworks/reminder/src/reminder_request_factory.cpp @@ -46,12 +46,12 @@ ReminderRequest* ReminderRequestFactory::CreateReminderRequest(ReminderRequest:: break; } default: { - ANSR_LOGW("Create ReminderRequest fail."); + ANSR_LOGE("Create ReminderRequest fail."); return nullptr; } } if (reminderRequest == nullptr) { - ANSR_LOGW("CreateReminderRequest fail."); + ANSR_LOGE("CreateReminderRequest fail."); return nullptr; } reminderRequest->SetReminderType(reminderType); diff --git a/frameworks/reminder/src/reminder_request_timer.cpp b/frameworks/reminder/src/reminder_request_timer.cpp index fb581fde4..9358fc834 100644 --- a/frameworks/reminder/src/reminder_request_timer.cpp +++ b/frameworks/reminder/src/reminder_request_timer.cpp @@ -34,13 +34,13 @@ ReminderRequestTimer::ReminderRequestTimer(uint64_t countDownTimeInSeconds) ReminderRequest::GetDurationSinceEpochInMilli(now) + countDownTimeInSeconds_ * ReminderRequest::MILLI_SECONDS); sptr timer = MiscServices::TimeServiceClient::GetInstance(); if (timer == nullptr) { - ANSR_LOGW("Failed to get boot time due to TimeServiceClient is null."); + ANSR_LOGE("Failed to get boot time due to TimeServiceClient is null."); } else { int64_t bootTimeMs = timer->GetBootTimeMs(); if (bootTimeMs >= 0) { firstRealTimeInMilliSeconds_ = static_cast(bootTimeMs); } else { - ANSR_LOGW("Get boot time error."); + ANSR_LOGE("Get boot time error."); } } } @@ -106,12 +106,12 @@ void ReminderRequestTimer::UpdateTimeInfo(const std::string &description) whenToChangeSysTime_ = ReminderRequest::GetDurationSinceEpochInMilli(now); sptr timer = MiscServices::TimeServiceClient::GetInstance(); if (timer == nullptr) { - ANSR_LOGW("Failed to updateTime info due to TimeServiceClient is null."); + ANSR_LOGE("Failed to updateTime info due to TimeServiceClient is null."); return; } int64_t bootTime = timer->GetBootTimeMs(); if (bootTime < 0) { - ANSR_LOGW("BootTime is illegal"); + ANSR_LOGE("BootTime is illegal"); return; } SetTriggerTimeInMilli(whenToChangeSysTime_ + countDownTimeInSeconds_ * MILLI_SECONDS - diff --git a/frameworks/reminder/src/reminder_service_load_callback.cpp b/frameworks/reminder/src/reminder_service_load_callback.cpp index ffda91ae1..24bfb7283 100644 --- a/frameworks/reminder/src/reminder_service_load_callback.cpp +++ b/frameworks/reminder/src/reminder_service_load_callback.cpp @@ -33,7 +33,7 @@ void ReminderServiceCallback::OnLoadSystemAbilitySuccess( void ReminderServiceCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { DelayedSingleton::GetInstance()->LoadSystemAbilityFail(); - ANS_LOGI("on load system ability failed!"); + ANS_LOGE("on load system ability failed!"); } } } \ No newline at end of file diff --git a/interfaces/ndk/src/notification.cpp b/interfaces/ndk/src/notification.cpp index 1b1fe73aa..22ad319de 100644 --- a/interfaces/ndk/src/notification.cpp +++ b/interfaces/ndk/src/notification.cpp @@ -27,7 +27,7 @@ bool OH_Notification_IsNotificationEnabled(void) bool isEnable = false; int32_t result = OHOS::Notification::NotificationHelper::IsAllowedNotifySelf(isEnable); if (result != OHOS::ERR_OK) { - ANS_LOGW("Get notification enable failed %{public}d", result); + ANS_LOGE("Get notification enable failed %{public}d", result); return false; } return isEnable; diff --git a/services/ans/src/advanced_notification_flow_control_service.cpp b/services/ans/src/advanced_notification_flow_control_service.cpp index 2c47d90bf..78ffa1be3 100644 --- a/services/ans/src/advanced_notification_flow_control_service.cpp +++ b/services/ans/src/advanced_notification_flow_control_service.cpp @@ -40,7 +40,7 @@ ErrCode FlowControlService::FlowControl(const std::shared_ptrrequest->IsUpdateOnly()) { - ANS_LOGW("Notification not exists when update"); + ANS_LOGE("Notification not exists when update"); return ERR_ANS_NOTIFICATION_NOT_EXISTS; } result = PublishFlowCtrl(record, callingUid); diff --git a/services/ans/src/advanced_notification_utils.cpp b/services/ans/src/advanced_notification_utils.cpp index 74c1c6816..fa38c41e9 100644 --- a/services/ans/src/advanced_notification_utils.cpp +++ b/services/ans/src/advanced_notification_utils.cpp @@ -293,7 +293,7 @@ ErrCode AdvancedNotificationService::GetActiveNotificationByFilter( bundle->GetUid(), IPCSkeleton::GetCallingUid()); } else { if (!AccessTokenHelper::CheckPermission(OHOS_PERMISSION_NOTIFICATION_CONTROLLER)) { - ANS_LOGW("Get live view by filter failed because check permission is false."); + ANS_LOGE("Get live view by filter failed because check permission is false."); return ERR_ANS_PERMISSION_DENIED; } } @@ -337,7 +337,7 @@ void AdvancedNotificationService::SetAgentNotification(sptr auto bundleManager = BundleManagerHelper::GetInstance(); int32_t activeUserId = -1; if (OsAccountManagerHelper::GetInstance().GetCurrentActiveUserId(activeUserId) != ERR_OK) { - ANSR_LOGW("Failed to get active user id!"); + ANSR_LOGE("Failed to get active user id!"); return; } @@ -540,7 +540,7 @@ void AdvancedNotificationService::OnBundleRemoved(const sptrRemoveNotificationForBundle(bundleOption); if (result != ERR_OK) { - ANS_LOGW("NotificationPreferences::RemoveNotificationForBundle failed: %{public}d", result); + ANS_LOGE("NotificationPreferences::RemoveNotificationForBundle failed: %{public}d", result); } #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED DistributedPreferences::GetInstance()->DeleteDistributedBundleInfo(bundleOption); diff --git a/services/ans/src/bundle_manager_helper.cpp b/services/ans/src/bundle_manager_helper.cpp index 2605e2ada..a5c34e305 100644 --- a/services/ans/src/bundle_manager_helper.cpp +++ b/services/ans/src/bundle_manager_helper.cpp @@ -93,7 +93,7 @@ bool BundleManagerHelper::CheckApiCompatibility(const std::string &bundleName, c int32_t callingUserId; AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(uid, callingUserId); if (!GetBundleInfoByBundleName(bundleName, callingUserId, bundleInfo)) { - ANS_LOGW("Failed to GetBundleInfoByBundleName, bundlename = %{public}s", + ANS_LOGE("Failed to GetBundleInfoByBundleName, bundlename = %{public}s", bundleName.c_str()); return false; } diff --git a/services/ans/src/clone/notification_clone_manager.cpp b/services/ans/src/clone/notification_clone_manager.cpp index 51ac15dae..f085944b1 100644 --- a/services/ans/src/clone/notification_clone_manager.cpp +++ b/services/ans/src/clone/notification_clone_manager.cpp @@ -88,13 +88,13 @@ int32_t NotificationCloneManager::OnBackup(MessageParcel& data, MessageParcel& r FILE *fdfile = fopen(BACKUP_CONFIG_FILE_PATH, "r"); if (fdfile == nullptr) { - ANS_LOGW("Notification open file failed."); + ANS_LOGE("Notification open file failed."); return ANS_CLONE_ERROR; } auto fd = fileno(fdfile); if (reply.WriteFileDescriptor(fd) == false) { (void)fclose(fdfile); - ANS_LOGW("Notification write file descriptor failed!"); + ANS_LOGE("Notification write file descriptor failed!"); return ANS_CLONE_ERROR; } @@ -149,24 +149,24 @@ ErrCode NotificationCloneManager::LoadConfig(UniqueFd &fd, std::string& config) ANS_LOGI("Load notification config."); struct stat statBuf; if (fstat(fd.Get(), &statBuf) < 0) { - ANS_LOGW("LoadConfig fstat fd fail %{public}d.", fd.Get()); + ANS_LOGE("LoadConfig fstat fd fail %{public}d.", fd.Get()); return ANS_CLONE_ERROR; } int destFd = open(BACKUP_CONFIG_FILE_PATH, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (destFd < 0) { - ANS_LOGW("LoadConfig open file fail."); + ANS_LOGE("LoadConfig open file fail."); return ANS_CLONE_ERROR; } fdsan_exchange_owner_tag(destFd, COMMON_FDSAN_TAG, NOTIFICATION_FDSAN_TAG); if (sendfile(destFd, fd.Get(), nullptr, statBuf.st_size) < 0) { - ANS_LOGW("LoadConfig fd sendfile(size: %{public}d) to destFd fail.", static_cast(statBuf.st_size)); + ANS_LOGE("LoadConfig fd sendfile(size: %{public}d) to destFd fail.", static_cast(statBuf.st_size)); fdsan_close_with_tag(destFd, NOTIFICATION_FDSAN_TAG); return ANS_CLONE_ERROR; } fdsan_close_with_tag(destFd, NOTIFICATION_FDSAN_TAG); 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%{public}s is_open() failed!", BACKUP_CONFIG_FILE_PATH); return ANS_CLONE_ERROR; } config.clear(); @@ -184,13 +184,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: %{public}s, fopen() failed!", BACKUP_CONFIG_FILE_PATH); 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: %{public}s, fwrite %{public}d failed!", BACKUP_CONFIG_FILE_PATH, ret); } (void)fflush(fp); (void)fsync(fileno(fp)); diff --git a/services/ans/src/common/notification_analytics_util.cpp b/services/ans/src/common/notification_analytics_util.cpp index e3a520ca4..7582479bb 100644 --- a/services/ans/src/common/notification_analytics_util.cpp +++ b/services/ans/src/common/notification_analytics_util.cpp @@ -461,7 +461,7 @@ void NotificationAnalyticsUtil::ReportModifyEvent(const HaMetaMessage& message) void NotificationAnalyticsUtil::ReportDeleteFailedEvent(const HaMetaMessage& message) { if (!ReportFlowControl(DELETE_ERROR_EVENT_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; @@ -859,7 +859,7 @@ int64_t NotificationAnalyticsUtil::GetCurrentTime() void NotificationAnalyticsUtil::ReportOperationsDotEvent(const HaMetaMessage& message) { if (!ReportFlowControl(ANS_CUSTOMIZE_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; @@ -876,7 +876,7 @@ void NotificationAnalyticsUtil::ReportOperationsDotEvent(const HaMetaMessage& me void NotificationAnalyticsUtil::ReportPublishFailedEvent(const HaMetaMessage& message) { if (!ReportFlowControl(PUBLISH_ERROR_EVENT_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; @@ -954,7 +954,7 @@ std::string NotificationAnalyticsUtil::BuildAnsData(const HaMetaMessage& message void NotificationAnalyticsUtil::ReportSkipFailedEvent(const HaMetaMessage& message) { if (!ReportFlowControl(MODIFY_ERROR_EVENT_CODE)) { - ANS_LOGI("Publish event failed, reason:%{public}s", message.Build().c_str()); + ANS_LOGE("Publish event failed, reason:%{public}s", message.Build().c_str()); return; } EventFwk::Want want; diff --git a/services/ans/src/common/notification_config_parse.cpp b/services/ans/src/common/notification_config_parse.cpp index aef8410f5..e9adb280f 100644 --- a/services/ans/src/common/notification_config_parse.cpp +++ b/services/ans/src/common/notification_config_parse.cpp @@ -53,7 +53,7 @@ std::shared_ptr NotificationConfigParse::GetAppPrivil return nullptr; } if (!root.contains(APP_PRIVILEGES)) { - ANS_LOGW("not found jsonKey appPrivileges"); + ANS_LOGE("not found jsonKey appPrivileges"); return nullptr; } nlohmann::json affects = root[APP_PRIVILEGES]; @@ -208,7 +208,7 @@ void NotificationConfigParse::GetFlowCtrlConfigFromCCM(FlowControlThreshold &thr return; } if (!root.contains(CFG_KEY_NOTIFICATION_SERVICE)) { - ANS_LOGW("GetFlowCtrlConfigFromCCM not found jsonKey"); + ANS_LOGE("GetFlowCtrlConfigFromCCM not found jsonKey"); return; } nlohmann::json affects = root[CFG_KEY_NOTIFICATION_SERVICE]; @@ -399,7 +399,7 @@ void NotificationConfigParse::GetCollaborationFilter() bool NotificationConfigParse::IsInCollaborationFilter(const std::string& bundleName, int32_t uid) const { if (uidList_.empty() && bundleNameList_.empty()) { - ANS_LOGW("UidList and bundleNameList empty."); + ANS_LOGE("UidList and bundleNameList empty."); return false; } @@ -413,7 +413,7 @@ bool NotificationConfigParse::IsInCollaborationFilter(const std::string& bundleN return true; } - ANS_LOGI("Uid <%{public}d> and BundleName <%{public}s> not in CollaborationFilter.", uid, bundleName.c_str()); + ANS_LOGE("Uid <%{public}d> and BundleName <%{public}s> not in CollaborationFilter.", uid, bundleName.c_str()); return false; } @@ -427,7 +427,7 @@ uint32_t NotificationConfigParse::GetStartAbilityTimeout() return 0; } if (!root.contains(CFG_KEY_NOTIFICATION_SERVICE)) { - ANS_LOGW("GetStartAbilityTimeout not found jsonKey"); + ANS_LOGE("GetStartAbilityTimeout not found jsonKey"); return 0; } nlohmann::json affects = root[CFG_KEY_NOTIFICATION_SERVICE]; diff --git a/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp b/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp index b5034d17e..daf9d1054 100644 --- a/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp +++ b/services/ans/src/disturb_manager/add_do_not_disturb_profiles.cpp @@ -52,7 +52,7 @@ ErrCode DisturbManager::AddDoNotDisturbProfilesSyncQueue( { int32_t userId = SUBSCRIBE_USER_INIT; if (OsAccountManagerHelper::GetInstance().GetCurrentActiveUserId(userId) != ERR_OK) { - ANS_LOGW("No active user found."); + ANS_LOGE("No active user found."); return ERR_ANS_GET_ACTIVE_USER_FAILED; } AdvancedNotificationService::GetInstance()->SubmitSyncTask( diff --git a/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp b/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp index 3acd1fbbd..365271f6a 100644 --- a/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp +++ b/services/ans/src/disturb_manager/get_do_not_disturb_profile.cpp @@ -38,7 +38,7 @@ ErrCode DisturbManager::HandleGetDoNotDisturbProfile(MessageParcel &data, Messag if (result == ERR_OK) { if (!reply.WriteParcelable(profile)) { - ANS_LOGE("HandleGetDoNotDisturbProfile write slot failed."); + ANS_LOGE("HandleGetDoNotDisturbProfile write profile failed."); return ERR_ANS_PARCELABLE_FAILED; } } @@ -49,7 +49,7 @@ ErrCode DisturbManager::GetDoNotDisturbProfileInner(int64_t id, sptrSubmitSyncTask( diff --git a/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp b/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp index a1b2f6317..52b42d0b4 100644 --- a/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp +++ b/services/ans/src/disturb_manager/set_do_not_disturb_date.cpp @@ -74,7 +74,7 @@ ErrCode DisturbManager::SetDoNotDisturbDate(const sptr("ans_extension"); if (distributedQueue_ == nullptr) { - ANS_LOGW("ffrt create failed!"); + ANS_LOGE("ffrt create failed!"); return; } } @@ -234,7 +234,7 @@ void DistributedExtensionService::OnDeviceOnline(const DmDeviceInfo &deviceInfo) { std::string name = TransDeviceTypeToName(deviceInfo.deviceTypeId); if (deviceConfig_.supportPeerDevice.find(name) == deviceConfig_.supportPeerDevice.end()) { - ANS_LOGI("The current device type not support %{public}d.", deviceInfo.deviceTypeId); + ANS_LOGE("The current device type not support %{public}d.", deviceInfo.deviceTypeId); return; } if (distributedQueue_ == nullptr) { @@ -242,13 +242,13 @@ void DistributedExtensionService::OnDeviceOnline(const DmDeviceInfo &deviceInfo) } std::function onlineTask = std::bind([&, deviceInfo]() { if (InitDans() != 0) { - ANS_LOGW("OnDeviceOnline init dans failed."); + ANS_LOGE("OnDeviceOnline init dans failed."); return; }; ADD_DEVICE handler = (ADD_DEVICE)dansHandler_->GetProxyFunc("AddDevice"); if (handler == nullptr) { - ANS_LOGW("Dans handler is null ptr."); + ANS_LOGE("Dans handler is null ptr."); return; } std::lock_guard lock(mapLock_); @@ -331,16 +331,16 @@ void DistributedExtensionService::OnDeviceOffline(const DmDeviceInfo &deviceInfo std::function offlineTask = std::bind([&, deviceInfo]() { std::lock_guard lock(mapLock_); if (deviceMap_.count(deviceInfo.deviceId) == 0) { - ANS_LOGI("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); + ANS_LOGE("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); return; } if (!dansRunning_.load() || dansHandler_ == nullptr || !dansHandler_->IsValid()) { - ANS_LOGW("Dans state not normal %{public}d", dansRunning_.load()); + ANS_LOGE("Dans state not normal %{public}d", dansRunning_.load()); return; } RELEASE_DEVICE handler = (RELEASE_DEVICE)dansHandler_->GetProxyFunc("ReleaseDevice"); if (handler == nullptr) { - ANS_LOGW("Dans handler is null ptr."); + ANS_LOGE("Dans handler is null ptr."); return; } handler(deviceInfo.deviceId, deviceInfo.deviceTypeId); @@ -360,16 +360,16 @@ void DistributedExtensionService::OnDeviceChanged(const DmDeviceInfo &deviceInfo std::function changeTask = std::bind([&, deviceInfo]() { std::lock_guard lock(mapLock_); if (deviceMap_.count(deviceInfo.deviceId) == 0) { - ANS_LOGI("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); + ANS_LOGE("Not target device %{public}s", StringAnonymous(deviceInfo.deviceId).c_str()); return; } if (!dansRunning_.load() || dansHandler_ == nullptr || !dansHandler_->IsValid()) { - ANS_LOGW("Dans state not normal %{public}d", dansRunning_.load()); + ANS_LOGE("Dans state not normal %{public}d", dansRunning_.load()); return; } REFRESH_DEVICE handler = (REFRESH_DEVICE)dansHandler_->GetProxyFunc("RefreshDevice"); if (handler == nullptr) { - ANS_LOGW("Dans handler is null ptr."); + ANS_LOGE("Dans handler is null ptr."); return; } handler(deviceInfo.deviceId, deviceInfo.deviceTypeId, deviceInfo.networkId); diff --git a/services/ans/src/notification_extension/notification_operation_service.cpp b/services/ans/src/notification_extension/notification_operation_service.cpp index 9535890d4..da309df44 100644 --- a/services/ans/src/notification_extension/notification_operation_service.cpp +++ b/services/ans/src/notification_extension/notification_operation_service.cpp @@ -41,7 +41,7 @@ DistributedOperationService::DistributedOperationService() { operationQueue_ = std::make_shared("ans_operation"); if (operationQueue_ == nullptr) { - ANS_LOGW("ffrt create failed!"); + ANS_LOGE("ffrt create failed!"); return; } ANS_LOGI("Operation service init successfully."); 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 575a4b66b..e0f23ab95 100644 --- a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp +++ b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp @@ -50,19 +50,19 @@ void SmartReminderCenter::GetMultiDeviceReminder() multiJsonPoint.append("/"); multiJsonPoint.append(MULTI_DEVICE_REMINDER); if (!DelayedSingleton::GetInstance()->GetConfigJson(multiJsonPoint, root)) { - ANS_LOGW("Failed to get multiDeviceReminder CCM config file."); + ANS_LOGE("Failed to get multiDeviceReminder CCM config file."); return; } if (root.find(NotificationConfigParse::CFG_KEY_NOTIFICATION_SERVICE) == root.end()) { - ANS_LOGW("GetMultiDeviceReminder failed as can not find notificationService."); + ANS_LOGE("GetMultiDeviceReminder failed as can not find notificationService."); return; } nlohmann::json multiDeviceRemindJson = root[NotificationConfigParse::CFG_KEY_NOTIFICATION_SERVICE][MULTI_DEVICE_REMINDER]; if (multiDeviceRemindJson.is_null() || !multiDeviceRemindJson.is_array() || multiDeviceRemindJson.empty()) { - ANS_LOGW("GetMultiDeviceReminder failed as invalid multiDeviceReminder json."); + ANS_LOGE("GetMultiDeviceReminder failed as invalid multiDeviceReminder json."); return; } diff --git a/services/ans/src/reminder_swing_decision_center.cpp b/services/ans/src/reminder_swing_decision_center.cpp index 3749c8b71..ec2894ccd 100644 --- a/services/ans/src/reminder_swing_decision_center.cpp +++ b/services/ans/src/reminder_swing_decision_center.cpp @@ -37,7 +37,7 @@ ReminderSwingDecisionCenter &ReminderSwingDecisionCenter::GetInstance() ErrCode ReminderSwingDecisionCenter::RegisterSwingCallback(const sptr &swingCallback) { if (swingCallback == nullptr) { - ANS_LOGW("swingCallback is null."); + ANS_LOGE("swingCallback is null."); return ERR_INVALID_VALUE; } swingRecipient_ = new (nothrow) SwingCallbackRecipient(); diff --git a/services/ans/src/utils/notifictaion_load_utils.cpp b/services/ans/src/utils/notifictaion_load_utils.cpp index 83edd6ec6..908a12a61 100644 --- a/services/ans/src/utils/notifictaion_load_utils.cpp +++ b/services/ans/src/utils/notifictaion_load_utils.cpp @@ -43,7 +43,7 @@ NotificationLoadUtils::~NotificationLoadUtils() void* NotificationLoadUtils::GetProxyFunc(const std::string& func) { if (proxyHandle_ == nullptr) { - ANS_LOGW("Get func failed: %{public}s %{public}s", path_.c_str(), func.c_str()); + ANS_LOGE("Get func failed: %{public}s %{public}s", path_.c_str(), func.c_str()); return nullptr; } diff --git a/services/reminder/src/reminder_config_change_observer.cpp b/services/reminder/src/reminder_config_change_observer.cpp index e0efc126f..a19712fb0 100644 --- a/services/reminder/src/reminder_config_change_observer.cpp +++ b/services/reminder/src/reminder_config_change_observer.cpp @@ -26,7 +26,7 @@ void ReminderConfigChangeObserver::OnConfigurationUpdated(const AppExecFwk::Conf ANSR_LOGD("OnConfigurationUpdated."); auto reminderDataMgr = ReminderDataManager::GetInstance(); if (reminderDataMgr == nullptr) { - ANSR_LOGW("Reminder data manager is nullptr"); + ANSR_LOGE("Reminder data manager is nullptr"); return; } std::string newLanguageInfo = configuration.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_LANGUAGE); diff --git a/services/reminder/src/reminder_data_manager.cpp b/services/reminder/src/reminder_data_manager.cpp index 50d44a7c4..93569ba02 100644 --- a/services/reminder/src/reminder_data_manager.cpp +++ b/services/reminder/src/reminder_data_manager.cpp @@ -1175,12 +1175,12 @@ void ReminderDataManager::StartRecentReminder() std::lock_guard lock(ReminderDataManager::MUTEX); sptr reminder = GetRecentReminder(); if (reminder == nullptr) { - ANSR_LOGI("No reminder need to start"); + ANSR_LOGW("No reminder need to start"); SetActiveReminder(reminder); return; } if (activeReminderId_ == reminder->GetReminderId()) { - ANSR_LOGI("Recent reminder has already run, no need to start again."); + ANSR_LOGW("Recent reminder has already run, no need to start again."); return; } if (activeReminderId_ != -1) { diff --git a/services/reminder/src/reminder_data_manager_inner.cpp b/services/reminder/src/reminder_data_manager_inner.cpp index f71bfb87a..1e0eb507a 100644 --- a/services/reminder/src/reminder_data_manager_inner.cpp +++ b/services/reminder/src/reminder_data_manager_inner.cpp @@ -139,12 +139,12 @@ void ReminderDataManager::CloseCustomRingFileDesc(const int32_t reminderId, cons { std::lock_guard locker(resourceMutex_); if (soundResource_ == nullptr) { - ANSR_LOGW("ResourceManager is nullptr."); + ANSR_LOGE("ResourceManager is nullptr."); return; } auto result = soundResource_->CloseRawFileDescriptor(customRingUri); if (result != Global::Resource::SUCCESS) { - ANSR_LOGW("CloseRawFileDescriptor fail[%{public}d]", static_cast(result)); + ANSR_LOGE("CloseRawFileDescriptor fail[%{public}d]", static_cast(result)); } ANSR_LOGI("Stop custom sound, reminderId:[%{public}d].", reminderId); soundResource_ = nullptr; @@ -170,7 +170,7 @@ bool ReminderDataManager::CheckShowLimit(std::unordered_map& reminder) { if (totalCount > TOTAL_MAX_NUMBER_SHOW_AT_ONCE) { - ANSR_LOGW("The maximum number of displays that can be displayed at a time has been reached."); + ANSR_LOGE("The maximum number of displays that can be displayed at a time has been reached."); return false; } ++totalCount; @@ -181,7 +181,7 @@ bool ReminderDataManager::CheckShowLimit(std::unordered_mapsecond > ONE_HAP_MAX_NUMBER_SHOW_AT_ONCE) { - ANSR_LOGW("The maximum number of displays that can be displayed in a single app[%{public}s] has been reached", + ANSR_LOGE("The maximum number of displays that can be displayed in a single app[%{public}s] has been reached", reminder->GetBundleName().c_str()); return false; } @@ -230,19 +230,19 @@ void ReminderDataManager::AsyncStartExtensionAbility(const sptr { auto manager = ReminderDataManager::GetInstance(); if (manager == nullptr) { - ANSR_LOGW("ReminderDataManager is nullptr."); + ANSR_LOGE("ReminderDataManager is nullptr."); return; } if (!manager->IsSystemReady()) { - ANSR_LOGW("bundle service or ability service not ready."); + ANSR_LOGE("bundle service or ability service not ready."); return; } if (!reminder->IsSystemApp()) { - ANSR_LOGI("Start extension ability failed, is not system app"); + ANSR_LOGE("Start extension ability failed, is not system app"); return; } if (count > TOTAL_MAX_NUMBER_START_EXTENSION) { - ANSR_LOGW("The maximum number of start extension has been reached."); + ANSR_LOGE("The maximum number of start extension has been reached."); return; } ++count; -- Gitee From df96614c7d4bf7aecea7b318c759b9d49f1d8e1c Mon Sep 17 00:00:00 2001 From: heguokai Date: Mon, 24 Mar 2025 09:31:08 +0000 Subject: [PATCH 3/5] update frameworks/core/src/listener/ans_subscriber_listener.cpp. Signed-off-by: heguokai --- frameworks/core/src/listener/ans_subscriber_listener.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frameworks/core/src/listener/ans_subscriber_listener.cpp b/frameworks/core/src/listener/ans_subscriber_listener.cpp index 4f64ac83c..f35946283 100644 --- a/frameworks/core/src/listener/ans_subscriber_listener.cpp +++ b/frameworks/core/src/listener/ans_subscriber_listener.cpp @@ -195,11 +195,7 @@ void SubscriberListener::OnBadgeEnabledChanged( void SubscriberListener::OnApplicationInfoNeedChanged(const std::string& bundleName) { HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); -<<<<<<< HEAD ANS_LOGW("OnApplicationInfoNeedChanged SubscriberListener 1."); -======= - ANS_LOGD("OnApplicationInfoNeedChanged SubscriberListener 1."); ->>>>>>> 05df7d512d41aadcb70d4fe3208bb2a2254ee737 auto subscriber = subscriber_.lock(); if (subscriber == nullptr) { ANS_LOGE("Subscriber is nullptr"); -- Gitee From 2028436aeeddf48584123e00257cf9c8040147e7 Mon Sep 17 00:00:00 2001 From: heguokai Date: Mon, 24 Mar 2025 17:45:54 +0800 Subject: [PATCH 4/5] log change Signed-off-by: heguokai --- frameworks/js/napi/src/reminder/reminder_common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/src/reminder/reminder_common.cpp b/frameworks/js/napi/src/reminder/reminder_common.cpp index 682f623ee..43dff2503 100644 --- a/frameworks/js/napi/src/reminder/reminder_common.cpp +++ b/frameworks/js/napi/src/reminder/reminder_common.cpp @@ -82,7 +82,7 @@ bool ReminderCommon::GenActionButtons( ReminderRequest::ActionButtonType(buttonType) == ReminderRequest::ActionButtonType::SNOOZE || (ReminderRequest::ActionButtonType(buttonType) == ReminderRequest::ActionButtonType::CUSTOM && isSysApp))) { - ANSR_LOGE("Wrong argument type:%{public}s. buttonType not support.", ACTION_BUTTON); + ANSR_LOGE("Wrong argument type:%{public}s. buttonType not support.", ACTION_BUTTON); return false; } HandleActionButtonTitle(env, actionButton, reminder, str, buttonType); -- Gitee From df58097c4c4ac785314cabce04355908ff260398 Mon Sep 17 00:00:00 2001 From: heguokai Date: Tue, 25 Mar 2025 02:38:46 +0000 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20fram?= =?UTF-8?q?eworks/js/napi/src/manager/napi=5Fdisable=5Fnotification.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/manager/napi_disable_notification.cpp | 79 ------------------- 1 file changed, 79 deletions(-) delete mode 100644 frameworks/js/napi/src/manager/napi_disable_notification.cpp diff --git a/frameworks/js/napi/src/manager/napi_disable_notification.cpp b/frameworks/js/napi/src/manager/napi_disable_notification.cpp deleted file mode 100644 index d6588d7bf..000000000 --- a/frameworks/js/napi/src/manager/napi_disable_notification.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2024 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "napi_disable_notification.h" - -#include "ans_inner_errors.h" -#include "disable_notification.h" - -namespace OHOS { -namespace NotificationNapi { -napi_value NapiDisableNotificationFeature(napi_env env, napi_callback_info info) -{ -#ifdef DISABLE_NOTIFICATION_FEATURE_ENABLE - ANS_LOGD("enter"); - NotificationDisable paras; - if (!ParseDisableNotificationParameters(env, info, paras)) { - Common::NapiThrow(env, ERROR_PARAM_INVALID); - return Common::NapiGetUndefined(env); - } - - AsyncCallbackInfoDisableNotification *asynccallbackinfo = new (std::nothrow) AsyncCallbackInfoDisableNotification { - .env = env, .asyncWork = nullptr, .disableNotification = paras - }; - if (!asynccallbackinfo) { - Common::NapiThrow(env, ERROR_INTERNAL_ERROR); - return Common::JSParaError(env, nullptr); - } - napi_value promise = nullptr; - Common::PaddingCallbackPromiseInfo(env, nullptr, asynccallbackinfo->info, promise); - - napi_value resourceName = nullptr; - napi_create_string_latin1(env, "disableNotificationFeature", NAPI_AUTO_LENGTH, &resourceName); - // Asynchronous function call - napi_create_async_work(env, - nullptr, resourceName, [](napi_env env, void *data) { - ANS_LOGD("NapiDisableNotificationFeature work excute"); - AsyncCallbackInfoDisableNotification *asynccallbackinfo = - static_cast(data); - if (asynccallbackinfo) { - asynccallbackinfo->info.errorCode = - NotificationHelper::DisableNotificationFeature(asynccallbackinfo->disableNotification); - } - }, - [](napi_env env, napi_status status, void *data) { - ANS_LOGD("NapiDisableNotificationFeature work complete"); - AsyncCallbackInfoDisableNotification *asynccallbackinfo = - static_cast(data); - if (asynccallbackinfo) { - Common::CreateReturnValue(env, asynccallbackinfo->info, Common::NapiGetNull(env)); - ANS_LOGD("Delete NapiDisableNotificationFeature asyncWork"); - napi_delete_async_work(env, asynccallbackinfo->asyncWork); - delete asynccallbackinfo; - asynccallbackinfo = nullptr; - } - ANS_LOGD("NapiDisableNotificationFeature work complete end"); - }, - (void *)asynccallbackinfo, - &asynccallbackinfo->asyncWork); - napi_queue_async_work_with_qos(env, asynccallbackinfo->asyncWork, napi_qos_user_initiated); - return promise; -#else - Common::NapiThrow(env, ERROR_SYSTEM_CAP_ERROR); - return Common::NapiGetUndefined(env); -#endif -} -} -} \ No newline at end of file -- Gitee