mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 01:10:52 +00:00
add exit reason when process exit
Signed-off-by: sunjiakun <sunjiakun5@huawei.com>
This commit is contained in:
parent
d240d5a3d2
commit
38ddd0a684
@ -325,6 +325,7 @@ PROCESS_EXIT:
|
||||
EXIT_PID: {type: INT32, desc: pid}
|
||||
PROCESS_NAME: {type: STRING, desc: process name}
|
||||
EXTENSION_TYPE: {type: INT32, desc: process exit extension type}
|
||||
EXIT_REASON: {type: INT32, desc: process exit reason}
|
||||
|
||||
PROCESS_START_FAILED:
|
||||
__BASE: {type: FAULT, level: CRITICAL, tag: app, desc: process start failed, preserve: true}
|
||||
|
@ -1524,6 +1524,7 @@ void AppMgrServiceInner::SendProcessExitEventTask(
|
||||
eventInfo.pid = pid;
|
||||
eventInfo.processName = appRecord->GetProcessName();
|
||||
eventInfo.extensionType = static_cast<int32_t>(appRecord->GetExtensionType());
|
||||
eventInfo.exitReason = appRecord->GetExitReason();
|
||||
|
||||
if (exitResult) {
|
||||
eventInfo.exitResult = EXIT_SUCESS;
|
||||
|
@ -55,6 +55,7 @@ struct EventInfo {
|
||||
int64_t duration = 0;
|
||||
int32_t reason = -1;
|
||||
int32_t subReason = -1;
|
||||
int32_t exitReason = -1;
|
||||
};
|
||||
|
||||
enum class EventName {
|
||||
|
@ -43,6 +43,7 @@ constexpr const char *EVENT_KEY_CALLER_PROCESS_ID = "CALLER_PROCESS_ID";
|
||||
constexpr const char *EVENT_KEY_EXIT_TIME = "EXIT_TIME";
|
||||
constexpr const char *EVENT_KEY_EXIT_RESULT = "EXIT_RESULT";
|
||||
constexpr const char *EVENT_KEY_EXIT_PID = "EXIT_PID";
|
||||
constexpr const char *EVENT_KEY_EXIT_REASON = "EXIT_REASON";
|
||||
constexpr const char *EVENT_KEY_BUNDLE_TYPE = "BUNDLE_TYPE";
|
||||
constexpr const char *EVENT_KEY_START_TYPE = "START_TYPE";
|
||||
constexpr const char *EVENT_KEY_CALLER_STATE = "CALLER_STATE";
|
||||
@ -555,7 +556,8 @@ void EventReport::SendProcessExitEvent(const EventName &eventName, const EventIn
|
||||
EVENT_KEY_EXIT_RESULT, eventInfo.exitResult,
|
||||
EVENT_KEY_EXIT_PID, eventInfo.pid,
|
||||
EVENT_KEY_PROCESS_NAME, eventInfo.processName,
|
||||
EVENT_KEY_EXTENSION_TYPE, eventInfo.extensionType);
|
||||
EVENT_KEY_EXTENSION_TYPE, eventInfo.extensionType,
|
||||
EVENT_KEY_EXIT_REASON, eventInfo.exitReason);
|
||||
}
|
||||
|
||||
void EventReport::SendStartServiceEvent(const EventName &eventName, const EventInfo &eventInfo)
|
||||
|
@ -613,6 +613,20 @@ HWTEST_F(EventReportTest, SendProcessExitEvent_0100, TestSize.Level0)
|
||||
EventReport::SendProcessExitEvent(eventName, eventInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SendProcessExitEvent_0200
|
||||
* @tc.desc: Check SendProcessExitEvent Test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(EventReportTest, SendProcessExitEvent_0200, TestSize.Level1)
|
||||
{
|
||||
EventInfo eventInfo;
|
||||
EventName eventName = EventName::PROCESS_EXIT;
|
||||
eventInfo.exitReason = 0;
|
||||
EventReport::SendProcessExitEvent(eventName, eventInfo);
|
||||
EXPECT_EQ(EventReport::ConvertEventName(eventName), "PROCESS_EXIT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SendStartServiceEvent_0100
|
||||
* @tc.desc: Check SendStartServiceEvent Test
|
||||
|
Loading…
Reference in New Issue
Block a user