From 927d184e244b468bab02e5d31263c576dea5266f Mon Sep 17 00:00:00 2001 From: songbao1 Date: Thu, 12 Sep 2024 17:45:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=86=99=E5=85=A5=E5=A4=B1=E8=B4=A5=E5=AF=BC=E8=87=B4=E6=97=A0?= =?UTF-8?q?=E9=99=90=E5=BE=AA=E7=8E=AF=20=EF=BC=88cherry=20picked=20commit?= =?UTF-8?q?=20from=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/ans/src/advanced_notification_publish_service.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index c7bac3a21..f1b24dd81 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -801,13 +801,14 @@ ErrCode AdvancedNotificationService::SetNotificationsEnabledForSpecialBundle( bundle, notificationEnable); // Local device result = NotificationPreferences::GetInstance()->SetNotificationsEnabledForBundle(bundle, enabled); - if (!enabled) { + bool enableSuccessed = result == ERR_OK; + if (!enabled && result == ERR_OK) { result = RemoveAllNotificationsForDisable(bundle); } if (saveRef != ERR_OK) { SetSlotFlagsTrustlistsAsBundle(bundle); } - if (result == ERR_OK) { + if (enableSuccessed) { NotificationSubscriberManager::GetInstance()->NotifyEnabledNotificationChanged(bundleData); PublishSlotChangeCommonEvent(bundle); } -- Gitee