diff --git a/appspawn.gni b/appspawn.gni index 341012bfdaf159848a1e5f28f07b1999842b53e2..8720c7d0970ec70e2b651797908c40e3a442ac0c 100644 --- a/appspawn.gni +++ b/appspawn.gni @@ -42,6 +42,7 @@ declare_args() { appspawn_hitrace_option = true appspawn_napi_preload_path = "../appspawn_preload.json" appspawn_arkweb_preload = true + appspawn_change_sched = true } if (!defined(global_parts_info) || diff --git a/modules/common/BUILD.gn b/modules/common/BUILD.gn index 709b5da36281ee63f4304201345fb11cbf07200e..fda92dc41861449d348658105d4a1ed9ac2c97e1 100644 --- a/modules/common/BUILD.gn +++ b/modules/common/BUILD.gn @@ -111,6 +111,10 @@ ohos_shared_library("appspawn_common") { sources += [ "${appspawn_path}/modules/sysevent/hisysevent_adapter.cpp" ] } + if (appspawn_change_sched) { + defines += [ "APPSPAWN_SCHED_ENABLE" ] + } + subsystem_name = "${subsystem_name}" part_name = "${part_name}" install_enable = true diff --git a/modules/common/appspawn_common.c b/modules/common/appspawn_common.c index 7c6095d776e9c7bed2e24c42a0d5ec0dcee0ad2f..7aa6f201b624958463af81b252e4d715575b8b81 100644 --- a/modules/common/appspawn_common.c +++ b/modules/common/appspawn_common.c @@ -287,12 +287,14 @@ static int SetXpmConfig(const AppSpawnMgr *content, const AppSpawningCtx *proper static int SetUidGid(const AppSpawnMgr *content, const AppSpawningCtx *property) { +#ifdef APPSPAWN_SCHED_ENABLE if (IsAppSpawnMode(content) || IsHybridSpawnMode(content)) { struct sched_param param = { 0 }; param.sched_priority = 0; int ret = sched_setscheduler(0, SCHED_OTHER, ¶m); APPSPAWN_CHECK_ONLY_LOG(ret == 0, "UpdateSchedPrio failed ret: %{public}d, %{public}d", ret, errno); } +#endif AppSpawnMsgDacInfo *dacInfo = (AppSpawnMsgDacInfo *)GetAppProperty(property, TLV_DAC_INFO); APPSPAWN_CHECK(dacInfo != NULL, return APPSPAWN_TLV_NONE, "No tlv %{public}d in msg %{public}s", TLV_DAC_INFO, GetProcessName(property));