From 5e05d29b90628088e889afc3f3fc6f5d51c05158 Mon Sep 17 00:00:00 2001 From: songbao1 Date: Tue, 30 Jul 2024 17:41:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E5=86=B5=E7=AA=97=E6=AD=BB=E4=BA=A1?= =?UTF-8?q?=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- frameworks/ans/src/notification_capsule.cpp | 7 +++++++ .../ans/src/notification_local_live_view_button.cpp | 10 ++++++++++ .../ans/src/notification_local_live_view_content.cpp | 11 +++++++++++ interfaces/inner_api/notification_capsule.h | 2 ++ .../inner_api/notification_local_live_view_button.h | 4 ++++ .../inner_api/notification_local_live_view_content.h | 4 ++++ services/ans/src/notification_subscriber_manager.cpp | 10 +++++++++- 7 files changed, 47 insertions(+), 1 deletion(-) diff --git a/frameworks/ans/src/notification_capsule.cpp b/frameworks/ans/src/notification_capsule.cpp index 336926f10..a1be9fcc4 100644 --- a/frameworks/ans/src/notification_capsule.cpp +++ b/frameworks/ans/src/notification_capsule.cpp @@ -184,5 +184,12 @@ NotificationCapsule *NotificationCapsule::Unmarshalling(Parcel &parcel) return capsule; } + +void NotificationCapsule::ResetIcon() +{ + if (icon_) { + icon_.reset(); + } +} } // namespace Notification } // namespace OHOS \ No newline at end of file diff --git a/frameworks/ans/src/notification_local_live_view_button.cpp b/frameworks/ans/src/notification_local_live_view_button.cpp index d5972ebb4..8575ec20c 100644 --- a/frameworks/ans/src/notification_local_live_view_button.cpp +++ b/frameworks/ans/src/notification_local_live_view_button.cpp @@ -278,5 +278,15 @@ NotificationLocalLiveViewButton *NotificationLocalLiveViewButton::Unmarshalling( return button; } + +void NotificationLocalLiveViewButton::ClearButtonIcons() +{ + buttonIcons_.clear(); +} + +void NotificationLocalLiveViewButton::ClearButtonIconsResource() +{ + buttonIconsResource_.clear(); +} } // namespace Notification } // namespace OHOS diff --git a/frameworks/ans/src/notification_local_live_view_content.cpp b/frameworks/ans/src/notification_local_live_view_content.cpp index fc0bc788c..697fa5026 100644 --- a/frameworks/ans/src/notification_local_live_view_content.cpp +++ b/frameworks/ans/src/notification_local_live_view_content.cpp @@ -329,5 +329,16 @@ bool NotificationLocalLiveViewContent::ReadFromParcel(Parcel &parcel) return true; } + +void NotificationLocalLiveViewContent::ClearButton() +{ + button_.ClearButtonIcons(); + button_.ClearButtonIconsResource(); +} + +void NotificationLocalLiveViewContent::ClearCapsuleIcon() +{ + capsule_.ResetIcon(); +} } // namespace Notification } // namespace OHOS diff --git a/interfaces/inner_api/notification_capsule.h b/interfaces/inner_api/notification_capsule.h index 912c40863..2b1ec578a 100644 --- a/interfaces/inner_api/notification_capsule.h +++ b/interfaces/inner_api/notification_capsule.h @@ -104,6 +104,8 @@ public: */ static NotificationCapsule *Unmarshalling(Parcel &parcel); + void ResetIcon(); + private: /** * @brief Read a NotificationConversationalMessage object from a Parcel. diff --git a/interfaces/inner_api/notification_local_live_view_button.h b/interfaces/inner_api/notification_local_live_view_button.h index e032c44ed..70f38f0f6 100644 --- a/interfaces/inner_api/notification_local_live_view_button.h +++ b/interfaces/inner_api/notification_local_live_view_button.h @@ -100,6 +100,10 @@ public: */ static NotificationLocalLiveViewButton *Unmarshalling(Parcel &parcel); + void ClearButtonIcons(); + + void ClearButtonIconsResource(); + private: /** * @brief Read a NotificationConversationalMessage object from a Parcel. diff --git a/interfaces/inner_api/notification_local_live_view_content.h b/interfaces/inner_api/notification_local_live_view_content.h index 8f666669d..59c6b5662 100644 --- a/interfaces/inner_api/notification_local_live_view_content.h +++ b/interfaces/inner_api/notification_local_live_view_content.h @@ -163,6 +163,10 @@ public: */ static NotificationLocalLiveViewContent *Unmarshalling(Parcel &parcel); + void ClearButton(); + + void ClearCapsuleIcon(); + protected: /** * @brief Read a NotificationConversationalContent object from a Parcel. diff --git a/services/ans/src/notification_subscriber_manager.cpp b/services/ans/src/notification_subscriber_manager.cpp index 447a3d8ed..8b354cb81 100644 --- a/services/ans/src/notification_subscriber_manager.cpp +++ b/services/ans/src/notification_subscriber_manager.cpp @@ -566,7 +566,7 @@ void NotificationSubscriberManager::BatchNotifyCanceledInner(const std::vectorGetNotificationRequest().GetContent(); - if (requestContent->GetContentType() == NotificationContent::Type::LIVE_VIEW && + if (notification->GetNotificationRequest().IsCommonLiveView() && requestContent->GetNotificationContent() != nullptr) { auto liveViewContent = std::static_pointer_cast( requestContent->GetNotificationContent()); @@ -574,6 +574,14 @@ void NotificationSubscriberManager::BatchNotifyCanceledInner(const std::vectorClearPictureMarshallingMap(); ANS_LOGD("live view batch delete clear picture"); } + if (notification->GetNotificationRequest().IsSystemLiveView() && + requestContent->GetNotificationContent() != nullptr) { + auto localLiveViewContent = std::static_pointer_cast( + requestContent->GetNotificationContent()); + localLiveViewContent->ClearButton(); + localLiveViewContent->ClearCapsuleIcon(); + ANS_LOGD("local live view batch delete clear picture"); + } if (IsSubscribedBysubscriber(record, notification)) { currNotifications.emplace_back(notification); } -- Gitee