diff --git a/application/protector/BUILD.gn b/application/protector/BUILD.gn index 951c788d1152c516d1b8746e80367b6516022169..d0af7ff54af499c42c4c221b8ecdf9e6ff42e68d 100644 --- a/application/protector/BUILD.gn +++ b/application/protector/BUILD.gn @@ -49,15 +49,11 @@ ohos_executable("thermal_protector") { external_deps = [ "c_utils:utils", + "config_policy:configpolicy_util", "hilog:libhilog", "libxml2:libxml2", ] - if (has_thermal_config_policy_part) { - defines = [ "HAS_THERMAL_CONFIG_POLICY_PART" ] - external_deps += [ "config_policy:configpolicy_util" ] - } - install_enable = true part_name = "thermal_manager" subsystem_name = "powermgr" diff --git a/application/protector/src/thermal_kernel_service.cpp b/application/protector/src/thermal_kernel_service.cpp index 8f040e3a8204dd26e500e001d79b6a34a306a59e..0d55ed74d70c3046c0e77440ddac86a4fd156330 100644 --- a/application/protector/src/thermal_kernel_service.cpp +++ b/application/protector/src/thermal_kernel_service.cpp @@ -16,16 +16,12 @@ #include "thermal_kernel_service.h" #include "thermal_common.h" #include "thermal_kernel_config_file.h" -#ifdef HAS_THERMAL_CONFIG_POLICY_PART #include "config_policy_utils.h" -#endif namespace OHOS { namespace PowerMgr { namespace { -#ifdef HAS_THERMAL_CONFIG_POLICY_PART constexpr const char* THERMAL_KERNEL_CONFIG_PATH = "etc/thermal_config/thermal_kernel_config.xml"; -#endif constexpr const char* VENDOR_THERMAL_KERNEL_CONFIG_PATH = "/vendor/etc/thermal_config/thermal_kernel_config.xml"; constexpr const char* SYSTEM_THERMAL_KERNEL_CONFIG_PATH = "/system/etc/thermal_config/thermal_kernel_config.xml"; } @@ -54,9 +50,8 @@ bool ThermalKernelService::Init() timer_ = std::make_shared(provision_); } - bool parseConfigSuc = false; -#ifdef HAS_THERMAL_CONFIG_POLICY_PART char buf[MAX_PATH_LEN]; + bool parseConfigSuc = false; char* path = GetOneCfgFile(THERMAL_KERNEL_CONFIG_PATH, buf, MAX_PATH_LEN); if (path != nullptr && *path != '\0') { if (!ThermalKernelConfigFile::GetInstance().Init(path)) { @@ -65,7 +60,7 @@ bool ThermalKernelService::Init() } parseConfigSuc = true; } -#endif + if (!parseConfigSuc) { if (!ThermalKernelConfigFile::GetInstance().Init(VENDOR_THERMAL_KERNEL_CONFIG_PATH)) { THERMAL_HILOGE(FEATURE_PROTECTOR, "failed to parse vendor config"); diff --git a/bundle.json b/bundle.json index cceeb03ad900799769338418ad111d404b093220..829ce667bbf0db2d0c2e95837b8d1516b8fc1361 100644 --- a/bundle.json +++ b/bundle.json @@ -36,7 +36,6 @@ "battery_statistics", "battery_manager", "bundle_framework", - "cJSON", "common_event_service", "config_policy", "c_utils", diff --git a/services/BUILD.gn b/services/BUILD.gn index 2d6ae5500e180321cce49d5a28cc210ac8f5de17..84d8d0a4a79e9c3b334fb2ea420b4b8e125abb61 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -90,6 +90,7 @@ ohos_shared_library("thermalservice") { "${utils_path}:coverage_flags", ] + defines = [] if (use_libfuzzer) { defines += [ "FUZZ_TEST" ] } @@ -109,12 +110,14 @@ ohos_shared_library("thermalservice") { "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", "drivers_interface_thermal:libthermal_proxy_1.1", "ffrt:libffrt", "hdf_core:libhdi", "hdf_core:libpub_utils", "hicollie:libhicollie", "hilog:libhilog", + "hisysevent:libhisysevent", "image_framework:image_native", "init:libbegetutil", "ipc:ipc_core", @@ -133,16 +136,11 @@ ohos_shared_library("thermalservice") { } if (has_thermal_audio_framework_part && - thermal_manager_audio_framework_enable) { + thermal_manager_audio_framework_enable) { defines += [ "HAS_THERMAL_AUDIO_FRAMEWORK_PART" ] external_deps += [ "audio_framework:audio_client" ] } - if (has_thermal_config_policy_part) { - defines += [ "HAS_THERMAL_CONFIG_POLICY_PART" ] - external_deps += [ "config_policy:configpolicy_util" ] - } - if (has_thermal_display_manager_part) { external_deps += [ "display_manager:displaymgr" ] } @@ -169,10 +167,6 @@ ohos_shared_library("thermalservice") { defines += [ "THERMAL_USER_VERSION" ] } - if (has_hiviewdfx_hisysevent_part) { - external_deps += [ "hisysevent:libhisysevent" ] - } - subsystem_name = "powermgr" part_name = "thermal_manager" } diff --git a/services/native/src/thermal_policy/thermal_config_sensor_cluster.cpp b/services/native/src/thermal_policy/thermal_config_sensor_cluster.cpp index fa56b0699e5ea3e590ba769090d349b1d4c6c471..112da2f5b59e942ca7457f7ff2fc953770777b43 100644 --- a/services/native/src/thermal_policy/thermal_config_sensor_cluster.cpp +++ b/services/native/src/thermal_policy/thermal_config_sensor_cluster.cpp @@ -360,7 +360,7 @@ bool ThermalConfigSensorCluster::IsTempDiffTrigger(const TypeTempMap& typeTempIn auto& tempDiffInfo = tempDiffInfoList_.at(level - 1); auto& sensor1 = tempDiffInfo.sensor1; auto& sensor2 = tempDiffInfo.sensor2; - + std::map::const_iterator ite1 = typeTempInfo.end(); std::map::const_iterator ite2 = typeTempInfo.end(); if ((ite1 = typeTempInfo.find(sensor1)) == typeTempInfo.end() diff --git a/services/native/src/thermal_service.cpp b/services/native/src/thermal_service.cpp index 9a4d076fab4c7d5baacdbe749532a4ec0c02d7d2..ac3eaeb0322366de71a9e20a0c43b228937d080f 100644 --- a/services/native/src/thermal_service.cpp +++ b/services/native/src/thermal_service.cpp @@ -27,9 +27,7 @@ #include #include -#ifdef HAS_THERMAL_CONFIG_POLICY_PART #include "config_policy_utils.h" -#endif #include "constants.h" #include "ffrt_utils.h" #include "permission.h" @@ -54,6 +52,7 @@ constexpr const char* THERMAL_PLUGIN_AUTORUN_PATH = "/system/lib/thermalplugin/a const std::string THERMAL_SERVICE_CONFIG_PATH = "etc/thermal_config/thermal_service_config.xml"; const std::string VENDOR_THERMAL_SERVICE_CONFIG_PATH = "/vendor/etc/thermal_config/thermal_service_config.xml"; const std::string SYSTEM_THERMAL_SERVICE_CONFIG_PATH = "/system/etc/thermal_config/thermal_service_config.xml"; +constexpr const char* THMERMAL_SERVICE_NAME = "ThermalService"; constexpr const char* HDI_SERVICE_NAME = "thermal_interface_service"; FFRTQueue g_queue("thermal_service"); constexpr uint32_t RETRY_TIME = 1000; @@ -254,7 +253,6 @@ bool ThermalService::InitConfigFile() THERMAL_HILOGI(COMP_SVC, "system config file has parsed."); return true; } -#ifdef HAS_THERMAL_CONFIG_POLICY_PART char buf[MAX_PATH_LEN]; char* path = GetOneCfgFile(THERMAL_SERVICE_CONFIG_PATH.c_str(), buf, MAX_PATH_LEN); if (path != nullptr && *path != '\0') { @@ -265,7 +263,6 @@ bool ThermalService::InitConfigFile() THERMAL_HILOGE(COMP_SVC, "policy config file config init err"); return false; } -#endif if (configParser_.ThermalSrvConfigInit(VENDOR_THERMAL_SERVICE_CONFIG_PATH)) { THERMAL_HILOGD(COMP_SVC, "thermal service config init suc:VENDOR_CONFIG"); diff --git a/test/fuzztest/thermalservice_fuzzer/thermalservice_fuzzer_test.cpp b/test/fuzztest/thermalservice_fuzzer/thermalservice_fuzzer_test.cpp index fba4e832afa470b8d19e6678add40e5ad722129c..c14693691660e40495e555d5c8fc153611f8cc54 100644 --- a/test/fuzztest/thermalservice_fuzzer/thermalservice_fuzzer_test.cpp +++ b/test/fuzztest/thermalservice_fuzzer/thermalservice_fuzzer_test.cpp @@ -64,7 +64,7 @@ void ThermalServiceFuzzTest001() event.info.push_back(info); g_service->HandleThermalCallbackEvent(event); TypeTempMap tempMap; - g_service->isTempReport_ = false; + g_service->isTempReport_ = true; g_service->HandleTempEmulation(tempMap); g_service->RegisterFanHdiCallback(); g_service->HandleFanCallbackEvent(event); @@ -74,7 +74,7 @@ void ThermalServiceFuzzTest001() g_service->Dump(fd, args); g_service->isBootCompleted_ = true; g_service->Dump(fd, args); - g_service->ready_ = false; + g_service->ready_ = true; g_service->OnStop(); g_service->EnableMock("", nullptr); g_service->DestroyInstance(); diff --git a/test/systemtest/BUILD.gn b/test/systemtest/BUILD.gn index accb51001ef8bc2b001006383535edf4a1a8b116..7231f8b045355771b2b2407b62dd5c6064086563 100644 --- a/test/systemtest/BUILD.gn +++ b/test/systemtest/BUILD.gn @@ -36,7 +36,6 @@ deps_ex = [ "hdf_core:libhdi", "bundle_framework:appexecfwk_base", "common_event_service:cesfwk_innerkits", - "cJSON:cjson_static", "c_utils:utils", "libxml2:libxml2", "drivers_interface_thermal:libthermal_proxy_1.1", @@ -95,6 +94,7 @@ ohos_systemtest("ThermalMgrInterfaceTest") { "googletest:gtest_main", ] + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -141,6 +141,7 @@ ohos_systemtest("ThermalMgrDialogTest") { "googletest:gtest_main", ] + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -178,6 +179,7 @@ ohos_systemtest("ThermalLevelEventSystemTest") { external_deps += [ "googletest:gtest_main" ] + defines = [] if (defined(global_parts_info) && defined(global_parts_info.powermgr_battery_manager)) { defines += [ "BATTERY_MANAGER_ENABLE" ] diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index e824be7e022be446f722270543375e2b843a429a..d70f59f4f5f2f08068c00b34327ccf45b19330f3 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -89,7 +89,7 @@ ohos_unittest("ThermalMockActionTest") { "${utils_path}:coverage_flags", ] - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -150,6 +150,7 @@ ohos_unittest("ThermalMgrPolicyTest") { external_deps += [ "init:libbegetutil" ] + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -199,6 +200,7 @@ ohos_unittest("ThermalLevelEventTest") { "access_token:libtoken_setproc", ] + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -238,6 +240,7 @@ ohos_unittest("ThermalClientApiTest") { external_deps = deps_ex + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -281,6 +284,7 @@ ohos_unittest("ThermalActionHubTest") { external_deps = deps_ex + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -322,6 +326,7 @@ ohos_unittest("ThermalActionReportTest") { "${thermal_service_zidl}:thermalmgr_stub", ] + defines = [] if (defined(global_parts_info) && defined(global_parts_info.powermgr_battery_statistics)) { defines += [ "BATTERY_STATS_ENABLE" ] @@ -382,6 +387,7 @@ ohos_unittest("ThermalMockProxyTest") { external_deps = deps_ex + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -425,6 +431,7 @@ ohos_unittest("ThermalMockProxyRemoteTest") { external_deps = deps_ex + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -459,7 +466,7 @@ ohos_unittest("ThermalMockProxyWriteinterfacetokenTest") { "${utils_path}:coverage_flags", ] - defines += [ "MOCK_WRITE_INTERFACE_TOKEN_RETURN_FALSE" ] + defines = [ "MOCK_WRITE_INTERFACE_TOKEN_RETURN_FALSE" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -505,7 +512,7 @@ ohos_unittest("ThermalMockProxyWriteremoteobjectTest") { "${utils_path}:coverage_flags", ] - defines += [ "MOCK_WRITE_REMOTE_OBJECT_RETURN_FALSE" ] + defines = [ "MOCK_WRITE_REMOTE_OBJECT_RETURN_FALSE" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -551,7 +558,7 @@ ohos_unittest("ThermalMockProxyWritevectorTest") { "${utils_path}:coverage_flags", ] - defines += [ "MOCK_WRITEVECTOR_RETURN_FALSE" ] + defines = [ "MOCK_WRITEVECTOR_RETURN_FALSE" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -596,7 +603,7 @@ ohos_unittest("ThermalMockProxySendrequestTest") { "${utils_path}:coverage_flags", ] - defines += [ "MOCK_SEND_REQUEST_RETURN_ONE" ] + defines = [ "MOCK_SEND_REQUEST_RETURN_ONE" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -646,6 +653,7 @@ ohos_unittest("ThermalUtilsTest") { external_deps = deps_ex + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -692,6 +700,7 @@ ohos_unittest("ThermalApplicationTest") { deps = [ "${utils_path}:thermal_utils" ] + defines = [] external_deps = deps_ex external_deps += [ "googletest:gtest_main" ] defines += [ "THERMAL_GTEST" ] @@ -718,7 +727,7 @@ ohos_unittest("ThermalServiceDeathTest") { "${utils_path}:coverage_flags", ] - defines += [ "THERMAL_SERVICE_DEATH_UT" ] + defines = [ "THERMAL_SERVICE_DEATH_UT" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -773,6 +782,7 @@ ohos_unittest("ThermalListenerTest") { external_deps = deps_ex + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -824,6 +834,7 @@ ohos_unittest("ThermalClientTest") { "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", + "hisysevent:libhisysevent", "ipc:ipc_core", "libxml2:libxml2", "power_manager:powermgr_client", @@ -832,10 +843,7 @@ ohos_unittest("ThermalClientTest") { "window_manager:libwm", ] - if (has_hiviewdfx_hisysevent_part) { - external_deps += [ "hisysevent:libhisysevent" ] - } - + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -857,7 +865,7 @@ ohos_unittest("ThermalMockStubTest") { } module_out_path = module_output_path - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] sources = [ "src/thermal_mock_stub_test.cpp" ] configs = [ @@ -914,6 +922,7 @@ ohos_unittest("ThermalMockStubGetdescriptorTest") { external_deps = deps_ex + defines = [] if (has_thermal_airplane_manager_part) { defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] external_deps += [ "netmanager_base:net_conn_manager_if" ] @@ -947,7 +956,7 @@ ohos_unittest("ThermalActionTest") { "${utils_path}:coverage_flags", ] - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -985,7 +994,7 @@ ohos_unittest("ThermalObserverTest") { "${utils_path}:coverage_flags", ] - defines += [ "THERMAL_OBSERVER_UT_TEST" ] + defines = [ "THERMAL_OBSERVER_UT_TEST" ] deps = [ "${thermal_inner_api}:thermalsrv_client", @@ -1021,7 +1030,7 @@ ohos_unittest("ThermalServiceTest") { } module_out_path = module_output_path - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] sources = [ "src/thermal_service_test.cpp" ] configs = [ @@ -1062,7 +1071,7 @@ ohos_unittest("ThermalConfigSensorClusterTest") { } module_out_path = module_output_path - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] sources = [ "src/thermal_config_sensor_cluster_test.cpp" ] configs = [ @@ -1101,7 +1110,7 @@ ohos_unittest("ThermalMgrDumpTest") { } module_out_path = module_output_path - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] sources = [ "src/thermal_mgr_dump_test.cpp" ] configs = [ @@ -1140,7 +1149,7 @@ ohos_unittest("ThermalPolicyTest") { } module_out_path = module_output_path - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] sources = [ "src/thermal_policy_test.cpp" ] configs = [ @@ -1181,7 +1190,7 @@ ohos_unittest("FanFaultDetectTest") { } module_out_path = module_output_path - defines += [ "THERMAL_GTEST" ] + defines = [ "THERMAL_GTEST" ] sources = [ "src/fan_fault_detect_test.cpp" ] configs = [ @@ -1197,13 +1206,10 @@ ohos_unittest("FanFaultDetectTest") { "${thermal_service_zidl}:thermalmgr_stub", ] - external_deps = [] - if (has_hiviewdfx_hisysevent_part) { - external_deps = [ - "hisysevent:libhisysevent", - "hisysevent:libhisyseventmanager", - ] - } + external_deps = [ + "hisysevent:libhisysevent", + "hisysevent:libhisyseventmanager", + ] external_deps += deps_ex diff --git a/test/unittest/src/fan_fault_detect_test.cpp b/test/unittest/src/fan_fault_detect_test.cpp index 59981176f9f6490a81cd7bec6e170c783ca3db96..d97835849f720850186a05197f5bb4ef6b4c2e8a 100644 --- a/test/unittest/src/fan_fault_detect_test.cpp +++ b/test/unittest/src/fan_fault_detect_test.cpp @@ -19,17 +19,14 @@ #include #include -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART #include "hisysevent.h" #include "hisysevent_listener.h" #include "hisysevent_manager.h" #include "hisysevent_record.h" -#endif #include "thermal_log.h" + using namespace testing::ext; -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART using namespace OHOS::HiviewDFX; -#endif using namespace OHOS::PowerMgr; namespace { @@ -47,15 +44,11 @@ const int32_t FAN_SLOW_SPEED = 400; const int32_t FAN_FAST_SPEED = 1600; const int32_t TEMP_HIGH = 60000; const int32_t TEMP_LOW = 20000; - -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART const int64_t TIME_OUT = 2; -std::atomic_bool g_eventTriggered = false; -#endif - std::mutex g_mutex; std::condition_variable g_callbackCV; -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART +std::atomic_bool g_eventTriggered = false; + class Watcher : public HiSysEventListener { public: explicit Watcher(std::function)> func) : func_(func) {} @@ -74,7 +67,6 @@ public: private: std::function)> func_; }; -#endif } // namespace void FanFaultDetectTest::SetUpTestCase() {} @@ -109,7 +101,7 @@ void FanFaultDetectTest::GetFaultId(int64_t& faultId, const FanSensorInfo& repor std::shared_ptr fanFaultDetect = std::make_shared(); EXPECT_NE(fanFaultDetect, nullptr); InitFanFaultInfoMap(fanFaultDetect); -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART + auto watcher = std::make_shared([&faultId] (std::shared_ptr sysEvent) { if (sysEvent == nullptr) { return; @@ -134,7 +126,6 @@ void FanFaultDetectTest::GetFaultId(int64_t& faultId, const FanSensorInfo& repor ret = OHOS::HiviewDFX::HiSysEventManager::RemoveListener(watcher); EXPECT_TRUE(ret == SUCCESS); -#endif } namespace { diff --git a/test/unittest/src/thermal_config_file_parser.cpp b/test/unittest/src/thermal_config_file_parser.cpp index 92ed0d470cde2383bdc8ff476be8d2815fa7fb3e..33ca642dbdafe5bcba107dfdd16074f605fcab20 100644 --- a/test/unittest/src/thermal_config_file_parser.cpp +++ b/test/unittest/src/thermal_config_file_parser.cpp @@ -39,14 +39,12 @@ bool ThermalConfigFileParser::Init() bool ThermalConfigFileParser::GetActionEnableEvent(const std::string& actionName) { -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART for (auto iter : actionItem_) { if (iter.name.compare(actionName) == 0 || actionName.find(iter.name) != std::string::npos) { return iter.enableEvent; } } -#endif return false; } diff --git a/test/unittest/src/thermal_service_test.cpp b/test/unittest/src/thermal_service_test.cpp index 89da1f2bc0cf41f678ae3288ba876252b0d637ca..2f46f1b80ea8506be1360d5d244ef00c6cd55faa 100644 --- a/test/unittest/src/thermal_service_test.cpp +++ b/test/unittest/src/thermal_service_test.cpp @@ -46,7 +46,7 @@ constexpr const char* SYSTEM_CONFIG = "/system/etc/thermal_config/thermal_servic char* GetOneCfgFile(const char *pathSuffix, char *buf, unsigned int bufLength) { - THERMAL_HILOGI(LABEL_TEST, "mock GetOneCfgFile."); + THERMAL_HILOGD(LABEL_TEST, "mock GetOneCfgFile."); return nullptr; } @@ -161,45 +161,4 @@ HWTEST_F(ThermalServiceTest, ThermalServiceTest004, TestSize.Level0) thermalXCollie.CallCancel(); THERMAL_HILOGI(LABEL_TEST, "ThermalServiceTest004 function end!"); } - -/** - * @tc.name: ThermalServiceTest005 - * @tc.desc: test Service RegisterBootCompletedCallback - * @tc.type: FUNC - */ -HWTEST_F(ThermalServiceTest, ThermalServiceTest005, TestSize.Level0) -{ - THERMAL_HILOGI(LABEL_TEST, "ThermalServiceTest005 function start!"); - EXPECT_TRUE(g_service->Init()); - g_service->RegisterBootCompletedCallback(); - THERMAL_HILOGI(LABEL_TEST, "ThermalServiceTest005 function end!"); -} - -/** - * @tc.name: ThermalServiceTest006 - * @tc.desc: test Service UnRegisterThermalHdiCallback - * @tc.type: FUNC - */ -HWTEST_F(ThermalServiceTest, ThermalServiceTest006, TestSize.Level0) -{ - THERMAL_HILOGI(LABEL_TEST, "ThermalServiceTest006 function start!"); - EXPECT_TRUE(g_service->Init()); - g_service->thermalInterface_ = nullptr; - g_service->UnRegisterThermalHdiCallback(); - THERMAL_HILOGI(LABEL_TEST, "ThermalServiceTest006 function end!"); -} - -/** - * @tc.name: ThermalServiceTest007 - * @tc.desc: test Service RegisterFanHdiCallback - * @tc.type: FUNC - */ -HWTEST_F(ThermalServiceTest, ThermalServiceTest007, TestSize.Level0) -{ - THERMAL_HILOGI(LABEL_TEST, "ThermalServiceTest007 function start!"); - EXPECT_TRUE(g_service->Init()); - g_service->thermalInterface_ = nullptr; - g_service->RegisterFanHdiCallback(); - THERMAL_HILOGI(LABEL_TEST, "ThermalServiceTest007 function end!"); -} } // namespace \ No newline at end of file diff --git a/thermalmgr.gni b/thermalmgr.gni index 9e34f96497aecc831639ec29166e687121979381..170504337ae1241492f2548f920f7931b7fb7894 100644 --- a/thermalmgr.gni +++ b/thermalmgr.gni @@ -16,15 +16,6 @@ import("//build/ohos.gni") declare_args() { thermal_manager_audio_framework_enable = false } -defines = [] -if (!defined(global_parts_info) || - defined(global_parts_info.hiviewdfx_hisysevent)) { - has_hiviewdfx_hisysevent_part = true - defines += [ "HAS_HIVIEWDFX_HISYSEVENT_PART" ] -} else { - has_hiviewdfx_hisysevent_part = false -} - if (!defined(global_parts_info) || defined(global_parts_info.communication_netmanager_base)) { has_thermal_airplane_manager_part = true @@ -42,18 +33,11 @@ if (!defined(global_parts_info) || if (!defined(global_parts_info) || defined(global_parts_info.powermgr_display_manager)) { has_thermal_display_manager_part = true - defines += [ "HAS_THERMAL_DISPLAY_MANAGER_PART" ] + cflags_cc = [ "-DHAS_THERMAL_DISPLAY_MANAGER_PART" ] } else { has_thermal_display_manager_part = false } -if (!defined(global_parts_info) || - defined(global_parts_info.customization_config_policy)) { - has_thermal_config_policy_part = true -} else { - has_thermal_config_policy_part = false -} - ability_runtime_path = "//foundation/ability/ability_runtime" ability_runtime_inner_api_path = "${ability_runtime_path}/interfaces/inner_api" ability_runtime_services_path = "${ability_runtime_path}/services" diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 5c412474288939b1cc5c488b6da84401eb0032a5..b332b0a556615f4f996fef0468473e1f2477ef79 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -46,13 +46,10 @@ ohos_source_set("thermal_utils") { "c_utils:utils", "hicollie:libhicollie", "hilog:libhilog", + "hisysevent:libhisysevent", "init:libbegetutil", ] - if (has_hiviewdfx_hisysevent_part) { - external_deps += [ "hisysevent:libhisysevent" ] - } - subsystem_name = "powermgr" part_name = "thermal_manager" } diff --git a/utils/native/src/thermal_hisysevent.cpp b/utils/native/src/thermal_hisysevent.cpp index bb08ceeeded688c5931fea09f84dae8cd0f50825..e59f05b193f8677b2dcbc29571948d7250386b00 100644 --- a/utils/native/src/thermal_hisysevent.cpp +++ b/utils/native/src/thermal_hisysevent.cpp @@ -17,9 +17,7 @@ #define HISYSEVENT_PERIOD 5 #define HISYSEVENT_THRESHOLD 200 -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART #include "hisysevent.h" -#endif #include "thermal_log.h" namespace OHOS { @@ -27,13 +25,11 @@ namespace PowerMgr { template static void WriteEvent(const std::string& eventType, Types... args) { -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART int ret = HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::THERMAL, eventType, HiviewDFX::HiSysEvent::EventType::STATISTIC, args...); if (ret != 0) { THERMAL_HILOGE(COMP_SVC, "Write event fail: %{public}s", eventType.c_str()); } -#endif } void WriteLevelChangedHiSysEvent(bool enableEvent, int32_t level) @@ -60,13 +56,11 @@ void WriteActionTriggeredHiSysEventWithRatio(bool enableEvent, const std::string template static void WriteFaultEvent(const std::string& eventType, Types... args) { -#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART int ret = HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::THERMAL, eventType, HiviewDFX::HiSysEvent::EventType::FAULT, args...); if (ret != 0) { THERMAL_HILOGE(COMP_SVC, "Write fault event fail: %{public}s", eventType.c_str()); } -#endif } void WriteFanFaultEvent(int32_t faultId, std::string msg)