From 446450dd69f46c5ea43b9ce1df6bf4fb4640eee2 Mon Sep 17 00:00:00 2001 From: liuyanzhi Date: Fri, 11 Feb 2022 14:40:40 +0800 Subject: [PATCH] add ans hicollie Signed-off-by: liuyanzhi Change-Id: Ib8793b14acd2d68d52b078afeccb7df48c6608c6 --- services/ans/BUILD.gn | 1 + services/ans/src/advanced_notification_service.cpp | 7 +++++++ services/ans/src/notification_subscriber_manager.cpp | 7 +++++++ services/ans/test/unittest/BUILD.gn | 1 + services/distributed/BUILD.gn | 1 + .../distributed/src/distributed_notification_manager.cpp | 7 +++++++ services/distributed/test/unittest/BUILD.gn | 1 + services/test/moduletest/BUILD.gn | 1 + 8 files changed, 26 insertions(+) diff --git a/services/ans/BUILD.gn b/services/ans/BUILD.gn index 12c62d307..1f7d6b6f3 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 494a045a0..a83e0cdc5 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" @@ -227,6 +228,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 0307d32ce..10f33a5d5 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 3e976bf56..8b4a465b9 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 22c67f691..9a4a36cc6 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 be2dba32a..619ab445b 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 934c13331..6d212afc9 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_runtime:want", "bundle_framework:appexecfwk_base", "distributeddatamgr:distributeddata_inner", + "hicollie_native:libhicollie", "hitrace_native:libhitrace", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/test/moduletest/BUILD.gn b/services/test/moduletest/BUILD.gn index f4bcd539c..d3cfbf743 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", -- Gitee