diff --git a/frameworks/config_policy/BUILD.gn b/frameworks/config_policy/BUILD.gn index de798194f3aae199ca5abea00efa990ffab9ef52..aa5a39390bbcc543bac6b8666e627dfc660448de 100644 --- a/frameworks/config_policy/BUILD.gn +++ b/frameworks/config_policy/BUILD.gn @@ -22,11 +22,13 @@ config("config_policy_config") { include_dirs = [ "//base/customization/config_policy/interfaces/innerkits/include", "//third_party/bounds_checking_function/include", + "//base/startup/init_lite/services/include", ] } if (defined(ohos_lite)) { shared_library("configpolicy_util") { + defines = [ "OHOS_LITE" ] sources = config_policy_sources public_configs = [ ":config_policy_config" ] deps = [ "//third_party/bounds_checking_function:libsec_shared" ] @@ -35,7 +37,16 @@ if (defined(ohos_lite)) { ohos_shared_library("configpolicy_util") { sources = config_policy_sources public_configs = [ ":config_policy_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_static" ] + deps = [ + "//base/startup/init_lite/services/param:param_client", + "//third_party/bounds_checking_function:libsec_static", + ] + subsystem_name = "customization" + part_name = "config_policy" + } + ohos_static_library("configpolicy_util_for_init_static") { + sources = config_policy_sources + public_configs = [ ":config_policy_config" ] subsystem_name = "customization" part_name = "config_policy" } diff --git a/frameworks/config_policy/src/config_policy_utils.c b/frameworks/config_policy/src/config_policy_utils.c index 70084186b9e2ba29c5142a79854b42c5327e4a24..1d2ec344cc04c6243983fcc04457560abbd615d3 100644 --- a/frameworks/config_policy/src/config_policy_utils.c +++ b/frameworks/config_policy/src/config_policy_utils.c @@ -18,6 +18,10 @@ #include #include +#ifndef OHOS_LITE +#include "param/sys_param.h" +#endif + void FreeCfgFiles(CfgFiles *res) { if (res == NULL) { @@ -49,6 +53,15 @@ static void GetCfgDirRealPolicyValue(CfgDir *res) if (res == NULL) { return; } +#ifndef OHOS_LITE + unsigned int len = 0; + const char *layerParamKey = "const.customization.config_policy_layer"; + SystemGetParameter(layerParamKey, NULL, &len); + if (len > 0 && (res->realPolicyValue = malloc(len))) { + SystemGetParameter(layerParamKey, res->realPolicyValue, &len); + return; + } +#endif res->realPolicyValue = strdup("/system:/chipset:/sys_prod:/chip_prod"); }