Phones: heat and battery

Play this lesson

Minute 1 and minute 20

A co-op session of Shard Garden lasts about 40 minutes. In minute 1, Remy's phone runs a steady 60 FPS. By minute 20, it is at 38 FPS and warm in the hand. Nothing in the code changed.

All the chips' work turns into heat, and a phone has little room to lose it. So it slows its own chips to cool down: thermal throttling. Android's guide says how much depends on the weather, recent use and the phone's design.

A game tested for one minute on a cool phone has measured its best moment, not a real session.

Android: thermal headroom

From Android 11, PowerManager.getThermalHeadroom(seconds) forecasts how hot the phone will be. 0.0 means no throttling, and 1.0 means heavy throttling, the severe status. If getThermalHeadroom(30) returns 0.8, the phone is expected to be 0.2 away from severe throttling in 30 seconds.

The statuses run from THERMAL_STATUS_NONE through light, moderate, severe, critical and emergency, to shutdown. Google's advice: lower the frame rate or the detail before the phone gets there, and don't ask more than once every 10 seconds.

Bug hunt

Thermal.kt
// runs 60 times a secondfun onFrame() {  val h = powerManager    .getThermalHeadroom(10)  if (h > 0.85f)    lowerQuality()  drawGarden()}

In Remy's build, the headroom always comes back as NaN (not a number). Which lines are the problem?

  1. Lines 3 and 4
  2. Lines 5 and 6
  3. Line 7
Show the answer

Lines 3 and 4

Lines 3 and 4 ask 60 times a second. Asked more often than once every 10 seconds, the API returns NaN. Check it on a 10-second timer and keep the latest value.

iPhone: the thermal state

On iPhones, ProcessInfo.thermalState has four levels:

On the web

Tune it

Remy, #perf
My iPhone just reported thermalState serious in the middle of a co-op match. What should the game do?

Which response fits Apple's advice?

  1. Drop to 30 FPS and draw fewer sparkle particles until the phone cools
  2. Switch to 120 FPS to finish the wave faster
  3. Kick the player out of the match
Show the answer

Drop to 30 FPS and draw fewer sparkle particles until the phone cools

Apple lists both for the serious state: a lower target frame rate and fewer particles. The match goes on, a bit less shiny, instead of overheating or ending.

Battery is heat you can see

Quick check

If getThermalHeadroom returns 0.9, the phone is 0.1 away from severe throttling.

Show the answer

True

1.0 means the severe status. 0.9 leaves 0.1 to go, so it is time to lower the workload before players feel it.

From one phone to thousands

Every phone talks to our servers. When thousands join at once, the servers have limits of their own.

Bolt says: Next: load testing, where we find those limits before players do.

Fact-checked 11 October 2026