diff --git a/common/include/test/whitelistunittest/BUILD.gn b/common/include/test/whitelistunittest/BUILD.gn index e7544bfe34d567be4ae0c533709f336f96846773..cf581984087907a18569481be300fc80e05840f6 100755 --- a/common/include/test/whitelistunittest/BUILD.gn +++ b/common/include/test/whitelistunittest/BUILD.gn @@ -68,6 +68,7 @@ ohos_unittest("distributed_input_white_list_test") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "ipc:ipc_core", diff --git a/common/include/white_list_util.cpp b/common/include/white_list_util.cpp index e524b33f57ae1fa837f8501fb30bb8e022d65886..3066906a78adc9d34943cb14c9255fbe1e2c6299 100644 --- a/common/include/white_list_util.cpp +++ b/common/include/white_list_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -21,6 +21,7 @@ #include #include "anonymous_string.h" +#include "config_policy_utils.h" #include "dinput_errcode.h" #include "dinput_log.h" @@ -30,8 +31,9 @@ namespace OHOS { namespace DistributedHardware { namespace DistributedInput { namespace { - const char* const SPLIT_LINE = "|"; - const char* const SPLIT_COMMA = ","; + const char * const SPLIT_LINE = "|"; + const char * const SPLIT_COMMA = ","; + const char * const WHITELIST_FILE_PATH = "etc/distributedhardware/dinput_business_event_whitelist.cfg"; const int32_t COMB_KEY_VEC_MIN_LEN = 2; const int32_t LAST_KEY_ACTION_LEN = 1; const int32_t LAST_KEY_LEN = 1; @@ -61,7 +63,8 @@ WhiteListUtil &WhiteListUtil::GetInstance(void) int32_t WhiteListUtil::Init() { - const char* const whiteListFilePath = "/vendor/etc/distributedhardware/dinput_business_event_whitelist.cfg"; + char buf[MAX_PATH_LEN] = {0}; + char *whiteListFilePath = GetOneCfgFile(WHITELIST_FILE_PATH, buf, MAX_PATH_LEN); std::ifstream inFile(whiteListFilePath, std::ios::in | std::ios::binary); if (!inFile.is_open()) { DHLOGE("WhiteListUtil Init error, file open fail path=%s", whiteListFilePath); @@ -78,7 +81,6 @@ int32_t WhiteListUtil::Init() DHLOGE("whitelist cfg file has too many lines or too complicated. lineNum is %d", lineNum); break; } - DHLOGI("read whitelist cfg, line=%s", line.c_str()); vecKeyCode.clear(); vecCombinationKey.clear(); @@ -108,7 +110,6 @@ int32_t WhiteListUtil::Init() } } inFile.close(); - std::string localNetworkId = GetLocalDeviceInfo().networkId; if (!localNetworkId.empty()) { SyncWhiteList(localNetworkId, vecWhiteList); diff --git a/interfaces/inner_kits/BUILD.gn b/interfaces/inner_kits/BUILD.gn index 2296f30cc7d176355a13abb8c91cf3d84c2bdbb4..aca332391e7c6ba2a777f1051b5a744f303cc593 100644 --- a/interfaces/inner_kits/BUILD.gn +++ b/interfaces/inner_kits/BUILD.gn @@ -90,6 +90,7 @@ ohos_shared_library("libdinput_sdk") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "ipc:ipc_core", diff --git a/interfaces/inner_kits/test/unittest/BUILD.gn b/interfaces/inner_kits/test/unittest/BUILD.gn index 49aacc02acaa0939413461ebb16189c17e6a5d6e..094fe41b0b4c01ad40574e37792ce56f2db2988f 100644 --- a/interfaces/inner_kits/test/unittest/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/BUILD.gn @@ -103,6 +103,7 @@ ohos_unittest("distributed_input_inner_test") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "eventhandler:libeventhandler", "ipc:ipc_core", ] diff --git a/interfaces/ipc/test/clientunittest/BUILD.gn b/interfaces/ipc/test/clientunittest/BUILD.gn index 51fec9f9841dc066675ea159995faee83f1d4b84..5c54f44bc3147494f6ea2daf3eb0d7795380c6e8 100644 --- a/interfaces/ipc/test/clientunittest/BUILD.gn +++ b/interfaces/ipc/test/clientunittest/BUILD.gn @@ -119,6 +119,7 @@ ohos_unittest("distributed_input_client_test") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "graphic_standard:surface", diff --git a/interfaces/ipc/test/ipcunittest/BUILD.gn b/interfaces/ipc/test/ipcunittest/BUILD.gn index 0908f88652c5492960cda012c9d9060ca7ea9a3f..7574038a0d651c4c72aa184dc0c1927b4eb19637 100644 --- a/interfaces/ipc/test/ipcunittest/BUILD.gn +++ b/interfaces/ipc/test/ipcunittest/BUILD.gn @@ -107,6 +107,7 @@ ohos_unittest("distributed_input_ipc_test") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "ipc:ipc_core", diff --git a/services/sink/sinkmanager/BUILD.gn b/services/sink/sinkmanager/BUILD.gn index d404e6602307bd48eb482652b5ec07802e9dce59..be58a5f92d7e0f179027449cbeb7b9d58a1d4da9 100644 --- a/services/sink/sinkmanager/BUILD.gn +++ b/services/sink/sinkmanager/BUILD.gn @@ -64,6 +64,7 @@ ohos_shared_library("libdinput_sink") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "eventhandler:libeventhandler", "graphic_standard:surface", "hisysevent_native:libhisysevent", diff --git a/services/sink/sinkmanager/test/sinkmanagerunittest/BUILD.gn b/services/sink/sinkmanager/test/sinkmanagerunittest/BUILD.gn index e972941f29738ee8863bf5c3a9ecb9b2d6751855..f031feb54772ff7629a69f9bbb9fc1c444c3418f 100755 --- a/services/sink/sinkmanager/test/sinkmanagerunittest/BUILD.gn +++ b/services/sink/sinkmanager/test/sinkmanagerunittest/BUILD.gn @@ -99,6 +99,7 @@ ohos_unittest("distributed_input_sinkmanager_test") { "access_token:libnativetoken", "access_token:libtoken_setproc", "c_utils:utils", + "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "graphic_standard:surface", diff --git a/services/source/sourcemanager/BUILD.gn b/services/source/sourcemanager/BUILD.gn index 021405170c7d9134a3d133d6d91b545987186381..48394f5900e90cfac4ff2dba26bdc76161443283 100644 --- a/services/source/sourcemanager/BUILD.gn +++ b/services/source/sourcemanager/BUILD.gn @@ -99,6 +99,7 @@ ohos_shared_library("libdinput_source") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "hisysevent_native:libhisysevent",