mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-25 12:23:20 -04:00
chage enableIsolationUid to isolationUid
Signed-off-by: zhang_hao_zheng <zhanghaozheng2@h-partners.com> Change-Id: I9d059bf14e79be793b459e1904d00b7d172d2eb2
This commit is contained in:
@@ -346,12 +346,12 @@ Ability_NativeChildProcess_ErrCode OH_Ability_UnregisterNativeChildProcessExitCa
|
||||
}
|
||||
|
||||
Ability_NativeChildProcess_ErrCode OH_Ability_ChildProcessConfigs_SetIsolationUid(
|
||||
Ability_ChildProcessConfigs* configs, bool enableIsolationUid)
|
||||
Ability_ChildProcessConfigs* configs, bool isolationUid)
|
||||
{
|
||||
if (configs == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null Ability_ChildProcessConfigs");
|
||||
return NCP_ERR_INVALID_PARAM;
|
||||
}
|
||||
configs->isIsolationUid = enableIsolationUid;
|
||||
configs->isIsolationUid = isolationUid;
|
||||
return NCP_NO_ERROR;
|
||||
}
|
||||
@@ -176,17 +176,20 @@ Ability_NativeChildProcess_ErrCode OH_Ability_ChildProcessConfigs_SetIsolationMo
|
||||
Ability_ChildProcessConfigs* configs, NativeChildProcess_IsolationMode isolationMode);
|
||||
|
||||
/**
|
||||
* @brief Sets whether to enable the isolation UID for the specified child process configs.
|
||||
* The isolationUid only takes effect in {@link OH_Ability_StartNativeChildProcessWithConfigs}.
|
||||
*
|
||||
* @brief Sets the UID isolation flag for the specified child process configs.
|
||||
* The isolationUid only takes effect when {@link OH_Ability_ChildProcessConfigs_SetIsolationMode}
|
||||
* is set to {@link NCP_ISOLATION_MODE_ISOLATED}.
|
||||
*
|
||||
* @param configs Pointer to the child process configs object. Must not be nullptr.
|
||||
* @param enableIsolationUid Whether to enable the isolation UID.
|
||||
* @return Returns {@link NCP_NO_ERROR} if the isolation UID is set successful.
|
||||
* Returns {@link NCP_NO_ERR_INVALID_PARAM} if the input parameters are invalid.
|
||||
* @since 20
|
||||
* @param isolationUid The UID isolation setting to apply.
|
||||
* - true: uses independent UID
|
||||
* - false: uses parent process's UID
|
||||
* @return Returns {@link NCP_NO_ERROR} if the UID isolation flag is set successfully.
|
||||
* Returns {@link NCP_ERR_INVALID_PARAM} if the input parameters are invalid.
|
||||
* @since 21
|
||||
*/
|
||||
Ability_NativeChildProcess_ErrCode OH_Ability_ChildProcessConfigs_SetIsolationUid(
|
||||
Ability_ChildProcessConfigs* configs, bool enableIsolationUid);
|
||||
Ability_ChildProcessConfigs* configs, bool isolationUid);
|
||||
|
||||
/**
|
||||
* @brief Sets the process name for the specified child process configs.
|
||||
|
||||
@@ -8500,10 +8500,9 @@ int32_t AppMgrServiceInner::StartChildProcess(const pid_t callingPid, pid_t &chi
|
||||
auto &options = request.options;
|
||||
childProcessRecord->SetEntryParams(args.entryParams);
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "srcEntry:%{private}s, args.entryParams size:%{public}zu,"
|
||||
" processName:%{public}s, args.fds size:%{public}zu, options.isolationMode:%{public}d,"
|
||||
"option.isolationUid: %{public}d",
|
||||
" processName:%{public}s, args.fds size:%{public}zu, options.isolationMode:%{public}d,",
|
||||
request.srcEntry.c_str(), args.entryParams.length(), childProcessRecord->GetProcessName().c_str(),
|
||||
args.fds.size(), options.isolationMode, options.isolationUid);
|
||||
args.fds.size(), options.isolationMode);
|
||||
return StartChildProcessImpl(childProcessRecord, appRecord, childPid, args, options);
|
||||
}
|
||||
|
||||
@@ -8722,7 +8721,7 @@ int32_t AppMgrServiceInner::GetChildProcessInfo(const std::shared_ptr<ChildProce
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (IN_PROCESS_CALL(bundleMgrHelper->GetBaseSharedBundleInfos(bundleInfo.name, info.hspList,
|
||||
if (IN_PROCESS_CALL(bundleMgrHelper->GetBaseSharedBundleInfos(appRecord->GetBundleName(), info.hspList,
|
||||
AppExecFwk::GetDependentBundleInfoFlag::GET_ALL_DEPENDENT_BUNDLE_INFO))) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "GetBaseSharedBundleInfos fail");
|
||||
return ERR_INVALID_VALUE;
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public:
|
||||
MOCK_METHOD2(SetProcessCacheEnable, int32_t(int32_t pid, bool enable));
|
||||
MOCK_METHOD2(SetSupportedProcessCache, int32_t(int32_t pid, bool isSupport));
|
||||
#ifdef SUPPORT_CHILD_PROCESS
|
||||
MOCK_METHOD4(CreateNativeChildProcess, int32_t(const std::string &libName,
|
||||
MOCK_METHOD3(CreateNativeChildProcess, int32_t(const std::string &libName,
|
||||
const sptr<IRemoteObject> &callback, const ChildProcessRequest &request));
|
||||
#endif // SUPPORT_CHILD_PROCESS
|
||||
MOCK_METHOD2(GetSupportedProcessCachePids, int32_t(const std::string &bundleName,
|
||||
|
||||
@@ -334,7 +334,8 @@ HWTEST_F(ChildProcessManagerTest, CreateNativeChildProcessByAppSpawnFork_0200, T
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::TEST, "CreateNativeChildProcessByAppSpawnFork_0200 called.");
|
||||
sptr<IRemoteObject> callback;
|
||||
auto ret = ChildProcessManager::GetInstance().CreateNativeChildProcessByAppSpawnFork("test.so", callback, "abc_123");
|
||||
auto ret = ChildProcessManager::GetInstance().CreateNativeChildProcessByAppSpawnFork("test.so", callback,
|
||||
"abc_123");
|
||||
EXPECT_NE(ret, ChildProcessManagerErrorCode::ERR_FORK_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
ChildProcessManagerErrorCode StartChildProcessWithArgs(const std::string &srcEntry, pid_t &pid,
|
||||
int32_t childProcessType, const AppExecFwk::ChildProcessArgs &args,
|
||||
const AppExecFwk::ChildProcessOptions &options);
|
||||
ChildProcessManagerErrorCode CreateChildProcessByAppSpawnFork(
|
||||
ChildProcessManagerErrorCode CreateNativeChildProcessByAppSpawnFork(
|
||||
const std::string &libName, const sptr<IRemoteObject> &callbackStub, const std::string &customProcessName = "",
|
||||
const bool isolationMode = false, const bool isIsolationUid = false);
|
||||
bool GetBundleInfo(AppExecFwk::BundleInfo &bundleInfo);
|
||||
|
||||
Reference in New Issue
Block a user