diff --git a/frameworks/native/ability/native/ability.cpp b/frameworks/native/ability/native/ability.cpp index fddbe96ce4..cc8cf3c493 100644 --- a/frameworks/native/ability/native/ability.cpp +++ b/frameworks/native/ability/native/ability.cpp @@ -334,6 +334,7 @@ void Ability::OnActive() eventInfo.bundleName = abilityInfo_->bundleName; eventInfo.moduleName = abilityInfo_->moduleName; eventInfo.abilityName = abilityInfo_->name; + eventInfo.abilityType = static_cast(abilityInfo_->type); AAFwk::EventReport::SendAbilityEvent(AAFwk::EventName::ABILITY_ONACTIVE, HiSysEventType::BEHAVIOR, eventInfo); HILOG_DEBUG("%{public}s end.", __func__); diff --git a/hisysevent.yaml b/hisysevent.yaml index 4d5c70185a..890540c6ff 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -139,6 +139,7 @@ ABILITY_ONACTIVE: BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} + ABILITY_TYPE: {type: INT32, desc: ability type} ABILITY_ONINACTIVE: __BASE: {type: BEHAVIOR, level: MINOR, desc: ability onInactive} @@ -154,7 +155,7 @@ START_SERVICE: 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} + EXTENSION_TYPE: {type: INT32, desc: extension type} STOP_SERVICE: __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: stop serviceExtensionAbility} @@ -162,7 +163,7 @@ STOP_SERVICE: 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} + EXTENSION_TYPE: {type: INT32, desc: extension type} CONNECT_SERVICE: __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: connect serviceAbility} diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 54d473412b..403b4491ed 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -38,6 +38,7 @@ struct EventInfo { std::string moduleName; std::string abilityName; std::string processName; + int32_t abilityType = -1; }; enum class EventName { diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 3357a3d800..ed717952d4 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -30,6 +30,7 @@ const std::string EVENT_KEY_ERROR_CODE = "ERROR_CODE"; 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_ABILITY_TYPE = "ABILITY_TYPE"; 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"; @@ -132,7 +133,6 @@ void EventReport::SendAbilityEvent(const EventName &eventName, HiSysEventType ty break; case EventName::ABILITY_ONFOREGROUND: case EventName::ABILITY_ONBACKGROUND: - case EventName::ABILITY_ONACTIVE: case EventName::ABILITY_ONINACTIVE: HiSysEventWrite( HiSysEvent::Domain::AAFWK, @@ -142,6 +142,16 @@ void EventReport::SendAbilityEvent(const EventName &eventName, HiSysEventType ty EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); break; + case EventName::ABILITY_ONACTIVE: + HiSysEventWrite( + HiSysEvent::Domain::AAFWK, + name, + type, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_ABILITY_TYPE, eventInfo.abilityType); + break; default: break; }