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