diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index 8de5bc0fe85d77b2b92e32a814f080b8f3b9a7d7..7028d76574907f1d6e73157ebdf6d1b264d95fbd 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -1887,6 +1887,9 @@ ErrCode AnsNotification::SetBadgeNumberForDhByBundle( return ERR_ANS_INVALID_PARAM; } + ANS_LOGI("SetBadgeNumberForDhByBundle, info:%{public}s %{public}d %{public}d", + bundleOption.GetBundleName().c_str(), bundleOption.GetUid(), badgeNumber); + sptr proxy = GetAnsManagerProxy(); if (!proxy) { ANS_LOGE("Unable to connect to ANS service."); diff --git a/services/ans/include/notification_clone_manager.h b/services/ans/include/notification_clone_manager.h index c417cee30ab7a681d604e2645d2c4e50a92d7505..26832710752c9c0f1b481fdd59c7054ac8d5974f 100644 --- a/services/ans/include/notification_clone_manager.h +++ b/services/ans/include/notification_clone_manager.h @@ -58,7 +58,7 @@ private: void RemoveBackUpFile(); ErrCode LoadConfig(UniqueFd &fd, std::string& config); ErrCode SaveConfig(const std::string& config); - std::map> cloneTemplates; + std::vector>> cloneTemplates; std::shared_ptr restoreStartEventSubscriber_ = nullptr; }; } // namespace Notification diff --git a/services/ans/src/clone/dh_notification_clone_bundle_service.cpp b/services/ans/src/clone/dh_notification_clone_bundle_service.cpp index d24f7c7dccaba10ec5a3d258b189c3364287cd9d..0e93e2a5f7bd8d3d874f97e77336182555d2e433 100644 --- a/services/ans/src/clone/dh_notification_clone_bundle_service.cpp +++ b/services/ans/src/clone/dh_notification_clone_bundle_service.cpp @@ -80,7 +80,7 @@ void DhNotificationCloneBundle::OnRestore(const nlohmann::json &jsonObject) bundlesInfo_.clear(); } for (const auto &profile : jsonObject) { - NotificationCloneBundleInfo cloneBundleInfo;; + NotificationCloneBundleInfo cloneBundleInfo; cloneBundleInfo.FromJson(profile); bundlesInfo_.emplace_back(cloneBundleInfo); } diff --git a/services/ans/src/clone/notification_clone_bundle_service.cpp b/services/ans/src/clone/notification_clone_bundle_service.cpp index 782efe7b07dadb4c42a5a6c6325336d0ae80e743..9bdf7f60bb226621ff937103a895d993aa67a9cb 100644 --- a/services/ans/src/clone/notification_clone_bundle_service.cpp +++ b/services/ans/src/clone/notification_clone_bundle_service.cpp @@ -81,7 +81,7 @@ void NotificationCloneBundle::OnRestore(const nlohmann::json &jsonObject) bundlesInfo_.clear(); } for (const auto &profile : jsonObject) { - NotificationCloneBundleInfo cloneBundleInfo;; + NotificationCloneBundleInfo cloneBundleInfo; cloneBundleInfo.FromJson(profile); bundlesInfo_.emplace_back(cloneBundleInfo); } diff --git a/services/ans/src/clone/notification_clone_manager.cpp b/services/ans/src/clone/notification_clone_manager.cpp index 1f70958c35313cd78f985f80ae51727060089091..420b60b52eb16c6f07330832ad74464dc77649bd 100644 --- a/services/ans/src/clone/notification_clone_manager.cpp +++ b/services/ans/src/clone/notification_clone_manager.cpp @@ -192,9 +192,10 @@ int32_t NotificationCloneManager::OnRestore(MessageParcel& data, MessageParcel& NotificationCloneManager::NotificationCloneManager() { ANS_LOGI("Notification clone manager init."); - cloneTemplates.insert_or_assign(CLONE_ITEM_BUNDLE_INFO, NotificationCloneBundle::GetInstance()); - cloneTemplates.insert_or_assign(DH_CLONE_ITEM_BUNDLE_INFO, DhNotificationCloneBundle::GetInstance()); - cloneTemplates.insert_or_assign(CLONE_ITEM_DISTURB, NotificationCloneDisturb::GetInstance()); + // not change push sequence, ensure [clone item] before [dh clone item] + cloneTemplates.push_back(std::make_pair(CLONE_ITEM_BUNDLE_INFO, NotificationCloneBundle::GetInstance())); + cloneTemplates.push_back(std::make_pair(DH_CLONE_ITEM_BUNDLE_INFO, DhNotificationCloneBundle::GetInstance())); + cloneTemplates.push_back(std::make_pair(CLONE_ITEM_DISTURB, NotificationCloneDisturb::GetInstance())); restoreStartEventSubscriber_ = AncoRestoreStartEventSubscriber::create(); if (!EventFwk::CommonEventManager::SubscribeCommonEvent(restoreStartEventSubscriber_)) {