137a09cd7Sopenharmony_ci# Thermal Manager 237a09cd7Sopenharmony_ci 337a09cd7Sopenharmony_ci- [Introduction](#section0056945901) 437a09cd7Sopenharmony_ci- [Directory Structure](#section0056945902) 537a09cd7Sopenharmony_ci- [Configuration Description](#section0056945903) 637a09cd7Sopenharmony_ci- [Repositories Involved](#section0056945904) 737a09cd7Sopenharmony_ci 837a09cd7Sopenharmony_ci## Introduction<a name="section0056945901"></a> 937a09cd7Sopenharmony_ci 1037a09cd7Sopenharmony_ciThe Thermal Manager module provides the device temperature management and control capabilities to ensure the thermal safety and experience of the entire system. 1137a09cd7Sopenharmony_ci 1237a09cd7Sopenharmony_ci**Figure 1** Architecture of the Thermal Manager module 1337a09cd7Sopenharmony_ci 1437a09cd7Sopenharmony_ci 1537a09cd7Sopenharmony_ci 1637a09cd7Sopenharmony_ci**Key components of the Thermal Manager module**: 1737a09cd7Sopenharmony_ci 1837a09cd7Sopenharmony_ci1. Thermal Manager: provides temperature query and callback APIs for applications and other subsystems. 1937a09cd7Sopenharmony_ci2. Thermal Service: implements core temperature control functions, such as temperature detection, temperature level arbitration, and action delivery, according to the configuration file. 2037a09cd7Sopenharmony_ci3. Thermal HDI: implements temperature driver information reporting and driver instruction delivery according to the configuration file. 2137a09cd7Sopenharmony_ci4. Thermal Protector: implements simplified temperature control in the non-running state according to the configuration file. 2237a09cd7Sopenharmony_ci 2337a09cd7Sopenharmony_ci## Directory Structure<a name="section0056945902"></a> 2437a09cd7Sopenharmony_ci``` 2537a09cd7Sopenharmony_ci/base/powermgr/thermal_manager 2637a09cd7Sopenharmony_ci├── application # Native application 2737a09cd7Sopenharmony_ci│ ├── init # Init configuration 2837a09cd7Sopenharmony_ci│ └── protector # Thermal Protector code 2937a09cd7Sopenharmony_ci├── figures # Architecture 3037a09cd7Sopenharmony_ci├── frameworks # Framework layer 3137a09cd7Sopenharmony_ci│ ├── napi # NAPI layer 3237a09cd7Sopenharmony_ci│ └── native # Native layer 3337a09cd7Sopenharmony_ci├── interface # API layer 3437a09cd7Sopenharmony_ci│ └── inner_api # Internal APIs 3537a09cd7Sopenharmony_ci├── sa_profile # SA profile 3637a09cd7Sopenharmony_ci├── services # Thermal Service code 3737a09cd7Sopenharmony_ci│ ├── native # Native layer 3837a09cd7Sopenharmony_ci│ └── zidl # Zidl layer 3937a09cd7Sopenharmony_ci├── test # Test code 4037a09cd7Sopenharmony_ci│ ├── fuzztest # Fuzz test 4137a09cd7Sopenharmony_ci│ ├── unittest # Unit test 4237a09cd7Sopenharmony_ci│ ├── systemtest # System test 4337a09cd7Sopenharmony_ci│ └── utils # Test tools 4437a09cd7Sopenharmony_ci└── utils # Utilities 4537a09cd7Sopenharmony_ci``` 4637a09cd7Sopenharmony_ci 4737a09cd7Sopenharmony_ci## Configuration Description<a name="section0056945903"></a> 4837a09cd7Sopenharmony_ci**thermal_service_config.xml** 4937a09cd7Sopenharmony_ciConfiguration example: 5037a09cd7Sopenharmony_ci 5137a09cd7Sopenharmony_ci``` 5237a09cd7Sopenharmony_ci<?xml version="1.0" encoding="UTF-8"?> 5337a09cd7Sopenharmony_ci<thermal version="0.99" product="ipx"> 5437a09cd7Sopenharmony_ci <base> 5537a09cd7Sopenharmony_ci <item tag="temperature_query_enum" value="soc,battery,shell,ambient"/> 5637a09cd7Sopenharmony_ci </base> 5737a09cd7Sopenharmony_ci <level> 5837a09cd7Sopenharmony_ci <sensor_cluster name="warm_base" sensor="shell"> 5937a09cd7Sopenharmony_ci <item level="1" threshold="35000" threshold_clr="33000"/> 6037a09cd7Sopenharmony_ci <item level="2" threshold="37000" threshold_clr="35000"/> 6137a09cd7Sopenharmony_ci <item level="3" threshold="40000" threshold_clr="38000"/> 6237a09cd7Sopenharmony_ci </sensor_cluster> 6337a09cd7Sopenharmony_ci <sensor_cluster name="warm_safe" sensor="battery,pa"> 6437a09cd7Sopenharmony_ci <item level="1" threshold="48000,60000" threshold_clr="45000,55000"/> 6537a09cd7Sopenharmony_ci </sensor_cluster> 6637a09cd7Sopenharmony_ci </level> 6737a09cd7Sopenharmony_ci <state> 6837a09cd7Sopenharmony_ci <item name="screen"/> 6937a09cd7Sopenharmony_ci <item name="charge"/> 7037a09cd7Sopenharmony_ci </state> 7137a09cd7Sopenharmony_ci <action> 7237a09cd7Sopenharmony_ci <item name="cpu"/> 7337a09cd7Sopenharmony_ci <item name="current"/> 7437a09cd7Sopenharmony_ci <item name="shut_down" param="100"/> 7537a09cd7Sopenharmony_ci <item name="thermal_level" strict="1"/> 7637a09cd7Sopenharmony_ci </action> 7737a09cd7Sopenharmony_ci <policy> 7837a09cd7Sopenharmony_ci <config name="warm_base" level="1"> 7937a09cd7Sopenharmony_ci <cpu screen="1">2800000</cpu> 8037a09cd7Sopenharmony_ci <cpu screen="0">2400000</cpu> 8137a09cd7Sopenharmony_ci <current charge="1">1500</current> 8237a09cd7Sopenharmony_ci <thermal_level>3</thermal_level> 8337a09cd7Sopenharmony_ci </config> 8437a09cd7Sopenharmony_ci <config name="warm_base" level="2"> 8537a09cd7Sopenharmony_ci <cpu screen="1">2200000</cpu> 8637a09cd7Sopenharmony_ci <cpu screen="0">1800000</cpu> 8737a09cd7Sopenharmony_ci <current charge="1">1200</current> 8837a09cd7Sopenharmony_ci <thermal_level>4</thermal_level> 8937a09cd7Sopenharmony_ci </config> 9037a09cd7Sopenharmony_ci <config name="warm_base" level="3"> 9137a09cd7Sopenharmony_ci <cpu screen="1">1600000</cpu> 9237a09cd7Sopenharmony_ci <cpu screen="0">1200000</cpu> 9337a09cd7Sopenharmony_ci <current charge="1">1000</current> 9437a09cd7Sopenharmony_ci <thermal_level>5</thermal_level> 9537a09cd7Sopenharmony_ci </config> 9637a09cd7Sopenharmony_ci <config name="warm_safe" level="1"> 9737a09cd7Sopenharmony_ci <shut_down>1</shut_down> 9837a09cd7Sopenharmony_ci </config> 9937a09cd7Sopenharmony_ci </policy> 10037a09cd7Sopenharmony_ci</thermal> 10137a09cd7Sopenharmony_ci``` 10237a09cd7Sopenharmony_ci``` 10337a09cd7Sopenharmony_cithermal # Root directory. Wherein, version indicates the version number, and product indicates the product name. 10437a09cd7Sopenharmony_ci├── base # base directory, used to configure basic parameters. 10537a09cd7Sopenharmony_ci│ └── item # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value. 10637a09cd7Sopenharmony_ci├── level # level directory, used to store the temperature level information. 10737a09cd7Sopenharmony_ci│ └── sensor_cluster # sensor_cluster directory, used to configure a cluster of sensors. Wherein, name indicates the cluster name, and sensor indicates the sensor name. 10837a09cd7Sopenharmony_ci│ └── item # item directory, used to configure the temperature level information. Wherein, level indicates the temperature level, threshold indicates the triggering temperature, and xxx_clr indicates the setback temperature. 10937a09cd7Sopenharmony_ci├── state # state directory, used to configure the state machine. Wherein, name indicates the name of the state machine. 11037a09cd7Sopenharmony_ci├── action # action directory, used to configure actions. Wherein, name indicates the name of the action, param indicates the action parameter, and strict indicates the arbitration scheme. 11137a09cd7Sopenharmony_ci└── policy # policy directory, used to configure the policy for the corresponding temperature level. 11237a09cd7Sopenharmony_ci └── config # config directory, used to configure the action for the corresponding temperature level. Wherein, name is that of sensor_cluster, and the level is that of the item in sensor_cluster. 11337a09cd7Sopenharmony_ci └── <action_name> # action name corresponding to the action value. The state condition and its value can be configured in this attribute. 11437a09cd7Sopenharmony_ci``` 11537a09cd7Sopenharmony_ci 11637a09cd7Sopenharmony_ci 11737a09cd7Sopenharmony_ci## Repositories Involved<a name="section0056945904"></a> 11837a09cd7Sopenharmony_ci[Power Management Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/power-management.md) 11937a09cd7Sopenharmony_ci 12037a09cd7Sopenharmony_ci[powermgr_power_manager](https://gitee.com/openharmony/powermgr_power_manager) 12137a09cd7Sopenharmony_ci 12237a09cd7Sopenharmony_ci[powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager) 12337a09cd7Sopenharmony_ci 12437a09cd7Sopenharmony_ci[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager) 12537a09cd7Sopenharmony_ci 12637a09cd7Sopenharmony_ci**powermgr_thermal_manager** 12737a09cd7Sopenharmony_ci 12837a09cd7Sopenharmony_ci[powermgr_battery_statistics](https://gitee.com/openharmony/powermgr_battery_statistics) 12937a09cd7Sopenharmony_ci 13037a09cd7Sopenharmony_ci[powermgr_battery_lite](https://gitee.com/openharmony/powermgr_battery_lite) 13137a09cd7Sopenharmony_ci 13237a09cd7Sopenharmony_ci[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite) 133