# Thermal

## Summary

| ### Enumerations ||
|---|---|
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga12839f5ee073eb6d2c099b48680459dd{ https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459dda10b53e7c27033c56ee48dfa2b1e8238a = -1, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddafadf7a62e15ae3399fb6c32b9fd540b0 = 0, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddab3d325c87696fa3e9462d0b806aad660 = 1, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddad6700102b0af5da5a2aff6fd2a5124ef = 2, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459dda2be15702c0757c9eb08a24886427c711 = 3, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459dda1f77b13a42031203ae93f625a6b8bc25 = 4, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459dda134ff82204690a8540004069805f4c36 = 5, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddabdac8c095d4ad0d42638b93b17ade078 = 6 }` | enumThermal status used in function [AThermal_getCurrentThermalStatus](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga929f4164f41cfecfb778b45c541d3783) and [AThermal_StatusCallback](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf0baa0c5084e5f10143d80bed2f319c5). |

| ### Typedefs ||
|---|---|
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga1a6235aa04dc16a98c31403232e7ac29` | typedef `struct https://developer.android.com/ndk/reference/struct/a-thermal-headroom-threshold#struct_a_thermal_headroom_threshold` |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216` | typedef `struct https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216` An opaque type representing a handle to a thermal manager. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gabd6cf1ad78fdf83b9776171cc87d6880` | typedef `enum https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga12839f5ee073eb6d2c099b48680459dd` |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gab9e9a9393c5e09553d30d0440ae852a0)(void *_Nullable data, float headroom, float forecastHeadroom, int forecastSeconds, const AThermalHeadroomThreshold *_Nullable thresholds, size_t thresholdsCount)` | typedef `void(*` Prototype of the function that is called when thermal headroom or thresholds changes. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf0baa0c5084e5f10143d80bed2f319c5)(void *_Nullable data, AThermalStatus status)` | typedef `void(*` Prototype of the function that is called when thermal status changes. |

| ### Functions ||
|---|---|
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22()` | `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull` Acquire an instance of the thermal manager. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga929f4164f41cfecfb778b45c541d3783(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager)` | `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga12839f5ee073eb6d2c099b48680459dd` Gets the current thermal status. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga0dd3a87803b3549a9352ef5e6bf83d80(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager, int forecastSeconds)` | `float` Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gad5f0c9c4bc98a169b406e361df2fcb17(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager, const https://developer.android.com/ndk/reference/struct/a-thermal-headroom-threshold#struct_a_thermal_headroom_threshold *_Nonnull *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d outThresholds, size_t *_Nonnull size)` | `int` Gets the thermal headroom thresholds for all available thermal status. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gae9c8da3498b907495ddfe833533ff8cf(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gab9e9a9393c5e09553d30d0440ae852a0https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d callback, void *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d data)` | `int` Register a thermal headroom listener for thermal headroom or thresholds change. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaa95709d853f83d8e74d495d76c6ce036(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf0baa0c5084e5f10143d80bed2f319c5https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d callback, void *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d data)` | `int` Register a thermal status listener for thermal status change. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga25d4048b74093cca4dd1419e8d26f559(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager)` | `void` Release the thermal manager pointer acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaa5c8f7c6b27c9dd2f30ccabf4cc154e3(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gab9e9a9393c5e09553d30d0440ae852a0https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d callback, void *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d data)` | `int` Unregister a thermal headroom listener previously registered. |
| `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga778aab89fcf57ec72a144cef917da562(https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga326846d9eb87de9275793097db218216 *_Nonnull manager, https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf0baa0c5084e5f10143d80bed2f319c5https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d callback, void *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d data)` | `int` Unregister a thermal status listener previously registered. |

| ### Structs ||
|---|---|
| [AThermalHeadroomThreshold](https://developer.android.com/ndk/reference/struct/a-thermal-headroom-threshold) | This struct defines an instance of headroom threshold value and its status. |

## Enumerations

### AThermalStatus

Declared in `android/thermal.h`

```
 AThermalStatus
```
Thermal status used in function [AThermal_getCurrentThermalStatus](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga929f4164f41cfecfb778b45c541d3783) and [AThermal_StatusCallback](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf0baa0c5084e5f10143d80bed2f319c5).

| Properties ||
|---|---|
| `ATHERMAL_STATUS_CRITICAL` | Platform has done everything to reduce power. |
| `ATHERMAL_STATUS_EMERGENCY` | Key components in platform are shutting down due to thermal condition. Device functionalities will be limited. |
| `ATHERMAL_STATUS_ERROR` | Error in thermal status. |
| `ATHERMAL_STATUS_LIGHT` | Light throttling where UX is not impacted. |
| `ATHERMAL_STATUS_MODERATE` | Moderate throttling where UX is not largely impacted. |
| `ATHERMAL_STATUS_NONE` | Not under throttling. |
| `ATHERMAL_STATUS_SEVERE` | Severe throttling where UX is largely impacted. |
| `ATHERMAL_STATUS_SHUTDOWN` | Need shutdown immediately. |

## Typedefs

### AThermalHeadroomThreshold

Declared in `android/thermal.h`

```
struct AThermalHeadroomThreshold AThermalHeadroomThreshold
```

### AThermalManager

Declared in `android/thermal.h`

```
struct AThermalManager AThermalManager
```
An opaque type representing a handle to a thermal manager.

An instance of thermal manager must be acquired prior to using thermal status APIs and must be released after use.

To use:

- Create a new thermal manager instance by calling the [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22) function.
- Get current thermal status with [AThermal_getCurrentThermalStatus](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga929f4164f41cfecfb778b45c541d3783).
- Register a thermal status listener with [AThermal_registerThermalStatusListener](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaa95709d853f83d8e74d495d76c6ce036).
- Unregister a thermal status listener with [AThermal_unregisterThermalStatusListener](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga778aab89fcf57ec72a144cef917da562).
- Release the thermal manager instance with [AThermal_releaseManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga25d4048b74093cca4dd1419e8d26f559).

<br />

### AThermalStatus

Declared in `android/thermal.h`

```
enum AThermalStatus AThermalStatus
```

### AThermal_HeadroomCallback

Declared in `android/thermal.h`

```
void(* AThermal_HeadroomCallback)(void *_Nullable data, float headroom, float forecastHeadroom, int forecastSeconds, const AThermalHeadroomThreshold *_Nullable thresholds, size_t thresholdsCount)
```
Prototype of the function that is called when thermal headroom or thresholds changes.

It's passed the updated thermal headroom and thresholds as parameters, as well as the pointer provided by the client that registered a callback.

This may not be used to fully replace the [AThermal_getThermalHeadroom](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga0dd3a87803b3549a9352ef5e6bf83d80) API as it will only notify on one of the conditions below that will significantly change one or both values of current headroom and headroom thresholds since previous callback:

1. thermal throttling events: when the skin temperature has cross any of the thresholds and there isn't a previous callback in a short time ago with similar values.
2. skin temperature threshold change events: note that if the absolute °C threshold values change in a way that does not significantly change the current headroom nor headroom thresholds, it will not trigger any callback. The client should not need to take action in such case since the difference from temperature vs threshold hasn't changed.

<br />

By API version 36, it provides a forecast in the same call for developer's convenience based on a

```
forecastSeconds 
```
defined by the device, which can be static or dynamic varied by OEM. Be aware that it will not notify on forecast temperature change but the events mentioned above. So periodically polling against [AThermal_getThermalHeadroom](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga0dd3a87803b3549a9352ef5e6bf83d80) API should still be used to actively monitor temperature forecast in advance.

<br />

This serves as a more advanced option compared to thermal status listener, where the latter will only notify on thermal throttling events with status update.

<br />

Details Parameters `data` The data pointer to be passed when callback is called. `headroom` The current non-negative normalized headroom value, also see [AThermal_getThermalHeadroom](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga0dd3a87803b3549a9352ef5e6bf83d80). `forecastHeadroom` The forecasted non-negative normalized headroom value, also see [AThermal_getThermalHeadroom](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga0dd3a87803b3549a9352ef5e6bf83d80). `forecastSeconds` The seconds used for the forecast by the system. `thresholds` The current headroom thresholds. The thresholds pointer will be a constant shared across all callbacks registered from the same process, and it will be destroyed after all the callbacks are finished. If the client intents to persist the values, it should make a copy of it during the callback. `thresholdsCount` The count of thresholds.

### AThermal_StatusCallback

Declared in `android/thermal.h`

```
void(* AThermal_StatusCallback)(void *_Nullable data, AThermalStatus status)
```
Prototype of the function that is called when thermal status changes.

It's passed the updated thermal status as parameter, as well as the pointer provided by the client that registered a callback.

## Functions

### AThermal_acquireManager

Declared in `android/thermal.h`

```
AThermalManager *_Nonnull AThermal_acquireManager()
```
Acquire an instance of the thermal manager.

This must be freed using [AThermal_releaseManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga25d4048b74093cca4dd1419e8d26f559).

Available since API level 30.

<br />

| Details ||
|---|---|
| **Returns** | manager instance on success, nullptr on failure. |

### AThermal_getCurrentThermalStatus

Declared in `android/thermal.h`

```
AThermalStatus AThermal_getCurrentThermalStatus(
  AThermalManager *_Nonnull manager
)
```
Gets the current thermal status.

Available since API level 30.

<br />

Details Parameters `manager` The manager instance to use to query the thermal status. Acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). **Returns** current thermal status, ATHERMAL_STATUS_ERROR on failure.

### AThermal_getThermalHeadroom

Declared in `android/thermal.h`

```
float AThermal_getThermalHeadroom(
  AThermalManager *_Nonnull manager,
  int forecastSeconds
)
```
Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling.

Note that this only attempts to track the headroom of slow-moving sensors, such as the skin temperature sensor. This means that there is no benefit to calling this function more frequently than about once per second, and attempted to call significantly more frequently may result in the function returning `NaN`.

In addition, in order to be able to provide an accurate forecast, the system does not attempt to forecast until it has multiple temperature samples from which to extrapolate. This should only take a few seconds from the time of the first call, but during this time, no forecasting will occur, and the current headroom will be returned regardless of the value of `forecastSeconds`.

The value returned is a non-negative float that represents how much of the thermal envelope is in use (or is forecasted to be in use). A value of 1.0 indicates that the device is (or will be) throttled at [ATHERMAL_STATUS_SEVERE](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459dda2be15702c0757c9eb08a24886427c711). Such throttling can affect the CPU, GPU, and other subsystems. Values may exceed 1.0, but there is no implied mapping to specific thermal levels beyond that point. This means that values greater than 1.0 may correspond to [ATHERMAL_STATUS_SEVERE](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459dda2be15702c0757c9eb08a24886427c711), but may also represent heavier throttling.

A value of 0.0 corresponds to a fixed distance from 1.0, but does not correspond to any particular thermal status or temperature. Values on (0.0, 1.0\] may be expected to scale linearly with temperature, though temperature changes over time are typically not linear. Negative values will be clamped to 0.0 before returning.

Available since API level 31.

<br />

Details Parameters `manager` The manager instance to use. Acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). `forecastSeconds` how many seconds into the future to forecast. Given that device conditions may change at any time, forecasts from further in the future will likely be less accurate than forecasts in the near future. **Returns** a value greater than equal to 0.0, where 1.0 indicates the SEVERE throttling threshold, as described above. Returns NaN if the device does not support this functionality or if this function is called significantly faster than once per second.

