diff --git a/services/ans/BUILD.gn b/services/ans/BUILD.gn index 12c62d3079d00a2f0828f1a3df7197bd455b9da4..1f7d6b6f3e6136126d074ec8cb2ecf949fab4838 100644 --- a/services/ans/BUILD.gn +++ b/services/ans/BUILD.gn @@ -73,6 +73,7 @@ ohos_shared_library("libans") { "ability_runtime:abilitykit_native", "ability_runtime:app_manager", "distributeddatamgr:distributeddata_inner", + "hicollie_native:libhicollie", "multimedia_image_standard:image_native", "multimedia_media_standard:media_client", "os_account_standard:os_account_innerkits", diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 23a9dfef737913ab0c5cff9f425d96f5981afbb0..0f9e1e6355b937245660987a437377c40b134edb 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -36,6 +36,7 @@ #include "reminder_data_manager.h" #include "trigger_info.h" #include "want_agent_helper.h" +#include "xcollie/watchdog.h" #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED #include "distributed_notification_manager.h" @@ -224,6 +225,12 @@ AdvancedNotificationService::AdvancedNotificationService() { runner_ = OHOS::AppExecFwk::EventRunner::Create(); handler_ = std::make_shared(runner_); + std::string threadName = handler_->GetEventRunner()->GetRunnerThreadName(); + unsigned int timeval = 5000; + Singleton::GetInstance().AddThread(threadName, handler_, timeval); + if (Singleton::GetInstance().AddThread(threadName, handler_, timeval) != 0) { + ANS_LOGE("AdvancedNotificationService Failed to Add handeler Thread"); + } recentInfo_ = std::make_shared(); distributedKvStoreDeathRecipient_ = std::make_shared( std::bind(&AdvancedNotificationService::OnDistributedKvStoreDeathRecipient, this)); diff --git a/services/ans/src/notification_subscriber_manager.cpp b/services/ans/src/notification_subscriber_manager.cpp index 68b11af00da9aba63758f3230bfb6df774dd44fe..d739c4b07bb8bf10110a42c5741f5551cc49e821 100644 --- a/services/ans/src/notification_subscriber_manager.cpp +++ b/services/ans/src/notification_subscriber_manager.cpp @@ -25,6 +25,7 @@ #include "ipc_skeleton.h" #include "os_account_manager.h" #include "remote_death_recipient.h" +#include "xcollie/watchdog.h" namespace OHOS { namespace Notification { @@ -39,6 +40,12 @@ NotificationSubscriberManager::NotificationSubscriberManager() { runner_ = OHOS::AppExecFwk::EventRunner::Create(); handler_ = std::make_shared(runner_); + std::string threadName = handler_->GetEventRunner()->GetRunnerThreadName(); + unsigned int timeval = 5000; + Singleton::GetInstance().AddThread(threadName, handler_, timeval); + if (Singleton::GetInstance().AddThread(threadName, handler_, timeval) != 0) { + ANS_LOGE("NotificationSubscriberManager Failed to Add handeler Thread"); + } recipient_ = new RemoteDeathRecipient(std::bind(&NotificationSubscriberManager::OnRemoteDied, this, std::placeholders::_1)); } diff --git a/services/ans/test/unittest/BUILD.gn b/services/ans/test/unittest/BUILD.gn index 213e21b9c42b6745f44d525c2f80e132375096c7..5e6d0225f28f22cae9749581387f92ff98799e7e 100644 --- a/services/ans/test/unittest/BUILD.gn +++ b/services/ans/test/unittest/BUILD.gn @@ -84,6 +84,7 @@ ohos_unittest("ans_unit_test") { "distributeddatamgr:distributeddata_inner", "dmsfwk_standard:zuri", "eventhandler:libeventhandler", + "hicollie_native:libhicollie", "hitrace_native:libhitrace", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/distributed/BUILD.gn b/services/distributed/BUILD.gn index 337764a8b9a503fbd1e3e9c34bf50fb8205154ae..d8f25460fc3f7d7597599db7421b032b49400fef 100644 --- a/services/distributed/BUILD.gn +++ b/services/distributed/BUILD.gn @@ -49,6 +49,7 @@ ohos_shared_library("libans_distributed") { "distributeddatamgr:distributeddata_inner", "dmsfwk_standard:zuri", "eventhandler:libeventhandler", + "hicollie_native:libhicollie", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "multimedia_image_standard:image_native", diff --git a/services/distributed/src/distributed_notification_manager.cpp b/services/distributed/src/distributed_notification_manager.cpp index be2dba32af65c19d111c4783ef1904f6560a2528..619ab445be505155f9b354dbe39147a45a5519c5 100644 --- a/services/distributed/src/distributed_notification_manager.cpp +++ b/services/distributed/src/distributed_notification_manager.cpp @@ -19,6 +19,7 @@ #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "xcollie/watchdog.h" namespace OHOS { namespace Notification { @@ -30,6 +31,12 @@ DistributedNotificationManager::DistributedNotificationManager() { runner_ = OHOS::AppExecFwk::EventRunner::Create(); handler_ = std::make_shared(runner_); + std::string threadName = handler_->GetEventRunner()->GetRunnerThreadName(); + unsigned int timeval = 5000; + Singleton::GetInstance().AddThread(threadName, handler_, timeval); + if (Singleton::GetInstance().AddThread(threadName, handler_, timeval) != 0) { + ANS_LOGE("DistributedNotificationManager Failed to Add handeler Thread"); + } DistributedDatabaseCallback::IDatabaseChange databaseCallback = { .OnInsert = std::bind(&DistributedNotificationManager::OnDatabaseInsert, diff --git a/services/distributed/test/unittest/BUILD.gn b/services/distributed/test/unittest/BUILD.gn index df3f579e28736f902386803132c5b84f9325f3bb..bccff5000edbc48957f5ba5679f56a0dddec9926 100644 --- a/services/distributed/test/unittest/BUILD.gn +++ b/services/distributed/test/unittest/BUILD.gn @@ -71,6 +71,7 @@ ohos_unittest("ans_distributed_unit_test") { "ability_base:want", "bundle_framework:appexecfwk_base", "distributeddatamgr:distributeddata_inner", + "hicollie_native:libhicollie", "dmsfwk_standard:zuri", "hitrace_native:libhitrace", "hiviewdfx_hilog_native:libhilog", diff --git a/services/test/moduletest/BUILD.gn b/services/test/moduletest/BUILD.gn index b794fb12953be540056ee4489e587ccb947bd73e..4c499360da51be5d48c405e79435847d4ea0cfa6 100644 --- a/services/test/moduletest/BUILD.gn +++ b/services/test/moduletest/BUILD.gn @@ -71,6 +71,7 @@ ohos_moduletest("ans_module_test") { "distributeddatamgr:distributeddata_inner", "dmsfwk_standard:zuri", "eventhandler:libeventhandler", + "hicollie_native:libhicollie", "hitrace_native:libhitrace", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core",