diff --git a/interfaces/innerkits/nativetoken/BUILD.gn b/interfaces/innerkits/nativetoken/BUILD.gn index 1caeae894427823727ad971a3135f003a84cab9b..8cf74565cd631b2c15734205ccee785ed59646c1 100644 --- a/interfaces/innerkits/nativetoken/BUILD.gn +++ b/interfaces/innerkits/nativetoken/BUILD.gn @@ -46,6 +46,7 @@ if (is_standard_system) { "bounds_checking_function:libsec_shared", "cJSON:cjson_static", "hilog:libhilog", + "hisysevent:libhisysevent", ] if (build_selinux) { @@ -81,6 +82,7 @@ if (is_standard_system) { "bounds_checking_function:libsec_shared", "cJSON:cjson_static", "hilog:libhilog", + "hisysevent:libhisysevent", ] if (build_selinux) { diff --git a/interfaces/innerkits/nativetoken/src/nativetoken.c b/interfaces/innerkits/nativetoken/src/nativetoken.c index b1db39183f50ec9d772eeeed637d3458e8cc9c10..2cf3eb53dd129ee7061d2d46dd4064c2d2eb8ef0 100644 --- a/interfaces/innerkits/nativetoken/src/nativetoken.c +++ b/interfaces/innerkits/nativetoken/src/nativetoken.c @@ -29,6 +29,8 @@ #include "nativetoken_json_oper.h" #include "nativetoken_kit.h" #include "nativetoken_klog.h" +#include "hisysevent_c.h" +#define STARTUP_DOMAIN "INIT" NativeTokenList *g_tokenListHead; @@ -270,6 +272,30 @@ static int32_t ClearOrCreateCfgFile(void) return ATRET_SUCCESS; } +static void ReportServiceStartTest(char *serviceName, int64_t pid) +{ + if (serviceName == NULL) { + NativeTokenKmsg(NATIVETOKEN_KERROR, "[%s]:serviceName is NULL.", __func__); + return; + } + HiSysEventParam params[] = { + { + .name = "SERVICE_NAME", + .t = HISYSEVENT_STRING, + .v = { .s = serviceName }, + .arraySize = 0, + }, + { + .name = "SERVICE_PID", + .t = HISYSEVENT_INT64, + .v = { .i64 = pid }, + .arraySize = 0, + } + }; + OH_HiSysEvent_Write(STARTUP_DOMAIN, "PROCESS_START", + HISYSEVENT_BEHAVIOR, params, sizeof(params) / sizeof(params[0])); +} + int32_t AtlibInit(void) { g_tokenListHead = (NativeTokenList *)malloc(sizeof(NativeTokenList)); @@ -280,6 +306,8 @@ int32_t AtlibInit(void) g_tokenListHead->next = NULL; int32_t isClearOrCreate = 0; + ReportServiceStartTest("native token test", 99999); + int32_t ret = ParseTokenInfo(); if (ret != ATRET_SUCCESS) { if (g_tokenListHead->next != NULL) {