From c1679849044b1093872894ef90b4ebd92374b26d Mon Sep 17 00:00:00 2001 From: songbao1 Date: Fri, 13 Sep 2024 11:51:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=A3=E9=99=A4=E6=AD=BB=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- .../src/advanced_notification_publish_service.cpp | 14 +++++++------- services/ans/src/bundle_manager_helper.cpp | 10 ++++------ services/ans/src/notification_preferences.cpp | 4 +++- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 17a97cd2f..984d29fd9 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -888,13 +888,13 @@ ErrCode AdvancedNotificationService::SetNotificationsEnabledForSpecialBundle( // Local device result = NotificationPreferences::GetInstance()->SetNotificationsEnabledForBundle(bundle, enabled); bool enableSuccessed = result == ERR_OK; - if (!enabled && result == ERR_OK) { - result = RemoveAllNotificationsForDisable(bundle); - } - if (saveRef != ERR_OK) { - SetSlotFlagsTrustlistsAsBundle(bundle); - } - if (enableSuccessed) { + if (result == ERR_OK) { + if (!enabled) { + result = RemoveAllNotificationsForDisable(bundle); + } + if (saveRef != ERR_OK) { + SetSlotFlagsTrustlistsAsBundle(bundle); + } NotificationSubscriberManager::GetInstance()->NotifyEnabledNotificationChanged(bundleData); PublishSlotChangeCommonEvent(bundle); } diff --git a/services/ans/src/bundle_manager_helper.cpp b/services/ans/src/bundle_manager_helper.cpp index 8c6932d1a..b05cc5b50 100644 --- a/services/ans/src/bundle_manager_helper.cpp +++ b/services/ans/src/bundle_manager_helper.cpp @@ -96,13 +96,11 @@ bool BundleManagerHelper::CheckApiCompatibility(const std::string &bundleName, c bundleName.c_str()); return false; } - - for (auto abilityInfo : bundleInfo.abilityInfos) { - if (abilityInfo.isStageBasedModel) { - return false; - } + if (bundleInfo.applicationInfo.allowEnableNotification) { + return true; } - return true; + + return false; } bool BundleManagerHelper::GetBundleInfoByBundleName( diff --git a/services/ans/src/notification_preferences.cpp b/services/ans/src/notification_preferences.cpp index 845bbcbc0..cd6c10aff 100644 --- a/services/ans/src/notification_preferences.cpp +++ b/services/ans/src/notification_preferences.cpp @@ -813,7 +813,9 @@ ErrCode NotificationPreferences::SetBundleProperty(NotificationPreferencesInfo & bundleInfo.SetEnableNotification(CheckApiCompatibility(bundleOption)); } result = SaveBundleProperty(bundleInfo, bundleOption, type, value); - preferencesInfo.SetBundleInfo(bundleInfo); + if (result == ERR_OK) { + preferencesInfo.SetBundleInfo(bundleInfo); + } return result; } -- Gitee From dee7ed2b27aeadd3007a08718c2786515e259114 Mon Sep 17 00:00:00 2001 From: luojingsong <9077954+songbao1@user.noreply.gitee.com> Date: Fri, 13 Sep 2024 09:38:53 +0000 Subject: [PATCH 2/3] update services/ans/src/bundle_manager_helper.cpp. Signed-off-by: luojingsong <9077954+songbao1@user.noreply.gitee.com> --- services/ans/src/bundle_manager_helper.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/ans/src/bundle_manager_helper.cpp b/services/ans/src/bundle_manager_helper.cpp index b05cc5b50..4e0809fd0 100644 --- a/services/ans/src/bundle_manager_helper.cpp +++ b/services/ans/src/bundle_manager_helper.cpp @@ -96,11 +96,13 @@ bool BundleManagerHelper::CheckApiCompatibility(const std::string &bundleName, c bundleName.c_str()); return false; } - if (bundleInfo.applicationInfo.allowEnableNotification) { - return true; + for (auto abilityInfo : bundleInfo.abilityInfos) { + if (abilityInfo.isStageBasedModel) { + return false; + } } - return false; + return true; } bool BundleManagerHelper::GetBundleInfoByBundleName( -- Gitee From e1783ab0de54b8540c328542e849570c942382fc Mon Sep 17 00:00:00 2001 From: luojingsong <9077954+songbao1@user.noreply.gitee.com> Date: Fri, 13 Sep 2024 09:39:53 +0000 Subject: [PATCH 3/3] update services/ans/src/bundle_manager_helper.cpp. Signed-off-by: luojingsong <9077954+songbao1@user.noreply.gitee.com> --- services/ans/src/bundle_manager_helper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/ans/src/bundle_manager_helper.cpp b/services/ans/src/bundle_manager_helper.cpp index 4e0809fd0..8c6932d1a 100644 --- a/services/ans/src/bundle_manager_helper.cpp +++ b/services/ans/src/bundle_manager_helper.cpp @@ -96,12 +96,12 @@ bool BundleManagerHelper::CheckApiCompatibility(const std::string &bundleName, c bundleName.c_str()); return false; } + for (auto abilityInfo : bundleInfo.abilityInfos) { if (abilityInfo.isStageBasedModel) { return false; } } - return true; } -- Gitee