### AThermal_getThermalHeadroomThresholds

Declared in `android/thermal.h`

```
int AThermal_getThermalHeadroomThresholds(
  AThermalManager *_Nonnull manager,
  const AThermalHeadroomThreshold *_Nonnull *_Nullable outThresholds,
  size_t *_Nonnull size
)
```
Gets the thermal headroom thresholds for all available thermal status.

A thermal status will only exist in output if the device manufacturer has the corresponding threshold defined for at least one of its slow-moving skin temperature sensors. If it's set, one should also expect to get it from [AThermal_getCurrentThermalStatus](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga929f4164f41cfecfb778b45c541d3783) or [AThermal_StatusCallback](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf0baa0c5084e5f10143d80bed2f319c5).

The headroom threshold is used to interpret the possible thermal throttling status based on the headroom prediction. For example, if the headroom threshold for [ATHERMAL_STATUS_LIGHT](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddab3d325c87696fa3e9462d0b806aad660) is 0.7, and a headroom prediction in 10s returns 0.75 (or `AThermal_getThermalHeadroom(10)=0.75}`, one can expect that in 10 seconds the system could be in lightly throttled state if the workload remains the same. The app can consider taking actions according to the nearest throttling status the difference between the headroom and the threshold.

For new devices it's guaranteed to have a single sensor, but for older devices with multiple sensors reporting different threshold values, the minimum threshold is taken to be conservative on predictions. Thus, when reading real-time headroom, it's not guaranteed that a real-time value of 0.75 (or `AThermal_getThermalHeadroom(0)=0.75`) exceeding the threshold of 0.7 above will always come with lightly throttled state (or `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga929f4164f41cfecfb778b45c541d3783=ATHERMAL_STATUS_LIGHT`) but it can be lower (or `https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga929f4164f41cfecfb778b45c541d3783=ATHERMAL_STATUS_NONE`). While it's always guaranteed that the device won't be throttled heavier than the unmet threshold's state, so a real-time headroom of 0.75 will never come with [ATHERMAL_STATUS_MODERATE](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddad6700102b0af5da5a2aff6fd2a5124ef) but always lower, and 0.65 will never come with [ATHERMAL_STATUS_LIGHT](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddab3d325c87696fa3e9462d0b806aad660) but [ATHERMAL_STATUS_NONE](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gga12839f5ee073eb6d2c099b48680459ddafadf7a62e15ae3399fb6c32b9fd540b0).

Starting in Android 16, this polling API may return different results when called depending on the device. The new headroom listener API [AThermal_HeadroomCallback](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gab9e9a9393c5e09553d30d0440ae852a0) can be used to detect headroom thresholds changes.

Before API level 36 the returned list of thresholds is cached on first successful query and owned by the thermal manager, which will not change between calls to this function. The caller should only need to free the manager with [AThermal_releaseManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga25d4048b74093cca4dd1419e8d26f559).

<br />

Details Parameters `manager` The manager instance to use. Acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). `outThresholds` non-null output pointer to null [AThermalHeadroomThreshold](https://developer.android.com/ndk/reference/struct/a-thermal-headroom-threshold#struct_a_thermal_headroom_threshold) pointer, which will be set to a new array of thresholds if thermal thresholds are supported by the system or device, otherwise nullptr or unmodified. The client should clean up the thresholds by array-deleting the threshold pointer. `size` non-null output pointer whose value will be set to the size of the threshold array or 0 if it's not supported. **Returns** 0 on success EINVAL if outThresholds or size_t is nullptr, or \*outThresholds is not nullptr. EPIPE if communication with the system service has failed. ENOSYS if the feature is disabled by the current system.

### AThermal_registerThermalHeadroomListener

Declared in `android/thermal.h`

```
int AThermal_registerThermalHeadroomListener(
  AThermalManager *_Nonnull manager,
  AThermal_HeadroomCallback_Nullable callback,
  void *_Nullable data
)
```
Register a thermal headroom listener for thermal headroom or thresholds change.

Available since API level 36.

<br />

Details Parameters `manager` The manager instance to use to register. Acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). `callback` The callback function to be called on system binder thread pool when thermal headroom or thresholds update. `data` The data pointer to be passed when callback is called. **Returns** 0 on success EINVAL if the listener and data pointer were previously added and not removed. EPIPE if communication with the system service has failed.

