From 77decc4018c75fc9e623e6964affd80fba6efc4a Mon Sep 17 00:00:00 2001 From: xuezhongzhu Date: Fri, 6 May 2022 16:31:32 +0800 Subject: [PATCH] Signed-off-by: xuezhongzhu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IssueNo:#I561J4:hisysevent系统事件打点 Description: hisysevent系统事件打点 Feature or Bugfix: Bugfix Binary Source: No Change-Id: Ib6955b4287c8c96e2d611dc46294366008435b61 --- bundle.json | 3 ++ frameworks/ans/core/BUILD.gn | 1 + .../core/src/ans_manager_death_recipient.cpp | 10 +++++++ frameworks/ans/core/src/ans_manager_proxy.cpp | 16 ++++++++++ hisysevent.yaml | 30 +++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 hisysevent.yaml diff --git a/bundle.json b/bundle.json index c72a2822c..51db2f1a6 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 94578456f..7bd9fda06 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 eaf6498b4..27775e023 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 36e84d34e..99091b751 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 000000000..dc5400c1a --- /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} + -- Gitee