From 6da7fe5e755c961e7be781297ac40b79175af6b2 Mon Sep 17 00:00:00 2001 From: zhr758 Date: Wed, 13 Apr 2022 16:30:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8Eparam=E8=AF=BB=E5=8F=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhr758 --- frameworks/config_policy/BUILD.gn | 13 ++++++++++++- frameworks/config_policy/src/config_policy_utils.c | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/frameworks/config_policy/BUILD.gn b/frameworks/config_policy/BUILD.gn index de79819..aa5a393 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 7008418..1d2ec34 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"); } -- Gitee