1# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("../thermalmgr.gni") 15 16config("thermalsrv_public_config") { 17 include_dirs = [ 18 "native/include/", 19 "native/include/thermal_action", 20 "native/include/thermal_observer", 21 "native/include/thermal_policy", 22 "native/include/thermal_observer/state_machine", 23 "native/include/thermal_action/action", 24 "native/include/thermal_action/action/action_soc", 25 "${thermal_inner_api}/native/include", 26 ] 27} 28 29ohos_shared_library("thermalservice") { 30 sanitize = { 31 cfi = true 32 cfi_cross_dso = true 33 debug = false 34 } 35 branch_protector_ret = "pac_ret" 36 37 sources = [ 38 "native/src/fan_callback.cpp", 39 "native/src/thermal_action/action/action_application_process.cpp", 40 "native/src/thermal_action/action/action_charger.cpp", 41 "native/src/thermal_action/action/action_display.cpp", 42 "native/src/thermal_action/action/action_node.cpp", 43 "native/src/thermal_action/action/action_popup.cpp", 44 "native/src/thermal_action/action/action_shutdown.cpp", 45 "native/src/thermal_action/action/action_soc/action_cpu_big.cpp", 46 "native/src/thermal_action/action/action_soc/action_cpu_boost.cpp", 47 "native/src/thermal_action/action/action_soc/action_cpu_isolate.cpp", 48 "native/src/thermal_action/action/action_soc/action_cpu_lit.cpp", 49 "native/src/thermal_action/action/action_soc/action_cpu_med.cpp", 50 "native/src/thermal_action/action/action_soc/action_gpu.cpp", 51 "native/src/thermal_action/action/action_soc/soc_action_base.cpp", 52 "native/src/thermal_action/action/action_thermal_level.cpp", 53 "native/src/thermal_action/action/action_voltage.cpp", 54 "native/src/thermal_action/action/action_volume.cpp", 55 "native/src/thermal_action/thermal_action_factory.cpp", 56 "native/src/thermal_action/thermal_action_manager.cpp", 57 "native/src/thermal_action/thermal_timer.cpp", 58 "native/src/thermal_callback.cpp", 59 "native/src/thermal_mgr_dumper.cpp", 60 "native/src/thermal_observer/state_machine/charger_state_collection.cpp", 61 "native/src/thermal_observer/state_machine/extend_state_collection.cpp", 62 "native/src/thermal_observer/state_machine/scene_state_collection.cpp", 63 "native/src/thermal_observer/state_machine/screen_state_collection.cpp", 64 "native/src/thermal_observer/state_machine/state_collection_factory.cpp", 65 "native/src/thermal_observer/state_machine/state_machine.cpp", 66 "native/src/thermal_observer/thermal_common_event_receiver.cpp", 67 "native/src/thermal_observer/thermal_observer.cpp", 68 "native/src/thermal_observer/thermal_sensor_info.cpp", 69 "native/src/thermal_observer/thermal_service_subscriber.cpp", 70 "native/src/thermal_policy/fan_fault_detect.cpp", 71 "native/src/thermal_policy/thermal_config_base_info.cpp", 72 "native/src/thermal_policy/thermal_config_sensor_cluster.cpp", 73 "native/src/thermal_policy/thermal_policy.cpp", 74 "native/src/thermal_policy/thermal_srv_config_parser.cpp", 75 "native/src/thermal_service.cpp", 76 ] 77 78 configs = [ 79 "${utils_path}:utils_config", 80 "${utils_path}:coverage_flags", 81 ] 82 83 defines = [] 84 85 if (use_libfuzzer) { 86 defines += [ "FUZZ_TEST" ] 87 } 88 89 public_configs = [ ":thermalsrv_public_config" ] 90 91 deps = [ 92 "${thermal_service_zidl}:thermalmgr_proxy", 93 "${thermal_service_zidl}:thermalmgr_stub", 94 "${utils_path}:thermal_utils", 95 ] 96 97 external_deps = [ "power_manager:power_permission" ] 98 external_deps += [ 99 "ability_base:want", 100 "ability_runtime:ability_manager", 101 "ability_runtime:app_manager", 102 "ability_runtime:wantagent_innerkits", 103 "bundle_framework:appexecfwk_core", 104 "c_utils:utils", 105 "common_event_service:cesfwk_innerkits", 106 "config_policy:configpolicy_util", 107 "drivers_interface_battery:libbattery_proxy_2.0", 108 "drivers_interface_thermal:libthermal_proxy_1.1", 109 "ffrt:libffrt", 110 "hdf_core:libhdi", 111 "hdf_core:libpub_utils", 112 "hicollie:libhicollie", 113 "hilog:libhilog", 114 "hisysevent:libhisysevent", 115 "image_framework:image_native", 116 "init:libbegetutil", 117 "ipc:ipc_core", 118 "libxml2:libxml2", 119 "power_manager:power_ffrt", 120 "power_manager:power_sysparam", 121 "power_manager:powermgr_client", 122 "safwk:system_ability_fwk", 123 "time_service:time_client", 124 "window_manager:libdm", 125 ] 126 127 if (has_thermal_audio_framework_part) { 128 defines += [ "HAS_THERMAL_AUDIO_FRAMEWORK_PART" ] 129 external_deps += [ "audio_framework:audio_client" ] 130 } 131 132 if (has_thermal_display_manager_part) { 133 external_deps += [ "display_manager:displaymgr" ] 134 } 135 136 if (defined(global_parts_info) && 137 defined(global_parts_info.resourceschedule_soc_perf)) { 138 external_deps += [ "soc_perf:socperf_client" ] 139 defines += [ "SOC_PERF_ENABLE" ] 140 } 141 142 if (defined(global_parts_info) && 143 defined(global_parts_info.powermgr_battery_manager)) { 144 defines += [ "BATTERY_MANAGER_ENABLE" ] 145 external_deps += [ "battery_manager:batterysrv_client" ] 146 } 147 148 if (build_variant == "user") { 149 defines += [ "THERMAL_USER_VERSION" ] 150 } 151 152 subsystem_name = "powermgr" 153 part_name = "thermal_manager" 154} 155 156group("service") { 157 deps = [ 158 ":thermalservice", 159 "${thermal_manager_path}/sa_profile:thermalmgr_sa_profile", 160 "native/profile:thermal_service_config", 161 ] 162} 163