Stay organized with collections
Save and categorize content based on your preferences.
PowerManager.OnThermalHeadroomChangedListener
public
static
interface
PowerManager.OnThermalHeadroomChangedListener
android.os.PowerManager.OnThermalHeadroomChangedListener
|
Listener passed to
PowerManager.addThermalHeadroomListener
and
PowerManager.removeThermalHeadroomListener
to notify caller of Thermal headroom or thresholds changes.
Summary
Public methods |
abstract
void
|
onThermalHeadroomChanged(float headroom, float forecastHeadroom, int forecastSeconds, Map<Integer, Float> thresholds)
Called when overall thermal headroom or headroom thresholds have significantly
changed that requires action.
|
Public methods
onThermalHeadroomChanged
public abstract void onThermalHeadroomChanged (float headroom,
float forecastHeadroom,
int forecastSeconds,
Map<Integer, Float> thresholds)
Called when overall thermal headroom or headroom thresholds have significantly
changed that requires action.
This may not be used to fully replace the PowerManager.getThermalHeadroom(int)
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.
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 PowerManager.getThermalHeadroom(int)
API should still be used to actively monitor temperature forecast in advance.
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.
Parameters |
headroom |
float : current headroom
Value is 0.0f or greater |
forecastHeadroom |
float : forecasted headroom in future
Value is 0.0f or greater |
forecastSeconds |
int : how many seconds in the future used in forecast
Value is 0 or greater |
thresholds |
Map : new headroom thresholds, see PowerManager.getThermalHeadroomThresholds()
This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# PowerManager.OnThermalHeadroomChangedListener\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nPowerManager.OnThermalHeadroomChangedListener\n=============================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/os/PowerManager.OnThermalHeadroomChangedListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nPowerManager.OnThermalHeadroomChangedListener\n`\n\n\n`\n\n\n`\n\n|----------------------------------------------------------|\n| android.os.PowerManager.OnThermalHeadroomChangedListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nListener passed to\n[PowerManager.addThermalHeadroomListener](/reference/android/os/PowerManager#addThermalHeadroomListener(android.os.PowerManager.OnThermalHeadroomChangedListener)) and\n[PowerManager.removeThermalHeadroomListener](/reference/android/os/PowerManager#removeThermalHeadroomListener(android.os.PowerManager.OnThermalHeadroomChangedListener))\nto notify caller of Thermal headroom or thresholds changes.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onThermalHeadroomChanged](/reference/android/os/PowerManager.OnThermalHeadroomChangedListener#onThermalHeadroomChanged(float,%20float,%20int,%20java.util.Map\u003cjava.lang.Integer,java.lang.Float\u003e))`(float headroom, float forecastHeadroom, int forecastSeconds, `[Map](/reference/java/util/Map)`\u003c`[Integer](/reference/java/lang/Integer)`, `[Float](/reference/java/lang/Float)`\u003e thresholds) ` Called when overall thermal headroom or headroom thresholds have significantly changed that requires action. |\n\nPublic methods\n--------------\n\n### onThermalHeadroomChanged\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onThermalHeadroomChanged (float headroom, \n float forecastHeadroom, \n int forecastSeconds, \n Map\u003cInteger, Float\u003e thresholds)\n```\n\nCalled when overall thermal headroom or headroom thresholds have significantly\nchanged that requires action.\n\n\nThis may not be used to fully replace the [PowerManager.getThermalHeadroom(int)](/reference/android/os/PowerManager#getThermalHeadroom(int)) API as it will\nonly notify on one of the conditions below that will significantly change one or both\nvalues of current headroom and headroom thresholds since previous callback:\n1. thermal throttling events: when the skin temperature has cross any of the thresholds\nand there isn't a previous callback in a short time ago with similar values.\n2. skin temperature threshold change events: note that if the absolute °C threshold\nvalues change in a way that does not significantly change the current headroom nor\nheadroom thresholds, it will not trigger any callback. The client should not\nneed to take action in such case since the difference from temperature vs threshold\nhasn't changed.\n\n\nBy API version 36, it provides a forecast in the same call for developer's convenience\nbased on a `forecastSeconds` defined by the device, which can be static or dynamic\nvaried by OEM. Be aware that it will not notify on forecast temperature change but the\nevents mentioned above. So periodically polling against [PowerManager.getThermalHeadroom(int)](/reference/android/os/PowerManager#getThermalHeadroom(int))\nAPI should still be used to actively monitor temperature forecast in advance.\n\n\nThis serves as a more advanced option compared to thermal status listener, where the\nlatter will only notify on thermal throttling events with status update.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `headroom` | `float`: current headroom Value is 0.0f or greater \u003cbr /\u003e |\n| `forecastHeadroom` | `float`: forecasted headroom in future Value is 0.0f or greater \u003cbr /\u003e |\n| `forecastSeconds` | `int`: how many seconds in the future used in forecast Value is 0 or greater \u003cbr /\u003e |\n| `thresholds` | `Map`: new headroom thresholds, see [PowerManager.getThermalHeadroomThresholds()](/reference/android/os/PowerManager#getThermalHeadroomThresholds()) This value cannot be `null`. \u003cbr /\u003e |"]]