diff --git a/interfaces/innerkits/client/appspawn_client.c b/interfaces/innerkits/client/appspawn_client.c index bef4315beac8503d3b107e07070d7dbf787893e3..5699112c78bf2167577492397765f2df8b1c2c2a 100644 --- a/interfaces/innerkits/client/appspawn_client.c +++ b/interfaces/innerkits/client/appspawn_client.c @@ -432,16 +432,16 @@ int AppSpawnClientSendMsg(AppSpawnClientHandle handle, AppSpawnReqMsgHandle reqH APPSPAWN_CHECK(reqNode != NULL && reqNode->msg != NULL, AppSpawnReqMsgFree(reqHandle); return APPSPAWN_ARG_INVALID, "Invalid msgReq"); - APPSPAWN_LOGI("AppSpawnClientSendMsg reqId: %{public}u msgLen: %{public}u %{public}s", - reqNode->reqId, reqNode->msg->msgLen, reqNode->msg->processName); + APPSPAWN_LOGI("AppSpawnClientSendMsg reqId: %{public}u msgLen: %{public}u fd: %{public}d %{public}s", + reqNode->reqId, reqNode->msg->msgLen, reqMgr->socketId, reqNode->msg->processName); pthread_mutex_lock(&reqMgr->mutex); int ret = ClientSendMsg(reqMgr, reqNode, result); if (ret != 0) { result->result = ret; } pthread_mutex_unlock(&reqMgr->mutex); - APPSPAWN_LOGI("AppSpawnClientSendMsg reqId: %{public}u end result: 0x%{public}x pid: %{public}d", - reqNode->reqId, result->result, result->pid); + APPSPAWN_LOGI("AppSpawnClientSendMsg reqId: %{public}u fd: %{public}d end result: 0x%{public}x pid: %{public}d", + reqNode->reqId, reqMgr->socketId, result->result, result->pid); AppSpawnReqMsgFree(reqHandle); return ret; } diff --git a/modules/ace_adapter/ace_adapter.cpp b/modules/ace_adapter/ace_adapter.cpp index eb42eacd1db3f7b707767803ba364b6bf0438d4a..7d93881b2db85e5a2d97fe4b2aa176be4e0a2bac 100644 --- a/modules/ace_adapter/ace_adapter.cpp +++ b/modules/ace_adapter/ace_adapter.cpp @@ -35,7 +35,6 @@ #include "hitrace_meter.h" #include "js_runtime.h" #include "json_utils.h" -#include "parameter.h" #include "parameters.h" #include "resource_manager.h" #ifndef APPSPAWN_TEST @@ -300,9 +299,7 @@ APPSPAWN_STATIC int PreLoadAppSpawn(AppSpawnMgr *content) bool isHybrid = IsHybridSpawnMode(content) ? true : false; APPSPAWN_LOGI("PreLoadAppSpawn: mode %{public}d, isHybrid is %{public}d", content->content.mode, isHybrid); - if (content->content.mode != MODE_FOR_APP_COLD_RUN) { - LoadExtendLib(isHybrid); - } + LoadExtendLib(isHybrid); return 0; } diff --git a/modules/common/appspawn_encaps.c b/modules/common/appspawn_encaps.c index 1d417e1debe68868270ade5ff5ce18fc44ffa96c..503622395b7cd648e212502f3e4fe96549096314 100644 --- a/modules/common/appspawn_encaps.c +++ b/modules/common/appspawn_encaps.c @@ -149,7 +149,7 @@ APPSPAWN_STATIC int AddPermissionIntArrayToValue(cJSON *arrayItem, UserEncap *en APPSPAWN_CHECK(value != NULL, return APPSPAWN_SYSTEM_ERROR, "Failed to calloc int array value"); cJSON *arrayItemTemp = arrayItem; - for (size_t index = 0; index < arraySize; index++) { + for (uint32_t index = 0; index < arraySize; index++) { if (arrayItemTemp == NULL || !cJSON_IsNumber(arrayItemTemp)) { free(value); APPSPAWN_LOGE("Invalid int array item type"); @@ -173,7 +173,7 @@ APPSPAWN_STATIC int AddPermissionBoolArrayToValue(cJSON *arrayItem, UserEncap *e APPSPAWN_CHECK(value != NULL, return APPSPAWN_SYSTEM_ERROR, "Failed to calloc bool array value"); cJSON *arrayItemTemp = arrayItem; - for (size_t index = 0; index < arraySize; index++) { + for (uint32_t index = 0; index < arraySize; index++) { if (arrayItemTemp == NULL || !cJSON_IsBool(arrayItemTemp)) { free(value); APPSPAWN_LOGE("Invalid bool array item type"); diff --git a/standard/appspawn_appmgr.c b/standard/appspawn_appmgr.c index 4aa7701960136cbd44f9b176dab4ee243f8cfbdf..b864d494184e627f7853e96f6dc759ecd2ae9d9d 100644 --- a/standard/appspawn_appmgr.c +++ b/standard/appspawn_appmgr.c @@ -320,6 +320,7 @@ void DeleteAppSpawningCtx(AppSpawningCtx *property) DeleteAppSpawnMsg(&property->message); OH_ListRemove(&property->node); + OH_ListInit(&property->node); if (property->forkCtx.timer) { LE_StopTimer(LE_GetDefaultLoop(), property->forkCtx.timer); property->forkCtx.timer = NULL; diff --git a/standard/appspawn_main.c b/standard/appspawn_main.c index ac4f7da8a7256a09e657bb61035d9222a2f825c1..ce15a629627c01b780ad45ba51e057bb2261b168 100644 --- a/standard/appspawn_main.c +++ b/standard/appspawn_main.c @@ -21,6 +21,7 @@ #include "appspawn_modulemgr.h" #include "appspawn_manager.h" #include "appspawn_service.h" +#include "appspawn_trace.h" #include "parameter.h" #include "securec.h" @@ -151,7 +152,9 @@ int main(int argc, char *const argv[]) arg->serviceName); } } + StartAppspawnTrace("StartSpawnService"); AppSpawnContent *content = StartSpawnService(arg, argvSize, argc, argv); + FinishAppspawnTrace(); if (content != NULL) { content->runAppSpawn(content, argc, argv); } diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index beef0504c21658cc33e4aca6516b793e7e5f8dd6..211d621a06173f17f6a54488275983d400d39655 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -195,7 +195,8 @@ APPSPAWN_STATIC void ProcessSignal(const struct signalfd_siginfo *siginfo) HandleDiedPid(pid, siginfo->ssi_uid, status); } #if (defined(CJAPP_SPAWN) || defined(NATIVE_SPAWN)) - if (OH_ListGetCnt(&GetAppSpawnMgr()->appQueue) == 0) { + if (OH_ListGetCnt(&GetAppSpawnMgr()->appQueue) == 0 && + OH_ListGetCnt(&GetAppSpawnMgr()->appSpawnQueue) == 0) { LE_StopLoop(LE_GetDefaultLoop()); } #endif @@ -1389,14 +1390,18 @@ AppSpawnContent *StartSpawnService(const AppSpawnStartArg *startArg, uint32_t ar } // load module appspawn/common + StartAppspawnTrace("AppSpawnLoadCommonModules"); AppSpawnLoadAutoRunModules(MODULE_COMMON); + FinishAppspawnTrace(); AppSpawnModuleMgrInstall(ASAN_MODULE_PATH); APPSPAWN_CHECK(LE_GetDefaultLoop() != NULL, return NULL, "Invalid default loop"); AppSpawnContent *content = AppSpawnCreateContent(arg->socketName, argv[0], argvSize, arg->mode); APPSPAWN_CHECK(content != NULL, return NULL, "Failed to create content for %{public}s", arg->socketName); + StartAppspawnTrace("AppSpawnLoadAutoRunModules"); AppSpawnLoadAutoRunModules(arg->moduleType); // load corresponding plugin according to startup mode + FinishAppspawnTrace(); int ret = ServerStageHookExecute(STAGE_SERVER_PRELOAD, content); // Preload, prase the sandbox APPSPAWN_CHECK(ret == 0, AppSpawnDestroyContent(content); return NULL, "Failed to prepare load %{public}s result: %{public}d", arg->serviceName, ret);