From 72b65262187c2b5f2268deb9dec4664d60dee72a Mon Sep 17 00:00:00 2001 From: wangfenging Date: Tue, 20 May 2025 22:53:34 +0800 Subject: [PATCH] Fix: clone app start before decrypt Signed-off-by: wangfenging --- common/appspawn_server.c | 4 + modules/sandbox/sandbox_shared_mount.cpp | 93 ++++++++++++------- modules/sandbox/sandbox_utils.cpp | 36 +++++-- standard/BUILD.gn | 1 - standard/appspawn_appmgr.c | 3 +- standard/appspawn_manager.h | 3 +- standard/appspawn_service.c | 11 ++- .../app_spawn_appmgr_test.cpp | 10 +- .../app_spawn_module_interface_test.cpp | 2 +- 9 files changed, 108 insertions(+), 55 deletions(-) diff --git a/common/appspawn_server.c b/common/appspawn_server.c index c59f93fa..d4dfac9a 100644 --- a/common/appspawn_server.c +++ b/common/appspawn_server.c @@ -26,8 +26,10 @@ #include "appspawn_utils.h" #ifndef OHOS_LITE #include "appspawn_manager.h" +#ifndef APPSPAWN_HELPER #include "ffrt_inner.h" #endif +#endif #define MAX_FORK_TIME (30 * 1000) // 30ms @@ -122,7 +124,9 @@ static int CloneAppSpawn(void *arg) { APPSPAWN_CHECK(arg != NULL, return -1, "Invalid content for appspawn"); APPSPAWN_LOGI("CloneNwebSpawn done."); +#ifndef APPSPAWN_HELPER ffrt_child_init(); +#endif AppSpawnForkArg *forkArg = (AppSpawnForkArg *)arg; ProcessExit(AppSpawnChild(forkArg->content, forkArg->client)); return 0; diff --git a/modules/sandbox/sandbox_shared_mount.cpp b/modules/sandbox/sandbox_shared_mount.cpp index a5e11c04..fb752f3e 100644 --- a/modules/sandbox/sandbox_shared_mount.cpp +++ b/modules/sandbox/sandbox_shared_mount.cpp @@ -158,20 +158,27 @@ static bool SetSandboxPathShared(const std::string &sandboxPath) return true; } -static int MountEl1Bundle(const AppSpawningCtx *property, const AppDacInfo *info, const char *bundleName) +static int MountEl1Bundle(const AppSpawningCtx *property, const AppDacInfo *info, const char *varBundleName) { /* /data/app/el1/bundle/public/ */ + AppSpawnMsgBundleInfo *bundleInfo = + reinterpret_cast(GetAppProperty(property, TLV_BUNDLE_INFO)); + if (bundleInfo == nullptr) { + return APPSPAWN_SANDBOX_INVALID; + } char sourcePath[PATH_MAX_LEN] = {0}; - int ret = snprintf_s(sourcePath, PATH_MAX_LEN, PATH_MAX_LEN - 1, "/data/app/el1/bundle/public/%s", bundleName); + int ret = snprintf_s(sourcePath, PATH_MAX_LEN, PATH_MAX_LEN - 1, "/data/app/el1/bundle/public/%s", + bundleInfo->bundleName); if (ret <= 0) { - APPSPAWN_LOGE("snprintf data/app/el1/bundle/public/%{public}s failed, errno %{public}d", bundleName, errno); + APPSPAWN_LOGE("snprintf data/app/el1/bundle/public/%{public}s failed, errno %{public}d", + bundleInfo->bundleName, errno); return APPSPAWN_ERROR_UTILS_MEM_FAIL; } - /* /mnt/sandbox///data/storage/el1/bundle */ + /* /mnt/sandbox///data/storage/el1/bundle */ char targetPath[PATH_MAX_LEN] = {0}; ret = snprintf_s(targetPath, PATH_MAX_LEN, PATH_MAX_LEN - 1, "/mnt/sandbox/%u/%s/data/storage/el1/bundle", - info->uid/ UID_BASE, bundleName); + info->uid/ UID_BASE, varBundleName); if (ret <= 0) { APPSPAWN_LOGE("snprintf el1 bundle sandbox path failed, errno %{public}d", errno); return APPSPAWN_ERROR_UTILS_MEM_FAIL; @@ -200,12 +207,12 @@ static int MountEl1Bundle(const AppSpawningCtx *property, const AppDacInfo *info if (ret != 0) { APPSPAWN_LOGE("mount %{public}s shared failed, ret %{public}d", targetPath, ret); } - std::string key = std::to_string(info->uid / UID_BASE) + "-" + std::string(bundleName); + std::string key = std::to_string(info->uid / UID_BASE) + "-" + std::string(varBundleName); g_mountInfoMap[key]++; return ret; } -static int MountWithFileMgr(const AppSpawningCtx *property, const AppDacInfo *info, const char *bundleName) +static int MountWithFileMgr(const AppSpawningCtx *property, const AppDacInfo *info, const char *varBundleName) { /* /mnt/user//nosharefs/docs */ char nosharefsDocsDir[PATH_MAX_LEN] = {0}; @@ -216,10 +223,10 @@ static int MountWithFileMgr(const AppSpawningCtx *property, const AppDacInfo *in return APPSPAWN_ERROR_UTILS_MEM_FAIL; } - /* /mnt/sandbox//storage/Users */ + /* /mnt/sandbox//storage/Users */ char storageUserPath[PATH_MAX_LEN] = {0}; ret = snprintf_s(storageUserPath, PATH_MAX_LEN, PATH_MAX_LEN - 1, "/mnt/sandbox/%u/%s/storage/Users", - info->uid / UID_BASE, bundleName); + info->uid / UID_BASE, varBundleName); if (ret <= 0) { APPSPAWN_LOGE("snprintf storageUserPath failed, errno %{public}d", errno); return APPSPAWN_ERROR_UTILS_MEM_FAIL; @@ -252,7 +259,7 @@ static int MountWithFileMgr(const AppSpawningCtx *property, const AppDacInfo *in return ret; } -static int MountWithOther(const AppSpawningCtx *property, const AppDacInfo *info, const char *bundleName) +static int MountWithOther(const AppSpawningCtx *property, const AppDacInfo *info, const char *varBundleName) { /* /mnt/user//sharefs/docs */ char sharefsDocsDir[PATH_MAX_LEN] = {0}; @@ -263,10 +270,10 @@ static int MountWithOther(const AppSpawningCtx *property, const AppDacInfo *info return APPSPAWN_ERROR_UTILS_MEM_FAIL; } - /* /mnt/sandbox//storage/Users */ + /* /mnt/sandbox//storage/Users */ char storageUserPath[PATH_MAX_LEN] = {0}; ret = snprintf_s(storageUserPath, PATH_MAX_LEN, PATH_MAX_LEN - 1, "/mnt/sandbox/%u/%s/storage/Users", - info->uid / UID_BASE, bundleName); + info->uid / UID_BASE, varBundleName); if (ret <= 0) { APPSPAWN_LOGE("snprintf storageUserPath failed, errno %{public}d", errno); return APPSPAWN_ERROR_UTILS_MEM_FAIL; @@ -307,17 +314,18 @@ static int MountWithOther(const AppSpawningCtx *property, const AppDacInfo *info return ret; } -static void MountStorageUsers(const AppSpawningCtx *property, const AppDacInfo *info, const char *bundleName) +static void MountStorageUsers(const AppSpawningCtx *property, const AppDacInfo *info, const char *varBundleName) { int ret = 0; int index = GetPermissionIndex(nullptr, "ohos.permission.FILE_ACCESS_MANAGER"); int checkRes = CheckAppPermissionFlagSet(property, static_cast(index)); if (checkRes == 0) { - /* mount /mnt/user//sharefs/docs to /mnt/sandbox///storage/Users */ - ret = MountWithOther(property, info, bundleName); + /* mount /mnt/user//sharefs/docs to /mnt/sandbox///storage/Users */ + ret = MountWithOther(property, info, varBundleName); } else { - /* mount /mnt/user//nosharefs/docs to /mnt/sandbox///storage/Users */ - ret = MountWithFileMgr(property, info, bundleName); + /* mount /mnt/user//nosharefs/docs to /mnt/sandbox///storage/Users + */ + ret = MountWithFileMgr(property, info, varBundleName); } if (ret != 0) { APPSPAWN_LOGE("Update %{public}s storage dir failed, ret %{public}d", @@ -327,13 +335,13 @@ static void MountStorageUsers(const AppSpawningCtx *property, const AppDacInfo * } } -static int MountSharedMapItem(const AppSpawningCtx *property, const AppDacInfo *info, const char *bundleName, +static int MountSharedMapItem(const AppSpawningCtx *property, const AppDacInfo *info, const char *varBundleName, const char *sandboxPathItem) { - /* /mnt/sandbox///data/storage/el */ + /* /mnt/sandbox///data/storage/el */ char sandboxPath[PATH_MAX_LEN] = {0}; int ret = snprintf_s(sandboxPath, PATH_MAX_LEN, PATH_MAX_LEN - 1, "/mnt/sandbox/%u/%s%s", - info->uid / UID_BASE, bundleName, sandboxPathItem); + info->uid / UID_BASE, varBundleName, sandboxPathItem); if (ret <= 0) { APPSPAWN_LOGE("snprintf sandboxPath failed, errno %{public}d", errno); return APPSPAWN_ERROR_UTILS_MEM_FAIL; @@ -366,17 +374,17 @@ static int MountSharedMapItem(const AppSpawningCtx *property, const AppDacInfo * return ret; } -static void MountSharedMap(const AppSpawningCtx *property, const AppDacInfo *info, const char *bundleName) +static void MountSharedMap(const AppSpawningCtx *property, const AppDacInfo *info, const char *varBundleName) { int length = sizeof(MOUNT_SHARED_MAP) / sizeof(MOUNT_SHARED_MAP[0]); for (int i = 0; i < length; i++) { if (MOUNT_SHARED_MAP[i].permission == nullptr) { - MountSharedMapItem(property, info, bundleName, MOUNT_SHARED_MAP[i].sandboxPath); + MountSharedMapItem(property, info, varBundleName, MOUNT_SHARED_MAP[i].sandboxPath); } else { int index = GetPermissionIndex(nullptr, MOUNT_SHARED_MAP[i].permission); APPSPAWN_LOGV("mount dir on lock mountPermissionFlags %{public}d", index); if (CheckAppPermissionFlagSet(property, static_cast(index))) { - MountSharedMapItem(property, info, bundleName, MOUNT_SHARED_MAP[i].sandboxPath); + MountSharedMapItem(property, info, varBundleName, MOUNT_SHARED_MAP[i].sandboxPath); } } } @@ -460,7 +468,7 @@ static void DumpDataGroupCtxQueue(const ListNode *front) } static int ParseDataGroupList(AppSpawnMgr *content, const AppSpawningCtx *property, AppDacInfo *info, - AppSpawnMsgBundleInfo *bundleInfo) + const char *varBundleName) { int ret = 0; std::string dataGroupList = GetExtraInfoByType(property, DATA_GROUP_SOCKET_TYPE); @@ -496,8 +504,8 @@ static int ParseDataGroupList(AppSpawnMgr *content, const AppSpawningCtx *proper } } - // sandboxPath: /mnt/sandbox///data/storage/el/group - std::string sandboxPath = "/mnt/sandbox/" + std::to_string(info->uid / UID_BASE) + "/" + bundleInfo->bundleName + // sandboxPath: /mnt/sandbox///data/storage/el/group + std::string sandboxPath = "/mnt/sandbox/" + std::to_string(info->uid / UID_BASE) + "/" + varBundleName + templateItem->sandboxPath; ret = AddDataGroupItemToQueue(content, srcPath, sandboxPath, item[GROUPLIST_KEY_UUID]); @@ -549,6 +557,23 @@ int UpdateDataGroupDirs(AppSpawnMgr *content) return 0; } +static std::string ReplaceVarBundleName(const AppSpawningCtx *property) +{ + AppSpawnMsgBundleInfo *bundleInfo = + reinterpret_cast(GetAppProperty(property, TLV_BUNDLE_INFO)); + if (bundleInfo == nullptr) { + return ""; + } + + std::string tmpBundlePath = bundleInfo->bundleName; + std::ostringstream variablePackageName; + if (CheckAppSpawnMsgFlag(property->message, TLV_MSG_FLAGS, APP_FLAGS_CLONE_ENABLE)) { + variablePackageName << "+clone-" << bundleInfo->bundleIndex << "+" << bundleInfo->bundleName; + tmpBundlePath = variablePackageName.str(); + } + return tmpBundlePath; +} + static void MountDirToShared(AppSpawnMgr *content, const AppSpawningCtx *property) { if (property == nullptr) { @@ -556,25 +581,25 @@ static void MountDirToShared(AppSpawnMgr *content, const AppSpawningCtx *propert } AppDacInfo *info = reinterpret_cast(GetAppProperty(property, TLV_DAC_INFO)); - AppSpawnMsgBundleInfo *bundleInfo = - reinterpret_cast(GetAppProperty(property, TLV_BUNDLE_INFO)); - if (info == NULL || bundleInfo == NULL) { + std::string varBundleName = ReplaceVarBundleName(property); + if (info == NULL || varBundleName == "") { + APPSPAWN_LOGE("Invalid app dac info or varBundleName"); return; } - MountEl1Bundle(property, info, bundleInfo->bundleName); + MountEl1Bundle(property, info, varBundleName.c_str()); if (IsUnlockStatus(info->uid)) { return; } - MountSharedMap(property, info, bundleInfo->bundleName); - MountStorageUsers(property, info, bundleInfo->bundleName); - ParseDataGroupList(content, property, info, bundleInfo); + MountSharedMap(property, info, varBundleName.c_str()); + MountStorageUsers(property, info, varBundleName.c_str()); + ParseDataGroupList(content, property, info, varBundleName.c_str()); std::string lockSbxPathStamp = "/mnt/sandbox/" + std::to_string(info->uid / UID_BASE) + "/"; lockSbxPathStamp += CheckAppMsgFlagsSet(property, APP_FLAGS_ISOLATED_SANDBOX_TYPE) ? "isolated/" : ""; - lockSbxPathStamp += bundleInfo->bundleName; + lockSbxPathStamp += varBundleName; lockSbxPathStamp += "_locked"; int ret = MakeDirRec(lockSbxPathStamp.c_str(), DIR_MODE, 1); if (ret != 0) { diff --git a/modules/sandbox/sandbox_utils.cpp b/modules/sandbox/sandbox_utils.cpp index 6f7e6272..1d559df1 100644 --- a/modules/sandbox/sandbox_utils.cpp +++ b/modules/sandbox/sandbox_utils.cpp @@ -642,20 +642,32 @@ std::string SandboxUtils::GetSbxPathByConfig(const AppSpawningCtx *appProperty, } std::string sandboxRoot = ""; + const std::string sandboxRootPathTemplate = "/mnt/sandbox//"; const std::string originSandboxPath = "/mnt/sandbox/"; std::string isolatedFlagText = CheckAppMsgFlagsSet(appProperty, APP_FLAGS_ISOLATED_SANDBOX_TYPE) ? "isolated/" : ""; - const std::string defaultSandboxRoot = g_sandBoxDir + to_string(dacInfo->uid / UID_BASE) + - "/" + isolatedFlagText.c_str() + GetBundleName(appProperty); + AppSpawnMsgBundleInfo *bundleInfo = + reinterpret_cast(GetAppProperty(appProperty, TLV_BUNDLE_INFO)); + if (bundleInfo == nullptr) { + return ""; + } + std::string tmpBundlePath = bundleInfo->bundleName; + std::ostringstream variablePackageName; + if (CheckAppSpawnMsgFlag(appProperty->message, TLV_MSG_FLAGS, APP_FLAGS_CLONE_ENABLE)) { + variablePackageName << "+clone-" << bundleInfo->bundleIndex << "+" << bundleInfo->bundleName; + tmpBundlePath = variablePackageName.str(); + } + const std::string variableSandboxRoot = g_sandBoxDir + to_string(dacInfo->uid / UID_BASE) + + "/" + isolatedFlagText.c_str() + tmpBundlePath; if (config.find(g_sandboxRootPrefix) != config.end()) { sandboxRoot = config[g_sandboxRootPrefix].get(); - if (sandboxRoot == originSandboxPath) { - sandboxRoot = defaultSandboxRoot; + if (sandboxRoot == originSandboxPath || sandboxRoot == sandboxRootPathTemplate) { + sandboxRoot = variableSandboxRoot; } else { sandboxRoot = ConvertToRealPath(appProperty, sandboxRoot); APPSPAWN_LOGV("set sandbox-root name is %{public}s", sandboxRoot.c_str()); } } else { - sandboxRoot = defaultSandboxRoot; + sandboxRoot = variableSandboxRoot; APPSPAWN_LOGV("set sandbox-root to default rootapp name is %{public}s", GetBundleName(appProperty)); } @@ -1765,14 +1777,13 @@ int32_t SandboxUtils::SetAppSandboxProperty(AppSpawningCtx *appProperty, uint32_ return -1; } - std::string sandboxPackagePath = g_sandBoxRootDir + to_string(dacInfo->uid / UID_BASE) + "/"; const std::string bundleName = GetBundleName(appProperty); + nlohmann::json tmpJson = {}; + std::string sandboxPackagePath = GetSbxPathByConfig(appProperty, tmpJson); + MakeDirRecursiveWithClock(sandboxPackagePath.c_str(), FILE_MODE); bool sandboxSharedStatus = GetSandboxPrivateSharedStatus(bundleName, appProperty) || (CheckAppPermissionFlagSet(appProperty, static_cast(GetPermissionIndex(nullptr, ACCESS_DLP_FILE_MODE.c_str()))) != 0); - sandboxPackagePath += CheckAppMsgFlagsSet(appProperty, APP_FLAGS_ISOLATED_SANDBOX_TYPE) ? "isolated/" : ""; - sandboxPackagePath += bundleName; - MakeDirRecursiveWithClock(sandboxPackagePath.c_str(), FILE_MODE); // add pid to a new mnt namespace int rc = EnableSandboxNamespace(appProperty, sandboxNsFlags); @@ -2024,8 +2035,13 @@ static int UmountSandboxPath(const AppSpawnMgr *content, const AppSpawnedProcess const char rootPath[] = "/mnt/sandbox/"; const char el1Path[] = "/data/storage/el1/bundle"; + std::string varBundleName = std::string(appInfo->name); + if (appInfo->appIndex > 0) { + varBundleName = "+clone-" + std::to_string(appInfo->appIndex) + "+" + varBundleName; + } + uint32_t userId = appInfo->uid / UID_BASE; - std::string key = std::to_string(userId) + "-" + std::string(appInfo->name); + std::string key = std::to_string(userId) + "-" + varBundleName; map *el1BundleCountMap = static_cast*>(GetEl1BundleMountCount()); if (el1BundleCountMap == nullptr || el1BundleCountMap->find(key) == el1BundleCountMap->end()) { return 0; diff --git a/standard/BUILD.gn b/standard/BUILD.gn index ae540d4d..e9c5b1ec 100644 --- a/standard/BUILD.gn +++ b/standard/BUILD.gn @@ -135,7 +135,6 @@ ohos_shared_library("appspawn_helper") { "-fstack-protector-all", ] external_deps = [ - "ffrt:libffrt", "hilog:libhilog", "init:libbegetutil", ] diff --git a/standard/appspawn_appmgr.c b/standard/appspawn_appmgr.c index 21a8c64e..32b94f7f 100644 --- a/standard/appspawn_appmgr.c +++ b/standard/appspawn_appmgr.c @@ -150,7 +150,7 @@ static int AppInfoCompareProc(ListNode *node, ListNode *newNode) return node1->pid - node2->pid; } -AppSpawnedProcess *AddSpawnedProcess(pid_t pid, const char *processName, bool isDebuggable) +AppSpawnedProcess *AddSpawnedProcess(pid_t pid, const char *processName, uint32_t appIndex, bool isDebuggable) { APPSPAWN_CHECK(g_appSpawnMgr != NULL && processName != NULL, return NULL, "Invalid mgr or process name"); APPSPAWN_CHECK(pid > 0, return NULL, "Invalid pid for %{public}s", processName); @@ -163,6 +163,7 @@ AppSpawnedProcess *AddSpawnedProcess(pid_t pid, const char *processName, bool is node->max = 0; node->uid = 0; node->exitStatus = 0; + node->appIndex = appIndex; node->isDebuggable = isDebuggable; int ret = strcpy_s(node->name, len, processName); APPSPAWN_CHECK(ret == 0, free(node); diff --git a/standard/appspawn_manager.h b/standard/appspawn_manager.h index 3c16cb2f..8cee8401 100644 --- a/standard/appspawn_manager.h +++ b/standard/appspawn_manager.h @@ -103,6 +103,7 @@ typedef struct TagAppSpawnedProcess { AppSpawnMsgNode *message; #endif bool isDebuggable; + uint32_t appIndex; char name[0]; } AppSpawnedProcess; @@ -163,7 +164,7 @@ AppSpawnContent *GetAppSpawnContent(void); */ typedef void (*AppTraversal)(const AppSpawnMgr *mgr, AppSpawnedProcess *appInfo, void *data); void TraversalSpawnedProcess(AppTraversal traversal, void *data); -AppSpawnedProcess *AddSpawnedProcess(pid_t pid, const char *processName, bool isDebuggable); +AppSpawnedProcess *AddSpawnedProcess(pid_t pid, const char *processName, uint32_t appIndex, bool isDebuggable); AppSpawnedProcess *GetSpawnedProcess(pid_t pid); AppSpawnedProcess *GetSpawnedProcessByName(const char *name); void TerminateSpawnedProcess(AppSpawnedProcess *node); diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index 02676577..8825ba3b 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -1082,7 +1082,14 @@ static void ProcessChildResponse(const WatcherHandle taskHandle, int fd, uint32_ // success bool isDebuggable = CheckAppMsgFlagsSet(property, APP_FLAGS_DEBUGGABLE); - AppSpawnedProcess *appInfo = AddSpawnedProcess(property->pid, GetBundleName(property), isDebuggable); + uint32_t appIndex = 0; + if (CheckAppMsgFlagsSet(property, APP_FLAGS_CLONE_ENABLE)) { + AppSpawnMsgBundleInfo *bundleInfo = (AppSpawnMsgBundleInfo *)GetAppProperty(property, TLV_BUNDLE_INFO); + if (bundleInfo != NULL) { + appIndex = bundleInfo->bundleIndex; + } + } + AppSpawnedProcess *appInfo = AddSpawnedProcess(property->pid, GetBundleName(property), appIndex, isDebuggable); if (appInfo) { AppSpawnMsgDacInfo *dacInfo = GetAppProperty(property, TLV_DAC_INFO); appInfo->uid = dacInfo != NULL ? dacInfo->uid : 0; @@ -1427,7 +1434,7 @@ AppSpawnContent *StartSpawnService(const AppSpawnStartArg *startArg, uint32_t ar #endif AddAppSpawnHook(STAGE_CHILD_PRE_RUN, HOOK_PRIO_LOWEST, AppSpawnClearEnv); if (arg->mode == MODE_FOR_APP_SPAWN) { - AddSpawnedProcess(pid, NWEBSPAWN_SERVER_NAME, false); + AddSpawnedProcess(pid, NWEBSPAWN_SERVER_NAME, 0, false); SetParameter("bootevent.appspawn.started", "true"); } return content; diff --git a/test/unittest/app_spawn_standard_test/app_spawn_appmgr_test.cpp b/test/unittest/app_spawn_standard_test/app_spawn_appmgr_test.cpp index f6012a28..c4099de4 100644 --- a/test/unittest/app_spawn_standard_test/app_spawn_appmgr_test.cpp +++ b/test/unittest/app_spawn_standard_test/app_spawn_appmgr_test.cpp @@ -124,7 +124,7 @@ HWTEST_F(AppSpawnAppMgrTest, App_Spawn_AppSpawnedProcess_001, TestSize.Level0) int result[resultCount] = {0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}; for (size_t i = 0; i < processNameCount; i++) { for (size_t j = 0; j < pidCount; j++) { - AppSpawnedProcess *app = AddSpawnedProcess(pidInput[j], processNameInput[i], false); + AppSpawnedProcess *app = AddSpawnedProcess(pidInput[j], processNameInput[i], 0, false); EXPECT_EQ(app != nullptr, result[i * pidCount + j]); } } @@ -167,7 +167,7 @@ HWTEST_F(AppSpawnAppMgrTest, App_Spawn_AppSpawnedProcess_002, TestSize.Level0) int result[resultCount] = {0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}; for (size_t i = 0; i < processNameCount; i++) { for (size_t j = 0; j < pidCount; j++) { - AppSpawnedProcess *app = AddSpawnedProcess(pidInput[j], processNameInput[i], false); + AppSpawnedProcess *app = AddSpawnedProcess(pidInput[j], processNameInput[i], 0, false); EXPECT_EQ(app != nullptr, result[i * pidCount + j]); } } @@ -205,7 +205,7 @@ HWTEST_F(AppSpawnAppMgrTest, App_Spawn_AppSpawnedProcess_003, TestSize.Level0) // GetSpawnedProcessByName size_t processNameCount = ARRAY_LENGTH(processNameInput); for (size_t i = 0; i < processNameCount; i++) { - AppSpawnedProcess *app = AddSpawnedProcess(1000, processNameInput[i], false); // 10000 + AppSpawnedProcess *app = AddSpawnedProcess(1000, processNameInput[i], 0, false); // 10000 EXPECT_EQ(app != nullptr, 1); } for (size_t i = 0; i < processNameCount; i++) { @@ -492,7 +492,7 @@ HWTEST_F(AppSpawnAppMgrTest, App_Spawn_AppSpawnMsgNode_005, TestSize.Level0) EXPECT_EQ(memcmp(buffer.data() + sizeof(AppSpawnMsg), outMsg->buffer, msgLen - sizeof(AppSpawnMsg)), 0); EXPECT_EQ(0, reminder); - AppSpawnedProcess *app = AddSpawnedProcess(9999999, "aaaa", false); // 9999999 test + AppSpawnedProcess *app = AddSpawnedProcess(9999999, "aaaa", 0, false); // 9999999 test EXPECT_EQ(app != nullptr, 1); TerminateSpawnedProcess(app); AppSpawnExtData extData; @@ -540,7 +540,7 @@ HWTEST_F(AppSpawnAppMgrTest, App_Spawn_AppSpawnMsgNode_006, TestSize.Level0) EXPECT_EQ(memcmp(buffer.data() + sizeof(AppSpawnMsg), outMsg->buffer, msgLen - sizeof(AppSpawnMsg)), 0); EXPECT_EQ(0, reminder); - AppSpawnedProcess *app = AddSpawnedProcess(9999999, "aaaa", false); // 9999999 test + AppSpawnedProcess *app = AddSpawnedProcess(9999999, "aaaa", 0, false); // 9999999 test EXPECT_EQ(app != nullptr, 1); ret = DecodeAppSpawnMsg(outMsg); diff --git a/test/unittest/app_spawn_standard_test/app_spawn_module_interface_test.cpp b/test/unittest/app_spawn_standard_test/app_spawn_module_interface_test.cpp index 29257231..bad1fd88 100644 --- a/test/unittest/app_spawn_standard_test/app_spawn_module_interface_test.cpp +++ b/test/unittest/app_spawn_standard_test/app_spawn_module_interface_test.cpp @@ -183,7 +183,7 @@ HWTEST_F(AppSpawnModuleInterfaceTest, App_Spawn_Process_Hook_001, TestSize.Level { AppSpawnMgr *mgr = CreateAppSpawnMgr(MODE_FOR_NWEB_SPAWN); EXPECT_EQ(mgr != nullptr, 1); - AppSpawnedProcess *app = AddSpawnedProcess(1000, "test-001", false); + AppSpawnedProcess *app = AddSpawnedProcess(1000, "test-001", 0, false); EXPECT_EQ(app != nullptr, 1); int ret = 0; -- Gitee