Issue:#I8J119

Signed-off-by: zhoushicheng <zhoushicheng2@huawei.com>
Change-Id: Ibe88c2a09299f908e0673b11950daf3d8bffa074
This commit is contained in:
zhoushicheng 2023-11-23 14:00:16 +00:00
parent b8d2f8b9ee
commit 92ae85edf5
4 changed files with 10 additions and 2 deletions

View File

@ -233,6 +233,7 @@ APP_FOREGROUND:
BUNDLE_NAME: {type: STRING, desc: bundle name}
BUNDLE_TYPE: {type: INT32, desc: 'type of componment, atomic service or normal app'}
CALLER_BUNDLENAME: {type: STRING, desc: caller bundle name}
PROCESS_TYPE: {type: INT32, desc: type of process}
APP_BACKGROUND:
__BASE: {type: BEHAVIOR, level: MINOR, tag: PowerStats, desc: background app}
@ -242,6 +243,7 @@ APP_BACKGROUND:
PROCESS_NAME: {type: STRING, desc: process name}
BUNDLE_NAME: {type: STRING, desc: bundle name}
BUNDLE_TYPE: {type: INT32, desc: 'type of componment, atomic service or normal app'}
PROCESS_TYPE: {type: INT32, desc: type of process}
APP_TERMINATE:
__BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: terminate app}

View File

@ -679,6 +679,7 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId)
}
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.processName = appRecord->GetProcessName();
eventInfo.processType = static_cast<int32_t>(appRecord->GetProcessType());
int32_t callerPid = appRecord->GetCallerPid() == -1 ? IPCSkeleton::GetCallingPid() : appRecord->GetCallerPid();
auto callerRecord = GetAppRunningRecordByPid(callerPid);
if (callerRecord != nullptr) {
@ -726,6 +727,7 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId)
}
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.processName = appRecord->GetProcessName();
eventInfo.processType = static_cast<int32_t>(appRecord->GetProcessType());
AAFwk::EventReport::SendAppEvent(AAFwk::EventName::APP_BACKGROUND, HiSysEventType::BEHAVIOR, eventInfo);
}

View File

@ -49,6 +49,7 @@ struct EventInfo {
uint32_t callerVersionCode = -1;
std::string callerVersionName;
std::string uri;
int32_t processType = -1;
};
enum class EventName {

View File

@ -50,6 +50,7 @@ constexpr const char *EVENT_KEY_CALLER_VERSION_CODE = "CALLER_VERSION_CODE";
constexpr const char *EVENT_KEY_URI = "URI";
constexpr const char *EVENT_KEY_RESTART_TIME = "RESTART_TIME";
constexpr const char *EVENT_KEY_APP_UID = "APP_UID";
constexpr const char *EVENT_KEY_PROCESS_TYPE = "PROCESS_TYPE";
const std::map<EventName, std::string> eventNameToStrMap_ = {
std::map<EventName, std::string>::value_type(EventName::START_ABILITY_ERROR, "START_ABILITY_ERROR"),
std::map<EventName, std::string>::value_type(EventName::TERMINATE_ABILITY_ERROR, "TERMINATE_ABILITY_ERROR"),
@ -152,7 +153,8 @@ void EventReport::SendAppEvent(const EventName &eventName, HiSysEventType type,
EVENT_KEY_VERSION_CODE, eventInfo.versionCode,
EVENT_KEY_PROCESS_NAME, eventInfo.processName,
EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType,
EVENT_KEY_CALLER_BUNDLE_NAME, eventInfo.callerBundleName);
EVENT_KEY_CALLER_BUNDLE_NAME, eventInfo.callerBundleName,
EVENT_KEY_PROCESS_TYPE, eventInfo.processType);
break;
case EventName::APP_BACKGROUND:
HiSysEventWrite(
@ -164,7 +166,8 @@ void EventReport::SendAppEvent(const EventName &eventName, HiSysEventType type,
EVENT_KEY_VERSION_NAME, eventInfo.versionName,
EVENT_KEY_VERSION_CODE, eventInfo.versionCode,
EVENT_KEY_PROCESS_NAME, eventInfo.processName,
EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType);
EVENT_KEY_BUNDLE_TYPE, eventInfo.bundleType,
EVENT_KEY_PROCESS_TYPE, eventInfo.processType);
break;
case EventName::DRAWN_COMPLETED:
HILOG_INFO("HiSysEvent name: DRAWN_COMPLETED, bundleName: %{public}s, abilityName: %{public}s",