diff --git a/bundle.json b/bundle.json index c72a2822c99471881ebb443d0c7b9f13ccfa1b37..51db2f1a62a52d3ee05efd344fc36e4339258003 100644 --- a/bundle.json +++ b/bundle.json @@ -47,6 +47,9 @@ ], "rom": "3000KB", "ram": "16000KB", + "hisysevent_config":[ + "//base/notification/ans_standard/hisysevent.yaml" + ], "deps": { "components": [ "ability_base", diff --git a/frameworks/ans/core/BUILD.gn b/frameworks/ans/core/BUILD.gn index 94578456f0960fd25fa6397b96ad82d08a0ebdce..7bd9fda06f10c30588950c38bc99f5f62c75763a 100644 --- a/frameworks/ans/core/BUILD.gn +++ b/frameworks/ans/core/BUILD.gn @@ -97,6 +97,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/ans/core/src/ans_manager_death_recipient.cpp b/frameworks/ans/core/src/ans_manager_death_recipient.cpp index eaf6498b41cb681b0a28e33d34801c8c461e5ff6..27775e023c527c9718331afd929546143c995291 100644 --- a/frameworks/ans/core/src/ans_manager_death_recipient.cpp +++ b/frameworks/ans/core/src/ans_manager_death_recipient.cpp @@ -13,15 +13,25 @@ * limitations under the License. */ +#include +#include + #include "ans_manager_death_recipient.h" #include "ans_log_wrapper.h" #include "ans_notification.h" +#include "hisysevent.h" #include "singleton.h" namespace OHOS { namespace Notification { void AnsManagerDeathRecipient::OnRemoteDied(const wptr &remote) { + std::string eventType = "ANS_SERVICE_DIED"; + OHOS::HiviewDFX::HiSysEvent::Write(OHOS::HiviewDFX::HiSysEvent::Domain::NOTIFICATION, eventType, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "UID", getuid(), + "PID", getpid()); + ANS_LOGE("Ans service died"); DelayedSingleton::GetInstance()->ResetAnsManagerProxy(); } diff --git a/frameworks/ans/core/src/ans_manager_proxy.cpp b/frameworks/ans/core/src/ans_manager_proxy.cpp index 36e84d34e55f610e6e949450078ddccab607827f..99091b751d45b61bffc85a9319cab371640c7969 100644 --- a/frameworks/ans/core/src/ans_manager_proxy.cpp +++ b/frameworks/ans/core/src/ans_manager_proxy.cpp @@ -13,10 +13,14 @@ * limitations under the License. */ +#include +#include + #include "ans_manager_proxy.h" #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" @@ -68,6 +72,12 @@ ErrCode AnsManagerProxy::Publish(const std::string &label, const sptr &subscriber, const return ERR_ANS_PARCELABLE_FAILED; } + std::string eventType = "ANS_SUBSCRIBE"; + OHOS::HiviewDFX::HiSysEvent::Write(OHOS::HiviewDFX::HiSysEvent::Domain::NOTIFICATION, eventType, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "UID", getuid(), + "PID", getpid()); + return result; } diff --git a/hisysevent.yaml b/hisysevent.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dc5400c1a4dc2bd4f2a0df63ce8cab85c288885d --- /dev/null +++ b/hisysevent.yaml @@ -0,0 +1,30 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +domain: NOTIFICATION + +ANS_SERVICE_DIED: + __BASE: {type: FAULT, level: CRITICAL, tag: ANS, desc: ans service died} + PID: {type: INT32, desc: pid} + UID: {type: INT32, desc: uid} + +ANS_PUBLISH: + __BASE: {type: FAULT, level: CRITICAL, tag: ANS, desc: ans publish} + PID: {type: INT32, desc: pid} + UID: {type: INT32, desc: uid} + +ANS_SUBSCRIBE: + __BASE: {type: FAULT, level: CRITICAL, tag: ANS, desc: ans subscribe} + PID: {type: INT32, desc: pid} + UID: {type: INT32, desc: uid} +