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_airplane.cpp", 40 "native/src/thermal_action/action/action_application_process.cpp", 41 "native/src/thermal_action/action/action_charger.cpp", 42 "native/src/thermal_action/action/action_display.cpp", 43 "native/src/thermal_action/action/action_node.cpp", 44 "native/src/thermal_action/action/action_popup.cpp", 45 "native/src/thermal_action/action/action_shutdown.cpp", 46 "native/src/thermal_action/action/action_soc/action_cpu_big.cpp", 47 "native/src/thermal_action/action/action_soc/action_cpu_boost.cpp", 48 "native/src/thermal_action/action/action_soc/action_cpu_isolate.cpp", 49 "native/src/thermal_action/action/action_soc/action_cpu_lit.cpp", 50 "native/src/thermal_action/action/action_soc/action_cpu_med.cpp", 51 "native/src/thermal_action/action/action_soc/action_cpu_nonvip.cpp", 52 "native/src/thermal_action/action/action_soc/action_gpu.cpp", 53 "native/src/thermal_action/action/action_soc/soc_action_base.cpp", 54 "native/src/thermal_action/action/action_thermal_level.cpp", 55 "native/src/thermal_action/action/action_voltage.cpp", 56 "native/src/thermal_action/action/action_volume.cpp", 57 "native/src/thermal_action/thermal_action_factory.cpp", 58 "native/src/thermal_action/thermal_action_manager.cpp", 59 "native/src/thermal_action/thermal_timer.cpp", 60 "native/src/thermal_callback.cpp", 61 "native/src/thermal_mgr_dumper.cpp", 62 "native/src/thermal_observer/state_machine/charge_delay_state_collection.cpp", 63 "native/src/thermal_observer/state_machine/charger_state_collection.cpp", 64 "native/src/thermal_observer/state_machine/cust_state_collection.cpp", 65 "native/src/thermal_observer/state_machine/extend_state_collection.cpp", 66 "native/src/thermal_observer/state_machine/scene_state_collection.cpp", 67 "native/src/thermal_observer/state_machine/screen_state_collection.cpp", 68 "native/src/thermal_observer/state_machine/startup_delay_state_collection.cpp", 69 "native/src/thermal_observer/state_machine/state_collection_factory.cpp", 70 "native/src/thermal_observer/state_machine/state_machine.cpp", 71 "native/src/thermal_observer/thermal_common_event_receiver.cpp", 72 "native/src/thermal_observer/thermal_observer.cpp", 73 "native/src/thermal_observer/thermal_sensor_info.cpp", 74 "native/src/thermal_observer/thermal_service_subscriber.cpp", 75 "native/src/thermal_policy/fan_fault_detect.cpp", 76 "native/src/thermal_policy/thermal_config_base_info.cpp", 77 "native/src/thermal_policy/thermal_config_sensor_cluster.cpp", 78 "native/src/thermal_policy/thermal_policy.cpp", 79 "native/src/thermal_policy/thermal_srv_config_parser.cpp", 80 "native/src/thermal_service.cpp", 81 ] 82 83 configs = [ 84 "${utils_path}:utils_config", 85 "${utils_path}:coverage_flags", 86 ] 87 88 defines = [] 89 90 if (use_libfuzzer) { 91 defines += [ "FUZZ_TEST" ] 92 } 93 94 public_configs = [ ":thermalsrv_public_config" ] 95 96 deps = [ 97 "${thermal_service_zidl}:thermalmgr_proxy", 98 "${thermal_service_zidl}:thermalmgr_stub", 99 "${utils_path}:thermal_utils", 100 ] 101 102 external_deps = [ "power_manager:power_permission" ] 103 external_deps += [ 104 "ability_runtime:wantagent_innerkits", 105 "bundle_framework:appexecfwk_core", 106 "c_utils:utils", 107 "common_event_service:cesfwk_innerkits", 108 "config_policy:configpolicy_util", 109 "drivers_interface_thermal:libthermal_proxy_1.1", 110 "ffrt:libffrt", 111 "hdf_core:libhdi", 112 "hdf_core:libpub_utils", 113 "hicollie:libhicollie", 114 "hilog:libhilog", 115 "hisysevent:libhisysevent", 116 "image_framework:image_native", 117 "init:libbegetutil", 118 "ipc:ipc_core", 119 "libxml2:libxml2", 120 "power_manager:power_ffrt", 121 "power_manager:power_sysparam", 122 "power_manager:powermgr_client", 123 "safwk:system_ability_fwk", 124 "time_service:time_client", 125 ] 126 127 public_external_deps = [ "ability_base:want" ] 128 129 if (has_thermal_airplane_manager_part) { 130 defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ] 131 external_deps += [ "netmanager_base:net_conn_manager_if" ] 132 } 133 134 if (has_thermal_audio_framework_part && 135 thermal_manager_audio_framework_enable) { 136 defines += [ "HAS_THERMAL_AUDIO_FRAMEWORK_PART" ] 137 external_deps += [ "audio_framework:audio_client" ] 138 } 139 140 if (has_thermal_display_manager_part) { 141 external_deps += [ "display_manager:displaymgr" ] 142 } 143 144 if (defined(global_parts_info) && 145 defined(global_parts_info.resourceschedule_soc_perf)) { 146 external_deps += [ "soc_perf:socperf_client" ] 147 defines += [ "SOC_PERF_ENABLE" ] 148 } 149 150 if (defined(global_parts_info) && 151 defined(global_parts_info.powermgr_battery_manager)) { 152 defines += [ "BATTERY_MANAGER_ENABLE" ] 153 external_deps += [ "battery_manager:batterysrv_client" ] 154 } 155 156 if (defined(global_parts_info) && 157 defined(global_parts_info.hdf_drivers_interface_battery)) { 158 defines += [ "DRIVERS_INTERFACE_BATTERY_ENABLE" ] 159 external_deps += [ "drivers_interface_battery:libbattery_proxy_2.0" ] 160 } 161 162 if (build_variant == "user") { 163 defines += [ "THERMAL_USER_VERSION" ] 164 } 165 166 subsystem_name = "powermgr" 167 part_name = "thermal_manager" 168} 169 170group("service") { 171 deps = [ 172 ":thermalservice", 173 "${thermal_manager_path}/sa_profile:thermalmgr_sa_profile", 174 "native/profile:thermal_service_config", 175 ] 176} 177