From 2203b2dc4de5f1c74b4d08083b24122ade6af20b Mon Sep 17 00:00:00 2001 From: songbao1 Date: Fri, 13 Sep 2024 17:04:08 +0800 Subject: [PATCH] =?UTF-8?q?cherry=20pick=20077996a=20from=20https://gitee.?= =?UTF-8?q?com/songbao1/notification=5Fdistributed=5Fnotification=5Fservic?= =?UTF-8?q?e/pulls/2192=20=E5=9B=BE=E7=89=87=E8=BD=AC=E6=8D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= 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 | 2 ++ frameworks/core/src/ans_subscriber_proxy.cpp | 5 +++-- services/ans/src/common/notification_analytics_util.cpp | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index 1d7a5b445..5245001ec 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -304,6 +304,8 @@ void NotificationRequest::SetLittleIcon(const std::shared_ptr & Media::ImageInfo outImageInfo; littleIcon->GetImageInfo(outImageInfo); littleIconType_ = outImageInfo.encodedFormat; + } else { + littleIconType_ = ""; } } diff --git a/frameworks/core/src/ans_subscriber_proxy.cpp b/frameworks/core/src/ans_subscriber_proxy.cpp index 53e283ab9..941f8d779 100644 --- a/frameworks/core/src/ans_subscriber_proxy.cpp +++ b/frameworks/core/src/ans_subscriber_proxy.cpp @@ -241,8 +241,9 @@ void AnsSubscriberProxy::OnCanceledList(const std::vector> &n for (size_t i = 0; i < notifications.size(); i ++) { sptr notification = notifications[i]; - notification->GetNotificationRequest().SetBigIcon(nullptr); - notification->GetNotificationRequest().SetLittleIcon(nullptr); + notification->GetNotificationRequestPoint()->SetBigIcon(nullptr); + notification->GetNotificationRequestPoint()->SetLittleIcon(nullptr); + notification->GetNotificationRequestPoint()->SetOverlayIcon(nullptr); } if (!WriteParcelableVector(notifications, data)) { ANS_LOGE("Write notifications failed"); diff --git a/services/ans/src/common/notification_analytics_util.cpp b/services/ans/src/common/notification_analytics_util.cpp index f962ea08c..f9434c456 100644 --- a/services/ans/src/common/notification_analytics_util.cpp +++ b/services/ans/src/common/notification_analytics_util.cpp @@ -259,7 +259,9 @@ bool NotificationAnalyticsUtil::ReportFlowControl(const int32_t reportType) std::list list = GetFlowListByType(reportType); FlowControllerOption option = GetFlowOptionByType(reportType); RemoveExpired(list, now, option.time); - if (list.size() >= option.count) { + int32_t size = list.size(); + int32_t count = option.count; + if (size >= count) { return false; } list.push_back(now); -- Gitee