diff --git a/frameworks/ans/src/notification_capsule.cpp b/frameworks/ans/src/notification_capsule.cpp index 336926f10707440e2e9376cf7781fff93e499070..a1be9fcc45499ad3b05e6677a8a0bf04c7a1a065 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 d5972ebb470bc97d7b11b7b4047bf7047cf1a794..8575ec20c45d5ca33b422119ef3330d1cd7a43b4 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 fc0bc788c0ff4be9b65a2dfed1ee433f25fa3392..697fa5026d5b5b59f4c8c4d8a83cbe06c3f1052b 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 912c408634d943dcd9711d8094047bfb5b52b5b9..2b1ec578a4b988dbfb67a55e1a1010662bd9a9d2 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 e032c44ed43a4f81c4805a8073f19487d2a3cf3f..70f38f0f6c48a2809c6970ff8207157b37b4f164 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 8f666669d74ae246bb8df8d82622afbe0702ffb4..59c6b56627ac919d4239e0e7b00dff3b669f63e7 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 447a3d8eda635d2457ea591da3bf93f62efd3767..8b354cb818c5013b7aaf20d51e81442cbdf7cc9c 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); }