### AThermal_registerThermalStatusListener

Declared in `android/thermal.h`

```
int AThermal_registerThermalStatusListener(
  AThermalManager *_Nonnull manager,
  AThermal_StatusCallback_Nullable callback,
  void *_Nullable data
)
```
Register a thermal status listener for thermal status change.

Available since API level 30.

<br />

Details Parameters `manager` The manager instance to use to register. Acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). `callback` The callback function to be called on system binder thread pool when thermal status updated. `data` The data pointer to be passed when callback is called. **Returns** 0 on success EINVAL if the listener and data pointer were previously added and not removed. EPIPE if communication with the system service has failed, the listener will not get removed and this call should be retried

### AThermal_releaseManager

Declared in `android/thermal.h`

```
void AThermal_releaseManager(
  AThermalManager *_Nonnull manager
)
```
Release the thermal manager pointer acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22).

Available since API level 30.

<br />

Details Parameters `manager` The manager to be released.

### AThermal_unregisterThermalHeadroomListener

Declared in `android/thermal.h`

```
int AThermal_unregisterThermalHeadroomListener(
  AThermalManager *_Nonnull manager,
  AThermal_HeadroomCallback_Nullable callback,
  void *_Nullable data
)
```
Unregister a thermal headroom listener previously registered.

No subsequent invocations of the callback will occur after this function returns successfully.

Available since API level 36.

<br />

Details Parameters `manager` The manager instance to use to unregister. Acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). `callback` The callback function that was previously registered. `data` The data pointer that was previously registered. **Returns** 0 on success EINVAL if the listener and data pointer were not previously added. EPIPE if communication with the system service has failed, the listener will not get removed and this call should be retried

### AThermal_unregisterThermalStatusListener

Declared in `android/thermal.h`

```
int AThermal_unregisterThermalStatusListener(
  AThermalManager *_Nonnull manager,
  AThermal_StatusCallback_Nullable callback,
  void *_Nullable data
)
```
Unregister a thermal status listener previously registered.

No subsequent invocations of the callback will occur after this function returns successfully.

Available since API level 30.

<br />

Details Parameters `manager` The manager instance to use to unregister. Acquired via [AThermal_acquireManager](https://developer.android.com/ndk/reference/group/thermal#group___thermal_1gaf58d3a8ebb0e46ad2871922455720a22). `callback` The callback function that was previously registered. `data` The data pointer to be passed when callback is called. **Returns** 0 on success EINVAL if the listener and data pointer were not previously added. EPIPE if communication with the system service has failed.