From 5ab3a8c6a1115302d843a72089e737565eefd099 Mon Sep 17 00:00:00 2001 From: songbao1 Date: Fri, 14 Mar 2025 16:53:35 +0800 Subject: [PATCH] =?UTF-8?q?imagesize=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- frameworks/ans/src/notification_request.cpp | 10 ++++++++++ frameworks/core/src/ans_notification.cpp | 8 ++++---- interfaces/inner_api/notification_request.h | 8 ++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index ab0ba0f8f..ee14c4c79 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -755,6 +755,16 @@ uint32_t NotificationRequest::GetHashCodeGenerateType() const return hashCodeGenerateType_; } +void NotificationRequest::ResetLittleIcon() const +{ + littleIcon_ = nullptr; +} + +void NotificationRequest::ResetOverLayIcon() const +{ + overlayIcon_ = nullptr; +} + std::string NotificationRequest::Dump() { return "NotificationRequest{ " diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index dfb2da388..a679390cc 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -1540,14 +1540,14 @@ ErrCode AnsNotification::CheckImageSize(const NotificationRequest &request) { auto littleIcon = request.GetLittleIcon(); if (NotificationRequest::CheckImageOverSizeForPixelMap(littleIcon, MAX_ICON_SIZE)) { - ANS_LOGE("The size of little icon exceeds limit"); - return ERR_ANS_ICON_OVER_SIZE; + ANS_LOGW("The size of little icon exceeds limit"); + request.ResetLittleIcon(); } auto overlayIcon = request.GetOverlayIcon(); if (overlayIcon && NotificationRequest::CheckImageOverSizeForPixelMap(overlayIcon, MAX_ICON_SIZE)) { - ANS_LOGE("The size of overlay icon exceeds limit"); - return ERR_ANS_ICON_OVER_SIZE; + ANS_LOGW("The size of overlay icon exceeds limit"); + request.ResetOverLayIcon(); } ErrCode err = request.CheckImageSizeForContent(); diff --git a/interfaces/inner_api/notification_request.h b/interfaces/inner_api/notification_request.h index 92f1be29a..620b26a97 100644 --- a/interfaces/inner_api/notification_request.h +++ b/interfaces/inner_api/notification_request.h @@ -1426,6 +1426,10 @@ public: uint32_t GetHashCodeGenerateType() const; + void ResetLittleIcon() const; + + void ResetOverLayIcon() const; + private: /** * Indicates the color mask, used for calculation with the ARGB value set by setColor(int32_t). @@ -1553,11 +1557,11 @@ private: std::shared_ptr removalWantAgent_ {}; std::shared_ptr maxScreenWantAgent_ {}; std::shared_ptr additionalParams_ {}; - std::shared_ptr littleIcon_ {}; + mutable std::shared_ptr littleIcon_ {}; std::string littleIconType_ {}; mutable std::shared_ptr bigIcon_ {}; - std::shared_ptr overlayIcon_ {}; + mutable std::shared_ptr overlayIcon_ {}; std::shared_ptr notificationContent_ {}; std::vector> actionButtons_ {}; -- Gitee