From db795cada5129d0021f0152a0144e995f319c5d6 Mon Sep 17 00:00:00 2001 From: xuezhongzhu Date: Fri, 10 Jun 2022 16:37:50 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo=EF=BC=9A#I561J4:hisysevent=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E4=BA=8B=E4=BB=B6=E6=89=93=E7=82=B9:hisysevent?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=BA=8B=E4=BB=B6=E6=89=93=E7=82=B9:hisyseve?= =?UTF-8?q?nt=E7=B3=BB=E7=BB=9F=E4=BA=8B=E4=BB=B6=E6=89=93=E7=82=B9=20Desc?= =?UTF-8?q?ription:=20hisysevent=E7=B3=BB=E7=BB=9F=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=89=93=E7=82=B9=20Feature=20or=20Bugfix:=20Bugfix=20Binary?= =?UTF-8?q?=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuezhongzhu Change-Id: I75274892a92279919e29b3def9befb509f6fe6df --- bundle.json | 3 ++ frameworks/core/BUILD.gn | 1 + .../core/common/include/ans_const_define.h | 1 + .../core/src/ans_manager_death_recipient.cpp | 15 +++++++++- frameworks/core/src/ans_manager_proxy.cpp | 23 ++++++++++++++- hisysevent.yaml | 29 +++++++++++++++++++ 6 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 hisysevent.yaml diff --git a/bundle.json b/bundle.json index dcba3a976..64d67e5d7 100644 --- a/bundle.json +++ b/bundle.json @@ -48,6 +48,9 @@ ], "rom": "3000KB", "ram": "16000KB", + "hisysevent_config":[ + "//base/notification/distributed_notification_service/hisysevent.yaml" + ], "deps": { "components": [ "ability_base", diff --git a/frameworks/core/BUILD.gn b/frameworks/core/BUILD.gn index 99e192bbb..a6364c4d5 100644 --- a/frameworks/core/BUILD.gn +++ b/frameworks/core/BUILD.gn @@ -93,6 +93,7 @@ ohos_shared_library("ans_core") { "bundle_framework:appexecfwk_base", "eventhandler:libeventhandler", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "multimedia_image_standard:image_native", diff --git a/frameworks/core/common/include/ans_const_define.h b/frameworks/core/common/include/ans_const_define.h index f74042b09..2fb48928e 100644 --- a/frameworks/core/common/include/ans_const_define.h +++ b/frameworks/core/common/include/ans_const_define.h @@ -25,6 +25,7 @@ namespace OHOS { namespace Notification { // Max active notification number +constexpr int32_t DH_ANS_SUCCESS = 0; constexpr size_t MAX_ACTIVE_NUM = 1000; constexpr uint32_t MAX_ACTIVE_NUM_PERAPP = 100; constexpr uint32_t MAX_ACTIVE_NUM_PERSECOND = 10; diff --git a/frameworks/core/src/ans_manager_death_recipient.cpp b/frameworks/core/src/ans_manager_death_recipient.cpp index eaf6498b4..37e9069ae 100644 --- a/frameworks/core/src/ans_manager_death_recipient.cpp +++ b/frameworks/core/src/ans_manager_death_recipient.cpp @@ -13,15 +13,28 @@ * limitations under the License. */ -#include "ans_manager_death_recipient.h" +#include + +#include "ans_const_define.h" #include "ans_log_wrapper.h" #include "ans_notification.h" +#include "hisysevent.h" #include "singleton.h" +#include "ans_manager_death_recipient.h" namespace OHOS { namespace Notification { void AnsManagerDeathRecipient::OnRemoteDied(const wptr &remote) { + std::string eventType = "ANS_SERVICE_DIED"; + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + HiviewDFX::HiSysEvent::Domain::NOTIFICATION, eventType, + HiviewDFX::HiSysEvent::EventType::FAULT, + "UID", getuid(), + "PID", getpid()); + if (res != DH_ANS_SUCCESS) { + ANS_LOGE("Write HiSysEvent error, res:%d", res); + } ANS_LOGE("Ans service died"); DelayedSingleton::GetInstance()->ResetAnsManagerProxy(); } diff --git a/frameworks/core/src/ans_manager_proxy.cpp b/frameworks/core/src/ans_manager_proxy.cpp index c97236d37..be0e0028c 100644 --- a/frameworks/core/src/ans_manager_proxy.cpp +++ b/frameworks/core/src/ans_manager_proxy.cpp @@ -13,16 +13,19 @@ * limitations under the License. */ -#include "ans_manager_proxy.h" +#include + #include "ans_const_define.h" #include "ans_inner_errors.h" #include "ans_log_wrapper.h" +#include "hisysevent.h" #include "message_option.h" #include "message_parcel.h" #include "parcel.h" #include "reminder_request_alarm.h" #include "reminder_request_calendar.h" #include "reminder_request_timer.h" +#include "ans_manager_proxy.h" namespace OHOS { namespace Notification { @@ -68,6 +71,15 @@ ErrCode AnsManagerProxy::Publish(const std::string &label, const sptr