diff --git a/bundle.json b/bundle.json index b427b7ff..a0a49ff5 100644 --- a/bundle.json +++ b/bundle.json @@ -33,6 +33,7 @@ "distributeddatamgr_appdatamgr", "dsoftbus_standard", "form_runtime", + "hisysevent_native", "hiviewdfx_hilog_native", "ipc", "dataability", diff --git a/form_runtime/BUILD.gn b/form_runtime/BUILD.gn index 08d1179a..4a92ba4d 100644 --- a/form_runtime/BUILD.gn +++ b/form_runtime/BUILD.gn @@ -98,6 +98,7 @@ ohos_shared_library("libfms") { "distributeddatamgr:distributeddata_inner", "eventhandler:libeventhandler", "form_runtime:form_manager", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/form_runtime/hisysevent.yaml b/form_runtime/hisysevent.yaml new file mode 100644 index 00000000..e9ef7627 --- /dev/null +++ b/form_runtime/hisysevent.yaml @@ -0,0 +1,68 @@ +# 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: AAFWK + +# form behavior event + +ADD_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +REQUEST_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +DELETE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + +CASTTEMP_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + +ACQUIREFORMSTATE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +MESSAGE_EVENT_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +ROUTE_EVENT_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +RELEASE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + +DELETE_INVALID_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + +SET_NEXT_REFRESH_TIME_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} + FORM_ID: {type: INT64, desc: formId} \ No newline at end of file diff --git a/form_runtime/services/src/form_mgr_service.cpp b/form_runtime/services/src/form_mgr_service.cpp index f5b0f86e..43fb72de 100644 --- a/form_runtime/services/src/form_mgr_service.cpp +++ b/form_runtime/services/src/form_mgr_service.cpp @@ -40,6 +40,8 @@ #include "permission_verification.h" #include "string_ex.h" #include "system_ability_definition.h" +#include "event_report.h" +#include "hisysevent.h" namespace OHOS { namespace AppExecFwk { @@ -91,6 +93,12 @@ int FormMgrService::AddForm(const int64_t formId, const Want &want, const sptr &callerToken, FormJsInfo &formInfo) { ErrCode ret = CheckFormPermission(); + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, HiSysEventType::BEHAVIOR, eventInfo); if (ret != ERR_OK) { HILOG_ERROR("%{public}s fail, add form permission denied", __func__); return ret; @@ -111,6 +119,9 @@ int FormMgrService::DeleteForm(const int64_t formId, const sptr & HILOG_ERROR("%{public}s fail, delete form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteForm(formId, callerToken); } @@ -129,6 +140,9 @@ int FormMgrService::ReleaseForm(const int64_t formId, const sptr HILOG_ERROR("%{public}s fail, release form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::RELEASE_FORM, HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().ReleaseForm(formId, callerToken, delCache); } @@ -173,6 +187,12 @@ int FormMgrService::RequestForm(const int64_t formId, const sptr HILOG_ERROR("%{public}s fail, request form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RequestForm(formId, callerToken, want); } @@ -187,6 +207,10 @@ int FormMgrService::RequestForm(const int64_t formId, const sptr int FormMgrService::SetNextRefreshTime(const int64_t formId, const int64_t nextTime) { HILOG_INFO("%{public}s called.", __func__); + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::SET_NEXT_REFRESH_TIME_FORM, + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().SetNextRefreshTime(formId, nextTime); } @@ -266,6 +290,10 @@ int FormMgrService::CastTempForm(const int64_t formId, const sptr HILOG_ERROR("%{public}s fail, cast temp form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::CASTTEMP_FORM, + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().CastTempForm(formId, callerToken); } @@ -348,6 +376,12 @@ int FormMgrService::MessageEvent(const int64_t formId, const Want &want, const s HILOG_ERROR("%{public}s fail, request form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::MESSAGE_EVENT_FORM, + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().MessageEvent(formId, want, callerToken); } @@ -365,6 +399,13 @@ int FormMgrService::RouterEvent(const int64_t formId, Want &want) HILOG_ERROR("%{public}s fail, request form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RouterEvent(formId, want); } @@ -536,6 +577,9 @@ int FormMgrService::DeleteInvalidForms(const std::vector &formIds, cons HILOG_ERROR("%{public}s fail, delete form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -554,6 +598,12 @@ int FormMgrService::AcquireFormState(const Want &want, const sptr HILOG_ERROR("%{public}s fail, acquire form state permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().AcquireFormState(want, callerToken, stateInfo); } diff --git a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp index 4a8f9867..82c1f2d2 100644 --- a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp +++ b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp @@ -125,6 +125,7 @@ ErrCode AbilityContextImpl::StartAbilityWithAccount(const AAFwk::Want &want, int ErrCode AbilityContextImpl::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions, int requestCode) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("AbilityContextImpl::StartAbility. Start calling StartAbility."); ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_, requestCode); HILOG_INFO("AbilityContextImpl::StartAbility. End calling StartAbility. ret=%{public}d", err); @@ -239,6 +240,7 @@ void AbilityContextImpl::OnAbilityResult(int requestCode, int resultCode, const bool AbilityContextImpl::ConnectAbility(const AAFwk::Want &want, const sptr &connectCallback) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Connect ability begin, ability:%{public}s.", abilityInfo_ == nullptr ? "" : abilityInfo_->name.c_str()); ErrCode ret = @@ -260,6 +262,7 @@ bool AbilityContextImpl::ConnectAbilityWithAccount(const AAFwk::Want &want, int void AbilityContextImpl::DisconnectAbility(const AAFwk::Want &want, const sptr &connectCallback) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Disconnect ability begin, caller:%{public}s.", abilityInfo_ == nullptr ? "" : abilityInfo_->name.c_str()); ErrCode ret = @@ -347,6 +350,7 @@ ErrCode AbilityContextImpl::TerminateSelf() ErrCode AbilityContextImpl::CloseAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("%{public}s begin.", __func__); isTerminating_ = true; AAFwk::Want resultWant; diff --git a/frameworks/kits/ability/native/src/ability.cpp b/frameworks/kits/ability/native/src/ability.cpp index 4361d1d1..ca1c3705 100644 --- a/frameworks/kits/ability/native/src/ability.cpp +++ b/frameworks/kits/ability/native/src/ability.cpp @@ -1296,6 +1296,7 @@ ErrCode Ability::StartAbility(const Want &want) */ ErrCode Ability::TerminateAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("%{public}s begin.", __func__); return AbilityContext::TerminateAbility(); } diff --git a/frameworks/kits/ability/native/src/ability_context.cpp b/frameworks/kits/ability/native/src/ability_context.cpp index 068fc72b..cc3c4024 100644 --- a/frameworks/kits/ability/native/src/ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_context.cpp @@ -26,6 +26,7 @@ #include "resource_manager.h" #include "sys_mgr_client.h" #include "system_ability_definition.h" +#include "hitrace_meter.h" namespace OHOS { namespace AppExecFwk { @@ -169,6 +170,7 @@ std::shared_ptr AbilityContext::GetCallingAbility() bool AbilityContext::ConnectAbility(const Want &want, const sptr &conn) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); AppExecFwk::AbilityType type = GetAbilityInfoType(); std::shared_ptr abilityInfo = GetAbilityInfo(); @@ -196,6 +198,7 @@ bool AbilityContext::ConnectAbility(const Want &want, const sptr &conn) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); std::shared_ptr info = GetAbilityInfo(); HILOG_INFO("Disconnect ability begin, caller:%{public}s.", info == nullptr ? "" : info->name.c_str()); diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index 3400967b..094ea34b 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -34,6 +34,7 @@ #include "string_wrapper.h" #include "context/context.h" #include "context/application_context.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { @@ -119,6 +120,7 @@ void JsAbility::Init(const std::shared_ptr &abilityInfo, void JsAbility::OnStart(const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStart begin, ability is %{public}s.", GetAbilityName().c_str()); Ability::OnStart(want); @@ -163,6 +165,7 @@ void JsAbility::OnStart(const Want &want) void JsAbility::OnStop() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); Ability::OnStop(); CallObjectMethod("onDestroy"); @@ -190,6 +193,7 @@ const std::string PAGE_STACK_PROPERTY_NAME = "pageStack"; void JsAbility::OnSceneCreated() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnSceneCreated begin, ability is %{public}s.", GetAbilityName().c_str()); Ability::OnSceneCreated(); auto jsAppWindowStage = CreateAppWindowStage(); @@ -255,6 +259,7 @@ void JsAbility::onSceneDestroyed() void JsAbility::OnForeground(const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnForeground begin, ability is %{public}s.", GetAbilityName().c_str()); Ability::OnForeground(want); @@ -290,6 +295,7 @@ void JsAbility::OnForeground(const Want &want) void JsAbility::OnBackground() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); Ability::OnBackground(); CallObjectMethod("onBackground"); diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp index 1a696f94..07bc6b66 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp @@ -30,6 +30,7 @@ #include "start_options.h" #include "want.h" #include "event_handler.h" +#include "hitrace_meter.h" #ifdef SUPPORT_GRAPHICS #include "pixel_map_napi.h" @@ -130,6 +131,7 @@ NativeValue* JsAbilityContext::ConnectAbilityWithAccount(NativeEngine* engine, N NativeValue* JsAbilityContext::DisconnectAbility(NativeEngine* engine, NativeCallbackInfo* info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); JsAbilityContext* me = CheckParamsAndGetThis(engine, info); return (me != nullptr) ? me->OnDisconnectAbility(*engine, *info) : nullptr; } @@ -166,6 +168,7 @@ NativeValue* JsAbilityContext::IsTerminating(NativeEngine* engine, NativeCallbac NativeValue* JsAbilityContext::OnStartAbility(NativeEngine& engine, NativeCallbackInfo& info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStartAbility is called."); if (info.argc == ARGC_ZERO) { @@ -700,6 +703,7 @@ NativeValue* JsAbilityContext::OnTerminateSelfWithResult(NativeEngine& engine, N NativeValue* JsAbilityContext::OnConnectAbility(NativeEngine& engine, NativeCallbackInfo& info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Connect ability called."); // only support two params if (info.argc != ARGC_TWO) { diff --git a/frameworks/kits/ability/native/src/ability_thread.cpp b/frameworks/kits/ability/native/src/ability_thread.cpp index 1a2b1ed8..e5bf8235 100644 --- a/frameworks/kits/ability/native/src/ability_thread.cpp +++ b/frameworks/kits/ability/native/src/ability_thread.cpp @@ -792,6 +792,7 @@ void AbilityThread::ScheduleConnectAbility(const Want &want) */ void AbilityThread::ScheduleDisconnectAbility(const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Schedule disconnect ability begin, isExtension:%{public}d.", isExtension_); wptr weak = this; auto task = [weak, want]() { @@ -1177,6 +1178,7 @@ void AbilityThread::AbilityThreadMain(std::shared_ptr &applicat const std::shared_ptr &abilityRecord, const std::shared_ptr &mainRunner, const std::shared_ptr &stageContext) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("AbilityThread main start."); sptr thread = sptr(new (std::nothrow) AbilityThread()); if (thread == nullptr) { @@ -1202,6 +1204,7 @@ void AbilityThread::AbilityThreadMain( std::shared_ptr &application, const std::shared_ptr &abilityRecord, const std::shared_ptr &stageContext) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("AbilityThread main start."); sptr thread = sptr(new (std::nothrow) AbilityThread()); if (thread == nullptr || abilityRecord == nullptr) { diff --git a/frameworks/kits/ability/native/src/extension.cpp b/frameworks/kits/ability/native/src/extension.cpp index e4531ae8..359b895a 100644 --- a/frameworks/kits/ability/native/src/extension.cpp +++ b/frameworks/kits/ability/native/src/extension.cpp @@ -19,6 +19,7 @@ #include "configuration.h" #include "extension_context.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { @@ -40,6 +41,7 @@ void Extension::Init(const std::shared_ptr &reco void Extension::OnStart(const AAFwk::Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStart begin, extension:%{public}s.", abilityInfo_->name.c_str()); SetLaunchWant(want); SetLastRequestWant(want); @@ -54,6 +56,7 @@ void Extension::OnStop() sptr Extension::OnConnect(const AAFwk::Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnConnect begin, extension:%{public}s.", abilityInfo_->name.c_str()); HILOG_INFO("OnConnect end, extension:%{public}s.", abilityInfo_->name.c_str()); return nullptr; @@ -61,6 +64,7 @@ sptr Extension::OnConnect(const AAFwk::Want &want) void Extension::OnDisconnect(const AAFwk::Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnDisconnect begin, extension:%{public}s.", abilityInfo_->name.c_str()); HILOG_INFO("OnDisconnect end, extension:%{public}s.", abilityInfo_->name.c_str()); } diff --git a/frameworks/kits/ability/native/src/js_service_extension_context.cpp b/frameworks/kits/ability/native/src/js_service_extension_context.cpp index d05f76ca..a9b660c7 100644 --- a/frameworks/kits/ability/native/src/js_service_extension_context.cpp +++ b/frameworks/kits/ability/native/src/js_service_extension_context.cpp @@ -28,6 +28,7 @@ #include "napi_remote_object.h" #include "napi_common_start_options.h" #include "start_options.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { @@ -118,6 +119,7 @@ private: std::weak_ptr context_; NativeValue* OnStartAbility(NativeEngine& engine, NativeCallbackInfo& info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStartAbility is called"); // only support one or two or three params if (info.argc != ARGC_ONE && info.argc != ARGC_TWO && info.argc != ARGC_THREE) { diff --git a/frameworks/kits/ability/native/src/page_ability_impl.cpp b/frameworks/kits/ability/native/src/page_ability_impl.cpp index 436ff06d..855e6d8e 100644 --- a/frameworks/kits/ability/native/src/page_ability_impl.cpp +++ b/frameworks/kits/ability/native/src/page_ability_impl.cpp @@ -15,6 +15,7 @@ #include "page_ability_impl.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AppExecFwk { @@ -28,6 +29,7 @@ using AbilityManagerClient = OHOS::AAFwk::AbilityManagerClient; */ void PageAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::LifeCycleStateInfo &targetState) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Handle ability transaction start, sourceState:%{public}d, targetState:%{public}d, " "isNewWant:%{public}d, sceneFlag:%{public}d.", lifecycleState_, diff --git a/frameworks/kits/ability/native/test/BUILD.gn b/frameworks/kits/ability/native/test/BUILD.gn index 99ab335c..a418d34b 100644 --- a/frameworks/kits/ability/native/test/BUILD.gn +++ b/frameworks/kits/ability/native/test/BUILD.gn @@ -298,6 +298,7 @@ ohos_unittest("page_ability_impl_test") { ] external_deps = [ + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "input:libmmi-client", "ipc:ipc_core", @@ -330,6 +331,7 @@ ohos_unittest("service_ability_impl_test") { ] external_deps = [ + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp b/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp index ecebd434..316b0f3f 100644 --- a/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp +++ b/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp @@ -18,6 +18,7 @@ #include "ability_connection.h" #include "ability_manager_client.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { @@ -26,6 +27,7 @@ int ServiceExtensionContext::ILLEGAL_REQUEST_CODE(-1); ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want) const { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str()); ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, ILLEGAL_REQUEST_CODE); if (err != ERR_OK) { @@ -36,6 +38,7 @@ ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want) const ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str()); ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_, ILLEGAL_REQUEST_CODE); diff --git a/frameworks/kits/appkit/native/app/src/main_thread.cpp b/frameworks/kits/appkit/native/app/src/main_thread.cpp index a0d911d2..8eac77c3 100644 --- a/frameworks/kits/appkit/native/app/src/main_thread.cpp +++ b/frameworks/kits/appkit/native/app/src/main_thread.cpp @@ -452,6 +452,7 @@ void MainThread::ScheduleAbilityStage(const HapModuleInfo &abilityStage) void MainThread::ScheduleLaunchAbility(const AbilityInfo &info, const sptr &token, const std::shared_ptr &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("MainThread schedule launch ability, name is %{public}s, type is %{public}d.", info.name.c_str(), info.type); diff --git a/hisysevent.yaml b/hisysevent.yaml index 17faea65..0b7e8511 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -44,4 +44,143 @@ THREAD_BLOCK_6S: UID: {type: INT32, desc: uid} PACKAGE_NAME: {type: STRING, desc: package name} PROCESS_NAME: {type: STRING, desc: process name} - MSG: {type: STRING, desc: application event message} \ No newline at end of file + MSG: {type: STRING, desc: application event message} + +# fault event + +START_ABILITY_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: start ability error} + ABILITY_NAME: {type: STRING, desc: ability name} + +TERMINATE_ABILITY_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: terminate ability error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +START_EXTENSION_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: start extensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +STOP_EXTENSION_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: stop extensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +CONNECT_SERVICE_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: connnect serviceExtensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +DISCONNECT_SERVICE_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: disconnect serviceExtensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +# ability behavior event + +START_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: start ability} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +DO_FOREGROUND_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: foreground ability} + SCENE_FLAG: {type: STRING, desc: scene flag} + +DO_BACKGROUND_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: background ability} + SCENE_FLAG: {type: STRING, desc: scene flag} + +CLOSE_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: close ability} + +TERMINATE_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: terminate ability} + +# serviceExtensionAbility behavior event + +START_SERVICE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: start serviceExtensionAbility} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + EXTENSION_TYPE: {type: STRING, desc: extension type} + +STOP_SERVICE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: stop serviceExtensionAbility} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + EXTENSION_TYPE: {type: STRING, desc: extension type} + +CONNECT_SERVICE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: connect serviceAbility} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} + ABILITY_NAME: {type: STRING, desc: ability name} + +DISCONNECT_SERVICE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: disconnect serviceAbility} + +# app behavior event + +APP_ATTACH: + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: attach app} + BUNDLE_NAME: {type: STRING, desc: bundle name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PID: {type: INT32, desc: pid} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_LAUNCH: + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: launch app} + BUNDLE_NAME: {type: STRING, desc: bundle name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PID: {type: INT32, desc: pid} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_FOREGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: foreground app} + BUNDLE_NAME: {type: STRING, desc: bundle name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PID: {type: INT32, desc: pid} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_BACKGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: background app} + BUNDLE_NAME: {type: STRING, desc: bundle name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PID: {type: INT32, desc: pid} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_TERMINATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: terminate app} + BUNDLE_NAME: {type: STRING, desc: bundle name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PID: {type: INT32, desc: pid} + TIME_STAMP: {type: INT32, desc: time stamp} \ No newline at end of file diff --git a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn index 5c386ad1..3bf8836c 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn +++ b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn @@ -52,6 +52,7 @@ ohos_shared_library("featureability") { "bundle_framework:appexecfwk_core", "dataability:native_dataability", "eventhandler:libeventhandler", + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "napi:ace_napi", diff --git a/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp b/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp index c0bce5e1..514d4f71 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp +++ b/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp @@ -25,6 +25,7 @@ #include "napi_context.h" #include "napi_data_ability_helper.h" #include "securec.h" +#include "hitrace_meter.h" using namespace OHOS::AAFwk; using namespace OHOS::AppExecFwk; @@ -1383,6 +1384,7 @@ napi_value NAPI_AcquireDataAbilityHelper(napi_env env, napi_callback_info info) */ napi_value NAPI_FAConnectAbility(napi_env env, napi_callback_info info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("FA connect ability called."); return NAPI_ConnectAbilityCommon(env, info, AbilityType::PAGE); } @@ -1397,6 +1399,7 @@ napi_value NAPI_FAConnectAbility(napi_env env, napi_callback_info info) */ napi_value NAPI_FADisConnectAbility(napi_env env, napi_callback_info info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("FA disconnect ability called."); return NAPI_DisConnectAbilityCommon(env, info, AbilityType::PAGE); } diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 8b86eeaf..6c9f6968 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -23,6 +23,7 @@ #include "iservice_registry.h" #include "string_ex.h" #include "system_ability_definition.h" +#include "hitrace_meter.h" namespace OHOS { namespace AAFwk { @@ -97,6 +98,7 @@ ErrCode AbilityManagerClient::ScheduleCommandAbilityDone(const sptrStartAbility(want, userId, requestCode); @@ -105,6 +107,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in ErrCode AbilityManagerClient::StartAbility( const Want &want, const sptr &callerToken, int requestCode, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Start ability come, ability:%{public}s, userId:%{public}d.", @@ -115,6 +118,7 @@ ErrCode AbilityManagerClient::StartAbility( ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartSetting &abilityStartSetting, const sptr &callerToken, int requestCode, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); return abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); @@ -123,6 +127,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartS ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions &startOptions, const sptr &callerToken, int requestCode, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("%{public}s come, abilityName=%{public}s, userId=%{public}d.", @@ -160,6 +165,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &token, ErrCode AbilityManagerClient::TerminateAbility(const sptr &callerToken, int requestCode) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); return abms->TerminateAbilityByCaller(callerToken, requestCode); @@ -182,6 +188,7 @@ ErrCode AbilityManagerClient::CloseAbility(const sptr &token, int ErrCode AbilityManagerClient::MinimizeAbility(const sptr &token, bool fromUser) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Minimize ability, fromUser:%{public}d.", fromUser); @@ -190,6 +197,7 @@ ErrCode AbilityManagerClient::MinimizeAbility(const sptr &token, ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptr &connect, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", @@ -200,6 +208,7 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptr &connect, const sptr &callerToken, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", @@ -209,6 +218,7 @@ ErrCode AbilityManagerClient::ConnectAbility( ErrCode AbilityManagerClient::DisconnectAbility(const sptr &connect) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Disconnect ability begin."); diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 2ece2301..92db77f3 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -56,6 +56,8 @@ #include "uri_permission_manager_client.h" #include "xcollie/watchdog.h" #include "parameter.h" +#include "event_report.h" +#include "hisysevent.h" #ifdef SUPPORT_GRAPHICS #include "display_manager.h" @@ -255,8 +257,22 @@ ServiceRunningState AbilityManagerService::QueryServiceState() const int AbilityManagerService::StartAbility(const Want &want, int32_t userId, int requestCode) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("%{public}s coldStart:%{public}d", __func__, want.GetBoolParam("coldStart", false)); - return StartAbilityInner(want, nullptr, requestCode, -1, userId); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, + HiSysEventType::BEHAVIOR, eventInfo); + int32_t ret = StartAbilityInner(want, nullptr, requestCode, -1, userId); + if (ret != ERR_OK) { + eventInfo.errCode = ret; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); + } + return ret; } int AbilityManagerService::StartAbility(const Want &want, const sptr &callerToken, @@ -264,8 +280,18 @@ int AbilityManagerService::StartAbility(const Want &want, const sptr(weak_from_this()); - return manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, CheckIfOperateRemote(want)); + eventInfo.errCode = manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, + CheckIfOperateRemote(want)); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); + return eventInfo.errCode; } HILOG_INFO("Start ability come, ability is %{public}s, userId is %{public}d", want.GetElement().GetAbilityName().c_str(), userId); if (CheckIfOperateRemote(want)) { HILOG_INFO("AbilityManagerService::StartAbility. try to StartRemoteAbility"); - return StartRemoteAbility(want, requestCode); + eventInfo.errCode = StartRemoteAbility(want, requestCode); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); + return eventInfo.errCode; } - return StartAbilityInner(want, callerToken, requestCode, -1, userId); + int32_t ret = StartAbilityInner(want, callerToken, requestCode, -1, userId); + if (ret != ERR_OK) { + eventInfo.errCode = ret; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); + } + return ret; } int AbilityManagerService::StartAbilityInner(const Want &want, const sptr &callerToken, @@ -377,19 +416,35 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability setting."); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, + HiSysEventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); + eventInfo.errCode = CHECK_PERMISSION_FAILED; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t oriValidUserId = GetValidUserId(userId); int32_t validUserId = oriValidUserId; if (!JudgeMultiUserConcurrency(validUserId)) { HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -397,6 +452,9 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett auto result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId); if (result != ERR_OK) { HILOG_ERROR("Generate ability request local error."); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } auto abilityInfo = abilityRequest.abilityInfo; @@ -406,11 +464,17 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett result = CheckStaticCfgPermission(abilityInfo); if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); if (result != ERR_OK) { HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } @@ -418,6 +482,9 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett if (abilityInfo.type == AppExecFwk::AbilityType::DATA) { HILOG_ERROR("Cannot start data ability, use 'AcquireDataAbility()' instead."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -427,24 +494,42 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett HILOG_ERROR("StartAbility: App data ability preloading failed, '%{public}s', %{public}d", abilityInfo.bundleName.c_str(), result); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } } #ifdef SUPPORT_GRAPHICS if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { HILOG_ERROR("Only support for page type ability."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } #endif if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { + eventInfo.errCode = ERR_WOULD_BLOCK; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } auto missionListManager = GetListManagerByUserId(oriValidUserId); if (missionListManager == nullptr) { - HILOG_ERROR("missionListManager is Null. userId=%{public}d", oriValidUserId); + HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } - return missionListManager->StartAbility(abilityRequest); + int32_t ret = missionListManager->StartAbility(abilityRequest); + if (ret != ERR_OK) { + eventInfo.errCode = ret; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); + } + return ret; } int AbilityManagerService::StartAbility(const Want &want, const StartOptions &startOptions, @@ -452,19 +537,35 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability options."); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, + HiSysEventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); + eventInfo.errCode = CHECK_PERMISSION_FAILED; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t oriValidUserId = GetValidUserId(userId); int32_t validUserId = oriValidUserId; if (!JudgeMultiUserConcurrency(validUserId)) { HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -472,6 +573,9 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st auto result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId); if (result != ERR_OK) { HILOG_ERROR("Generate ability request local error."); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } @@ -482,16 +586,25 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st result = CheckStaticCfgPermission(abilityInfo); if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); if (result != ERR_OK) { HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { HILOG_ERROR("Only support for page type ability."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -501,11 +614,17 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st HILOG_ERROR("StartAbility: App data ability preloading failed, '%{public}s', %{public}d", abilityInfo.bundleName.c_str(), result); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } } if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { + eventInfo.errCode = ERR_WOULD_BLOCK; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } GrantUriPermission(want, validUserId); @@ -514,9 +633,18 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st auto missionListManager = GetListManagerByUserId(oriValidUserId); if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", oriValidUserId); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } - return missionListManager->StartAbility(abilityRequest); + int32_t ret = missionListManager->StartAbility(abilityRequest); + if (ret != ERR_OK) { + eventInfo.errCode = ret; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); + } + return ret; } int AbilityManagerService::CheckOptExtensionAbility(const Want &want, AbilityRequest &abilityRequest, @@ -557,18 +685,35 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptrStartAbility(abilityRequest); + eventInfo.errCode = connectManager->StartAbility(abilityRequest); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR, + HiSysEventType::FAULT, eventInfo); + } + return eventInfo.errCode; } int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr &callerToken, @@ -604,18 +763,38 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptrStopServiceAbility(abilityRequest); + eventInfo.errCode = connectManager->StopServiceAbility(abilityRequest); + AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR, + HiSysEventType::FAULT, + eventInfo); + return eventInfo.errCode; } @@ -702,11 +897,21 @@ void AbilityManagerService::GrantUriPermission(const Want &want, int32_t validUs int AbilityManagerService::TerminateAbility(const sptr &token, int resultCode, const Want *resultWant) { + AAFWK::EventInfo eventInfo; + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, + HiSysEventType::BEHAVIOR, eventInfo); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, + HiSysEventType::FAULT, eventInfo); + } return TerminateAbilityWithFlag(token, resultCode, resultWant, true); } int AbilityManagerService::CloseAbility(const sptr &token, int resultCode, const Want *resultWant) { + AAFWK::EventInfo eventInfo; + AAFWK::EventReport::SendAbilityEvent(AAFWK::CLOSE_ABILITY, + HiSysEventType::BEHAVIOR, eventInfo); return TerminateAbilityWithFlag(token, resultCode, resultWant, false); } @@ -904,6 +1109,7 @@ int AbilityManagerService::TerminateAbilityByCaller(const sptr &c int AbilityManagerService::MinimizeAbility(const sptr &token, bool fromUser) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Minimize ability, fromUser:%{public}d.", fromUser); if (!VerificationAllToken(token)) { return ERR_INVALID_VALUE; @@ -948,20 +1154,36 @@ int AbilityManagerService::ConnectAbility( HILOG_INFO("Connect ability called."); CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE); CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE, HiSysEventType::BEHAVIOR, + eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); + eventInfo.errCode = CHECK_PERMISSION_FAILED; + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } int32_t validUserId = GetValidUserId(userId); std::string localDeviceId; if (!GetLocalDeviceId(localDeviceId)) { HILOG_ERROR("%{public}s: Get Local DeviceId failed", __func__); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } auto manager = std::make_shared(weak_from_this()); int result = manager->IsConnectFreeInstall(want, validUserId, callerToken, localDeviceId); if (result != ERR_OK) { + eventInfo.errCode = result; + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); return result; } @@ -976,6 +1198,9 @@ int AbilityManagerService::ConnectAbility( bool queryResult = IN_PROCESS_CALL(bms->QueryExtensionAbilityInfoByUri(uri, validUserId, extensionInfo)); if (!queryResult || extensionInfo.name.empty() || extensionInfo.bundleName.empty()) { HILOG_ERROR("Invalid extension ability info."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } abilityWant.SetElementName(extensionInfo.bundleName, extensionInfo.name); @@ -983,26 +1208,44 @@ int AbilityManagerService::ConnectAbility( if (CheckIfOperateRemote(abilityWant)) { HILOG_INFO("AbilityManagerService::ConnectAbility. try to ConnectRemoteAbility"); - return ConnectRemoteAbility(abilityWant, connect->AsObject()); + eventInfo.errCode = ConnectRemoteAbility(abilityWant, connect->AsObject()); + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); + return eventInfo.errCode; } if (callerToken != nullptr && callerToken->GetObjectDescriptor() != u"ohos.aafwk.AbilityToken") { HILOG_INFO("%{public}s invalid Token.", __func__); - return ConnectLocalAbility(abilityWant, validUserId, connect, nullptr); + eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, nullptr); + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); + return eventInfo.errCode; } - return ConnectLocalAbility(abilityWant, validUserId, connect, callerToken); + eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, callerToken); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); + } + return eventInfo.errCode; } int AbilityManagerService::DisconnectAbility(const sptr &connect) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Disconnect ability begin."); + AAFWK::EventInfo eventInfo; + AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE, HiSysEventType::BEHAVIOR, + eventInfo); CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE); CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE); - DisconnectLocalAbility(connect); - DisconnectRemoteAbility(connect->AsObject()); - return ERR_OK; + eventInfo.errCode = DisconnectLocalAbility(connect); + eventInfo.errCode |= DisconnectRemoteAbility(connect->AsObject()); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE_ERROR, + HiSysEventType::FAULT, eventInfo); + } + return eventInfo.errCode; } int AbilityManagerService::ConnectLocalAbility(const Want &want, const int32_t userId, @@ -3906,6 +4149,10 @@ int AbilityManagerService::DoAbilityForeground(const sptr &token, } abilityRecord->ProcessForegroundAbility(flag); + AAFWK::EventInfo eventInfo; + eventInfo.sceneFlag = flag; + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, + HiSysEventType::BEHAVIOR, eventInfo); return ERR_OK; } @@ -3920,6 +4167,10 @@ int AbilityManagerService::DoAbilityBackground(const sptr &token, abilityRecord->lifeCycleStateInfo_.sceneFlag = flag; int ret = MinimizeAbility(token); abilityRecord->lifeCycleStateInfo_.sceneFlag = SCENE_FLAG_NORMAL; + AAFWK::EventInfo eventInfo; + eventInfo.sceneFlag = flag; + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, + HiSysEventType::BEHAVIOR, eventInfo); return ret; } diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index ad47b133..47ceb093 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -249,6 +249,7 @@ void AbilityRecord::ProcessForegroundAbility(uint32_t sceneFlag) void AbilityRecord::BackgroundAbility(const Closure &task) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Move the ability to background, ability:%{public}s.", abilityInfo_.name.c_str()); if (lifecycleDeal_ == nullptr) { HILOG_ERROR("Move the ability to background fail, lifecycleDeal_ is null."); @@ -279,6 +280,7 @@ void AbilityRecord::BackgroundAbility(const Closure &task) int AbilityRecord::TerminateAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Schedule terminate ability to AppMs, ability:%{public}s.", abilityInfo_.name.c_str()); return DelayedSingleton::GetInstance()->TerminateAbility(token_); } @@ -454,6 +456,7 @@ void AbilityRecord::Activate() void AbilityRecord::Inactivate() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Inactivate ability start, ability:%{public}s.", abilityInfo_.name.c_str()); CHECK_POINTER(lifecycleDeal_); @@ -467,6 +470,7 @@ void AbilityRecord::Inactivate() void AbilityRecord::Terminate(const Closure &task) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Begin to terminate ability, ability:%{public}s.", abilityInfo_.name.c_str()); CHECK_POINTER(lifecycleDeal_); auto handler = DelayedSingleton::GetInstance()->GetEventHandler(); @@ -495,6 +499,7 @@ void AbilityRecord::ConnectAbility() void AbilityRecord::DisconnectAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Disconnect ability, ability:%{public}s.", abilityInfo_.name.c_str()); CHECK_POINTER(lifecycleDeal_); lifecycleDeal_->DisconnectAbility(want_); diff --git a/services/abilitymgr/src/app_scheduler.cpp b/services/abilitymgr/src/app_scheduler.cpp index 294036b9..7fd6b614 100644 --- a/services/abilitymgr/src/app_scheduler.cpp +++ b/services/abilitymgr/src/app_scheduler.cpp @@ -76,6 +76,7 @@ bool AppScheduler::Init(const std::weak_ptr &callback) int AppScheduler::LoadAbility(const sptr &token, const sptr &preToken, const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Send load ability to AppMgrService."); CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR); /* because the errcode type of AppMgr Client API will be changed to int, diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index b9008e3c..d14b2bb7 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -242,6 +242,7 @@ void MissionListManager::StartWaittingAbility() int MissionListManager::StartAbilityLocked(const std::shared_ptr ¤tTopAbility, const std::shared_ptr &callerAbility, const AbilityRequest &abilityRequest) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability locked."); // 1. choose target mission list auto targetList = GetTargetMissionList(callerAbility, abilityRequest); @@ -621,6 +622,7 @@ std::shared_ptr MissionListManager::GetCurrentTopAbilityLocked() int MissionListManager::AttachAbilityThread(const sptr &scheduler, const sptr &token) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); std::lock_guard guard(managerLock_); auto abilityRecord = GetAbilityRecordByToken(token); CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE); @@ -775,6 +777,7 @@ std::shared_ptr MissionListManager::GetMissionById(int missionId) const int MissionListManager::AbilityTransactionDone(const sptr &token, int state, const PacMap &saveData) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); int targetState = AbilityRecord::ConvertLifeCycleToAbilityState(static_cast(state)); std::string abilityState = AbilityRecord::ConvertAbilityState(static_cast(targetState)); HILOG_INFO("AbilityTransactionDone, state: %{public}s.", abilityState.c_str()); @@ -960,6 +963,7 @@ void MissionListManager::CompleteBackground(const std::shared_ptr int MissionListManager::TerminateAbility(const std::shared_ptr &abilityRecord, int resultCode, const Want *resultWant, bool flag) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); std::string element = abilityRecord->GetWant().GetElement().GetURI(); HILOG_DEBUG("Terminate ability, ability is %{public}s.", element.c_str()); std::lock_guard guard(managerLock_); @@ -1324,6 +1328,7 @@ int MissionListManager::SetMissionLockedState(int missionId, bool lockedState) void MissionListManager::MoveToBackgroundTask(const std::shared_ptr &abilityRecord) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); if (abilityRecord == nullptr) { HILOG_ERROR("Move the ability to background fail, ability record is null."); return; diff --git a/services/abilitymgr/test/BUILD.gn b/services/abilitymgr/test/BUILD.gn index d4ec3cfe..fc2de77e 100644 --- a/services/abilitymgr/test/BUILD.gn +++ b/services/abilitymgr/test/BUILD.gn @@ -58,6 +58,7 @@ ohos_source_set("abilityms_test_source") { "${services_path}/abilitymgr/src/want_sender_proxy.cpp", "${services_path}/abilitymgr/src/want_sender_stub.cpp", "${services_path}/abilitymgr/src/wants_info.cpp", + "${services_path}/common/src/event_report.cpp", ] include_dirs = [ diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index e575c67e..815779f2 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("ability_manager_client_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 840145d9..18a724c5 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -49,6 +49,8 @@ #include "locale_config.h" #endif #include "uri_permission_manager_client.h" +#include "event_report.h" +#include "hisysevent.h" namespace OHOS { namespace AppExecFwk { @@ -269,6 +271,14 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptrRegisterAppDeathRecipient(); + AAFWK::EventInfo eventInfo; + auto applicationInfo = appRecord->GetApplicationInfo(); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.bundleName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.processName = applicationInfo->process; + AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::LaunchApplication(const std::shared_ptr &appRecord) @@ -304,6 +314,14 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptrLaunchPendingAbilities(); + AAFWK::EventInfo eventInfo; + auto applicationInfo = appRecord->GetApplicationInfo(); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.bundleName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.processName = applicationInfo->process; + AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::AddAbilityStageDone(const int32_t recordId) @@ -338,6 +356,15 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) // push the foregrounded app front of RecentAppList. PushAppFront(recordId); HILOG_INFO("application is foregrounded"); + AAFWK::EventInfo eventInfo; + auto applicationInfo = appRecord->GetApplicationInfo(); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.bundleName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.processName = applicationInfo->process; + AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, + HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) @@ -358,6 +385,15 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) } HILOG_INFO("application is backgrounded"); + AAFWK::EventInfo eventInfo; + auto applicationInfo = appRecord->GetApplicationInfo(); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.bundleName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.processName = applicationInfo->process; + AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, + HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) @@ -387,6 +423,14 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) OnAppStateChanged(appRecord, ApplicationState::APP_STATE_TERMINATED); appRunningManager_->RemoveAppRunningRecordById(recordId); RemoveAppFromRecentListById(recordId); + AAFWK::EventInfo eventInfo; + auto applicationInfo = appRecord->GetApplicationInfo(); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.bundleName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.processName = applicationInfo->process; + AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, HiSysEventType::BEHAVIOR, eventInfo); DelayedSingleton::GetInstance()->OnProcessDied(appRecord); HILOG_INFO("application is terminated"); diff --git a/services/appmgr/src/module_running_record.cpp b/services/appmgr/src/module_running_record.cpp index 8d534280..800fd655 100644 --- a/services/appmgr/src/module_running_record.cpp +++ b/services/appmgr/src/module_running_record.cpp @@ -17,6 +17,7 @@ #include "app_mgr_service_inner.h" #include "app_running_record.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AppExecFwk { @@ -188,6 +189,7 @@ void ModuleRunningRecord::OnAbilityStateChanged( void ModuleRunningRecord::LaunchAbility(const std::shared_ptr &ability) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Launch ability."); if (!ability || !ability->GetToken()) { HILOG_ERROR("null abilityRecord or abilityToken"); diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index c8d698ef..fe87c9d2 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -35,7 +35,10 @@ ohos_source_set("abilitymgr_common") { config("perm_verification_config") { visibility = [ ":*" ] - include_dirs = [ "include" ] + include_dirs = [ + "include", + "${bundlefwk_inner_api_path}/appexecfwk_base/include", + ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] @@ -46,10 +49,14 @@ config("perm_verification_config") { ohos_shared_library("perm_verification") { public_configs = [ ":perm_verification_config" ] - sources = [ "src/permission_verification.cpp" ] + sources = [ + "src/event_report.cpp", + "src/permission_verification.cpp", + ] external_deps = [ "access_token:libaccesstoken_sdk", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "utils_base:utils", diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h new file mode 100644 index 00000000..dda33f78 --- /dev/null +++ b/services/common/include/event_report.h @@ -0,0 +1,114 @@ +/* + * 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. + */ + +#ifndef FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H +#define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H + +#include +#include + +#include "errors.h" +#include "hisysevent.h" +#include "extension_ability_info.h" + +using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType; +using HiSysEvent = OHOS::HiviewDFX::HiSysEvent; + +namespace OHOS { +namespace AAFWK { +namespace { +// fault event +const std::string START_ABILITY_ERROR = "START_ABILITY_ERROR"; +const std::string TERMINATE_ABILITY_ERROR = "TERMINATE_ABILITY_ERROR"; +const std::string START_EXTENSION_ERROR = "START_EXTENSION_ERROR"; +const std::string STOP_EXTENSION_ERROR = "STOP_EXTENSION_ERROR"; +const std::string CONNECT_SERVICE_ERROR = "CONNECT_SERVICE_ERROR"; +const std::string DISCONNECT_SERVICE_ERROR = "DISCONNECT_SERVICE_ERROR"; +// ability behavior event +const std::string START_ABILITY = "START_ABILITY"; +const std::string TERMINATE_ABILITY = "TERMINATE_ABILITY"; +const std::string CLOSE_ABILITY = "CLOSE_ABILITY"; +const std::string DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY"; +const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY"; +// serviceExtensionAbility behavior event +const std::string START_SERVICE = "START_SERVICE"; +const std::string STOP_SERVICE = "STOP_SERVICE"; +const std::string CONNECT_SERVICE = "CONNECT_SERVICE"; +const std::string DISCONNECT_SERVICE = "DISCONNECT_SERVICE"; +// form behavior event +const std::string ADD_FORM = "ADD_FORM"; +const std::string REQUEST_FORM = "REQUEST_FORM"; +const std::string DELETE_FORM = "DELETE_FORM"; +const std::string CASTTEMP_FORM = "CASTTEMP_FORM"; +const std::string ACQUIREFORMSTATE_FORM = "ACQUIREFORMSTATE_FORM"; +const std::string MESSAGE_EVENT_FORM = "MESSAGE_EVENT_FORM"; +const std::string ROUTE_EVENT_FORM = "ROUTE_EVENT_FORM"; +const std::string RELEASE_FORM = "RELEASE_FORM"; +const std::string DELETE_INVALID_FORM = "DELETE_INVALID_FORM"; +const std::string SET_NEXT_REFRESH_TIME_FORM = "SET_NEXT_REFRESH_TIME_FORM"; +// app behavior event +const std::string APP_ATTACH = "APP_ATTACH"; +const std::string APP_LAUNCH = "APP_LAUNCH"; +const std::string APP_FOREGROUND = "APP_FOREGROUND"; +const std::string APP_BACKGROUND = "APP_BACKGROUND"; +const std::string APP_TERMINATE = "APP_TERMINATE"; +} + +struct EventInfo { + int32_t pid = -1; + int32_t userId = -1; + int64_t formId = -1; + int32_t extensionType = -1; + uint32_t versionCode = 0; + uint32_t sceneFlag = -1; + std::string versionName; + std::string bundleName; + std::string moduleName; + std::string abilityName; + std::string processName; + + // olny used in fault event + ErrCode errCode = ERR_OK; + + void Reset() + { + pid =-1; + userId = -1; + formId =-1; + versionCode = 0; + sceneFlag = -1; + versionName.clear(); + bundleName.clear(); + moduleName.clear(); + abilityName.clear(); + processName.clear(); + extensionType = (int32_t)AppExecFwk::ExtensionAbilityType::UNSPECIFIED; + errCode = ERR_OK; + } +}; +class EventReport { +public: + static void SendAppEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo); + static void SendAbilityEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo); + static void SendExtensionEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo); + static void SendFormEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo); +}; +} // namespace AAFWK +} // namespace OHOS +#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp new file mode 100644 index 00000000..a51e971e --- /dev/null +++ b/services/common/src/event_report.cpp @@ -0,0 +1,164 @@ +/* + * 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. + */ + +#include "event_report.h" +#include "hilog_wrapper.h" + +#include + +namespace OHOS { +namespace AAFWK { +namespace { +// event params +const std::string TYPE = "TYPE"; +const std::string EVENT_KEY_PID = "PID"; +const std::string EVENT_KEY_USERID = "USERID"; +const std::string EVENT_KEY_FORM_ID = "FORM_ID"; +const std::string EVENT_KEY_ERROR_CODE = "ERROR_CODE"; +const std::string EVENT_KEY_SCENE_FLAG = "SCENE_FLAG"; +const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME"; +const std::string EVENT_KEY_MODULE_NAME = "MODULE_NAME"; +const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; +const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; +const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; +const std::string EVENT_KEY_PROCESS_NAME = "PROCESS_NAME"; +const std::string EVENT_KEY_EXTENSION_TYPE = "EXTENSION_TYPE"; +} + +void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo) +{ + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_VERSION_NAME, eventInfo.versionName, + EVENT_KEY_VERSION_CODE, eventInfo.versionCode, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_PROCESS_NAME, eventInfo.processName); +} + +void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo) +{ + if (eventName == START_ABILITY_ERROR || eventName == TERMINATE_ABILITY_ERROR) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_ERROR_CODE, eventInfo.errCode); + } else if (eventName == START_ABILITY_ERROR) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else if (eventName == DO_FOREGROUND_ABILITY || eventName == DO_BACKGROUND_ABILITY) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_SCENE_FLAG, eventInfo.sceneFlag); + } else { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type); + } +} + +void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo) +{ + if (eventName == DISCONNECT_SERVICE) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type); + } else if (eventName == CONNECT_SERVICE) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else if (eventName == START_SERVICE || eventName == STOP_SERVICE) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_EXTENSION_TYPE, eventInfo.extensionType); + } else { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_ERROR_CODE, eventInfo.errCode); + } +} + +void EventReport::SendFormEvent(const std::string &eventName, HiSysEventType type, + const EventInfo& eventInfo) +{ + if (eventName == DELETE_INVALID_FORM) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type); + } else if (eventName == ACQUIREFORMSTATE_FORM || eventName == MESSAGE_EVENT_FORM) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else if (eventName == ADD_FORM || eventName == REQUEST_FORM || eventName == ROUTE_EVENT_FORM) { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_ABILITY_NAME, eventInfo.formId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else { + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_ABILITY_NAME, eventInfo.formId); + } +} +} // namespace AAFWK +} // namespace OHOS \ No newline at end of file diff --git a/services/test/moduletest/ability_record_test/BUILD.gn b/services/test/moduletest/ability_record_test/BUILD.gn index 936d4381..eef6540e 100644 --- a/services/test/moduletest/ability_record_test/BUILD.gn +++ b/services/test/moduletest/ability_record_test/BUILD.gn @@ -117,6 +117,7 @@ ohos_moduletest("AbilityRecordModuleTest") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/test/moduletest/ability_timeout_module_test/BUILD.gn b/services/test/moduletest/ability_timeout_module_test/BUILD.gn index 76169d21..b0779e03 100644 --- a/services/test/moduletest/ability_timeout_module_test/BUILD.gn +++ b/services/test/moduletest/ability_timeout_module_test/BUILD.gn @@ -117,6 +117,7 @@ ohos_moduletest("ability_timeout_module_test") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/test/moduletest/common/ams/BUILD.gn b/services/test/moduletest/common/ams/BUILD.gn index 8338d820..1c4eab18 100644 --- a/services/test/moduletest/common/ams/BUILD.gn +++ b/services/test/moduletest/common/ams/BUILD.gn @@ -43,6 +43,7 @@ ohos_source_set("appmgr_mst_source") { "${services_path}/appmgr/src/module_running_record.cpp", "${services_path}/appmgr/src/remote_client_manager.cpp", "${services_path}/appmgr/test/mock/src/mock_bundle_manager.cpp", + "${services_path}/common/src/event_report.cpp", ] defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ] diff --git a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn index 5866e352..82c88c23 100644 --- a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn +++ b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn @@ -32,6 +32,7 @@ ohos_moduletest("specified_ability_service_test") { "${aafwk_path}/services/abilitymgr/src/ability_manager_proxy.cpp", "${aafwk_path}/services/abilitymgr/src/ability_manager_service.cpp", "${aafwk_path}/services/abilitymgr/test/mock/libs/sa_mgr/src/sa_mgr_client_mock.cpp", + "${aafwk_path}/services/common/src/event_report.cpp", "${aafwk_path}/services/common/src/permission_verification.cpp", "${aafwk_path}/services/test/mock/src/mock_app_mgr_client.cpp", "${aafwk_path}/services/test/mock/src/mock_bundle_mgr.cpp", @@ -88,6 +89,7 @@ ohos_moduletest("specified_ability_service_test") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/test/moduletest/mission_dump_test/BUILD.gn b/services/test/moduletest/mission_dump_test/BUILD.gn index 22585eef..1f6df35d 100644 --- a/services/test/moduletest/mission_dump_test/BUILD.gn +++ b/services/test/moduletest/mission_dump_test/BUILD.gn @@ -49,6 +49,7 @@ ohos_moduletest("mission_dump_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", + "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", diff --git a/services/test/moduletest/on_new_want_module_test/BUILD.gn b/services/test/moduletest/on_new_want_module_test/BUILD.gn index 61329d0d..5c112d28 100644 --- a/services/test/moduletest/on_new_want_module_test/BUILD.gn +++ b/services/test/moduletest/on_new_want_module_test/BUILD.gn @@ -32,6 +32,7 @@ ohos_moduletest("on_new_want_module_test") { "${aafwk_path}/services/abilitymgr/src/ability_manager_service.cpp", "${aafwk_path}/services/abilitymgr/src/mission_list.cpp", "${aafwk_path}/services/abilitymgr/src/mission_list_manager.cpp", + "${aafwk_path}/services/common/src/event_report.cpp", "${aafwk_path}/services/common/src/permission_verification.cpp", "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp", ] diff --git a/services/test/moduletest/running_infos_module_test/BUILD.gn b/services/test/moduletest/running_infos_module_test/BUILD.gn index 853fd6a4..f383d0d4 100644 --- a/services/test/moduletest/running_infos_module_test/BUILD.gn +++ b/services/test/moduletest/running_infos_module_test/BUILD.gn @@ -112,6 +112,7 @@ ohos_moduletest("running_infos_module_test") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core",