diff --git a/bundle.json b/bundle.json index dcba3a976c1823f32d953774ec56bd805454020e..64d67e5d7106cc09c5afe289deca47f21344ce5a 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 99e192bbbeabae501f3f462efe7d2340c49251d0..a6364c4d5d98ac9a0082d94b17357031fdf446e6 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 f74042b09ca5c24ffdc1eef736f91952eb356314..2fb48928eb981a101980de278332daf2e16f6cea 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 eaf6498b41cb681b0a28e33d34801c8c461e5ff6..37e9069ae2ea038c12a26df23c32cec32e2db570 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 c97236d376ca9bddd35cb50b451ebc466ee4c135..be0e0028c6039a174c3f4e6825d7c7eafbf8e98b 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