diff --git a/bundle.json b/bundle.json index f6e4c89a39c65751af6652eb4d142885a45ab119..2eb63d47622edcd2fa9a3112594658ca99f1c72e 100644 --- a/bundle.json +++ b/bundle.json @@ -45,6 +45,12 @@ "name": "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" }, { + "header": { + "header_base": "//base/customization/config_policy/interfaces/inner_api/include", + "header_files": [ + "config_policy_utils.h" + ] + }, "name": "//base/customization/config_policy/frameworks/config_policy:configpolicy_util_for_init_static", "visibility": ["init"] } diff --git a/config_policy.gni b/config_policy.gni index c4a6a69d336d155a901fb1a697dc5d7c45ff9b3c..f3349725110cf320f3979bed526e50e0d6dceb6b 100644 --- a/config_policy.gni +++ b/config_policy.gni @@ -11,6 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +TEL_CORESERVICE_ROOT_DIR = "//base/telephony/core_service" +STARTUP_INIT_ROOT_DIR = "//base/startup/init" declare_args() { # if fs has prefix before OH path, set it here config_policy_fs_prefix = "" diff --git a/frameworks/config_policy/BUILD.gn b/frameworks/config_policy/BUILD.gn index e167f3a5ef2c3546bce0b3f4219ffbd0c63f6a9d..b818a1577a2dd9c54776b10a31d84dc05879bb2c 100644 --- a/frameworks/config_policy/BUILD.gn +++ b/frameworks/config_policy/BUILD.gn @@ -43,6 +43,7 @@ if (defined(ohos_lite) && ohos_kernel_type == "liteos_m") { ohos_shared_library("configpolicy_util") { sources = config_policy_sources public_configs = [ ":config_policy_config" ] + include_dirs = [ "$TEL_CORESERVICE_ROOT_DIR/utils/common/include" ] deps = [ "etc:customization_etc" ] external_deps = [ "bounds_checking_function:libsec_shared", @@ -63,6 +64,7 @@ if (defined(ohos_lite) && ohos_kernel_type == "liteos_m") { ohos_static_library("configpolicy_util_for_init_static") { sources = config_policy_sources public_configs = [ ":config_policy_config" ] + include_dirs = [ "$TEL_CORESERVICE_ROOT_DIR/utils/common/include" ] external_deps = [ "bounds_checking_function:libsec_shared", "init:export_headers_lib", diff --git a/frameworks/config_policy/src/config_policy_utils.c b/frameworks/config_policy/src/config_policy_utils.c index 9dcf4d7f644cc70e91391f94acb15a8cf77e1316..8c1048634ccf264d6e32203e2233f72bd94a5c00 100644 --- a/frameworks/config_policy/src/config_policy_utils.c +++ b/frameworks/config_policy/src/config_policy_utils.c @@ -23,6 +23,7 @@ #include "config_policy_impl.h" #ifndef __LITEOS__ #include "init_param.h" +#include "telephony_config_c.h" #endif static const size_t MIN_APPEND_LEN = 32; @@ -36,10 +37,7 @@ static const unsigned int MIN_OPKEY_LEN = 3; // exampe:"etc/xml/config.xml,10:etc/xml/config1.xml,100,etc/carrier/${key:-value}" static const char SEP_FOR_X_RULE = ':'; static const char SEP_FOR_X_PARAM = ','; -static const char * const SEP_FOR_X_VALUE = ":-"; - -static const char * const CUST_OPKEY0 = "telephony.sim.opkey0"; -static const char * const CUST_OPKEY1 = "telephony.sim.opkey1"; +static const char *SEP_FOR_X_VALUE = ":-"; typedef struct { size_t size; // allocated buffer size of p @@ -116,7 +114,7 @@ static char *CustGetSystemParam(const char *name) static char *GetOpkeyPath(int type) { char *result = NULL; - const char * const opKeyDir = "etc/carrier/"; + const char *opKeyDir = "etc/carrier/"; const char *opKeyName = CUST_OPKEY0; if (type == FOLLOWX_MODE_SIM_1) { opKeyName = CUST_OPKEY0; diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 3dae7fb359ccbc71fb41a12b79cf3ebccdf5c44c..b0e4c6a4e77f01254325502f3315f76548112372 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -20,14 +20,17 @@ if (defined(ohos_lite)) { } config_policy_sources = [ "config_policy_utils_test.cpp" ] -config_policy_include_dirs = [ "../../interfaces/inner_api/include" ] +config_policy_include_dirs = [ + "../../interfaces/inner_api/include", + "$TEL_CORESERVICE_ROOT_DIR/utils/common/include", +] config_policy_deps = [ "../../frameworks/config_policy:configpolicy_util" ] if (defined(ohos_lite)) { unittest("ConfigPolicyUtilsTest") { output_extension = "bin" sources = config_policy_sources - include_dirs = config_policy_include_dirs + include_dirs = [ "../../interfaces/inner_api/include" ] deps = config_policy_deps } group("unittest") { diff --git a/test/unittest/config_policy_utils_test.cpp b/test/unittest/config_policy_utils_test.cpp index 8c1878cf0ea7d3effd4da9dc02842215a9bee2d8..6128a94eb2bed6af0eb503ed70441f1706a0ea71 100644 --- a/test/unittest/config_policy_utils_test.cpp +++ b/test/unittest/config_policy_utils_test.cpp @@ -21,9 +21,7 @@ #include "config_policy_impl.h" #ifndef __LITEOS__ #include "init_param.h" - -constexpr const char *CUST_OPKEY0 = "telephony.sim.opkey0"; -constexpr const char *CUST_OPKEY1 = "telephony.sim.opkey1"; +#include "telephony_config_c.h" #endif using namespace testing::ext;