Mobile Development 8 min read

Android Thermal Management System: Thermal HAL 2.0 and Service Framework Analysis

Android’s Thermal Management System, introduced in Android 10, uses Thermal HAL 2.0 and a layered service framework to abstract hardware sensors, let apps and system components query temperatures or register callbacks via PowerManager, and enable manufacturers to implement HIDL interfaces and configuration files that drive the thermal‑engine process to throttle CPU/GPU frequencies, charging rates, and other resources when predefined temperature thresholds are exceeded.

OPPO Kernel Craftsman
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Android Thermal Management System: Thermal HAL 2.0 and Service Framework Analysis

As mobile phone functions continue to expand with increasing algorithm complexity, system core frequencies, and integration levels while device form factors shrink, the importance of mobile thermal mitigation has become increasingly prominent.

Android introduced a thermal system to abstract hardware interfaces from thermal subsystem devices, enabling effective thermal mitigation when phones begin to overheat. The hardware interfaces include temperature sensors and thermistors for device surface, battery, GPU, CPU, and USB ports. Through this framework, device manufacturers and application developers can actively obtain temperature data from these system hardware devices or receive high-temperature notifications through registered callback functions in the PowerManager class, allowing them to adjust system and application execution strategies to reduce system load when the device begins to overheat.

Android Thermal Service Upper-Level Callable Interfaces

In Android 10, the thermal service uses Thermal HAL 2.0 to monitor temperature information from various device nodes. Third-party applications can call PowerManager class methods to add listener callbacks or actively obtain thermal status information:

getCurrentThermalStatus() - Returns the current thermal status level of the device as an integer.

addThermalStatusListener() - Adds a listener.

removeThermalStatusListener() - Removes a previously added listener.

Android system internal components can register the IThermalEventListener callback interface for more detailed thermal sensor and thermal event information monitoring.

Android Thermal Service Processing Flow

The thermal service in Android 10 uses Thermal HAL 2.0 to monitor temperature information from various device nodes and provides feedback on limitation severity levels and current temperatures to upper layers. The call flow involves: PowerManager → ThermalService → ThermalManagerService → ThermalHal20Wrapper → Thermal HAL 2.0. When temperature thresholds are exceeded, callbacks are triggered through the mThermalStatusListeners stored in a RemoteCallbackList.

Thermal HAL 2.0 Implementation Mechanism

Thermal HAL 2.0, introduced in Android 10, requires device manufacturers to implement methods in the HIDL interface (as provided in IThermal.hal). It obtains device temperature sensor and limitation status information and passes this through IThermalChangedCallback when temperature status changes exceed set thresholds.

Compared to Thermal HAL 1.0, version 2.0 adds callback listener interfaces for monitoring device node temperature on top of version 1.0 functionality. Using Google Pixel as an example, the implementation involves: ThermalWatcher (extends Looper) continuously monitoring system device node temperature changes; when temperature exceeds configured thresholds, callbacks are triggered through ThermalHelper → Thermal.cpp → sendThermalChangedCallback.

Configuration files stored at /vendor/etc/thermal_Info_config.json contain monitored device nodes and temperature trigger threshold information. The thermal-engine process service is Android's temperature control core, monitoring hardware node temperatures and controlling CPU/GPU frequency, battery charging speed, network signal strength, and system refresh frame rates to mitigate temperature rise.

mobile developmentSystem ArchitectureAndroidthermal managementAndroid 10Hardware Abstraction LayerPowerManagerThermal HAL
OPPO Kernel Craftsman
Written by

OPPO Kernel Craftsman

Sharing Linux kernel-related cutting-edge technology, technical articles, technical news, and curated tutorials

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.