diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index ab0ba0f8f3f0ac0773775eb4d0b0e89c22045d9d..ee14c4c79b04f43e67bd10da1333e5231d92876d 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 dfb2da3889ef56fd9d216a0854cf8a6d51941671..a679390cc4a5c6fdf6300a597df92896b3923f9c 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 92f1be29a38fe48b1e95c1784afe2769161513ab..620b26a9746a2fb0389920c6f44496291dd8bcb8 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_ {};