diff --git a/common/include/test/whitelistunittest/BUILD.gn b/common/include/test/whitelistunittest/BUILD.gn index e7544bf..cf58198 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 e524b33..3066906 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 2296f30..aca3323 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 49aacc0..094fe41 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 51fec9f..5c54f44 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 0908f88..7574038 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 d404e66..be58a5f 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 e972941..f031feb 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 0214051..48394f5 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",