3

At work, I run lots of automated software testing on Android phones. They stay permanently plugged into a development machine, and are given jobs to run via ADB. I'd very much like to be able to monitor their temperatures, and doing so via ADB would be the easy way.

1 Answer 1

7

This is simple, on Android 10 or later, once you find out how.

adb shell dumpsys thermalservice

On my Samsung A52 5G with Android 12, this produces, with values apparently in Celsius.

IsStatusOverride: false
ThermalEventListeners:
        callbacks: 1
        killed: false
        broadcasts count: -1
ThermalStatusListeners:
        callbacks: 4
        killed: false
        broadcasts count: -1
Thermal Status: 0
Cached temperatures:
        Temperature{mValue=0.0, mType=2, mName=SUBBAT, mStatus=0}
        Temperature{mValue=0.0, mType=2, mName=SUBBATRAW, mStatus=0}
        Temperature{mValue=25.6, mType=0, mName=AP, mStatus=0}
        Temperature{mValue=25.7, mType=5, mName=PA, mStatus=0}
        Temperature{mValue=23.8, mType=2, mName=BAT, mStatus=0}
        Temperature{mValue=24.7, mType=3, mName=LRB, mStatus=0}
        Temperature{mValue=24.7, mType=3, mName=LRF, mStatus=0}
        Temperature{mValue=24.7, mType=3, mName=LRP, mStatus=0}
        Temperature{mValue=0.0, mType=4, mName=USB, mStatus=0}
HAL Ready: true
HAL connection:
        ThermalHAL 2.0 connected: yes
Current temperatures from HAL:
        Temperature{mValue=25.6, mType=0, mName=AP, mStatus=0}
        Temperature{mValue=23.8, mType=2, mName=BAT, mStatus=0}
        Temperature{mValue=24.7, mType=3, mName=LRB, mStatus=0}
        Temperature{mValue=24.7, mType=3, mName=LRF, mStatus=0}
        Temperature{mValue=24.7, mType=3, mName=LRP, mStatus=0}
        Temperature{mValue=25.7, mType=5, mName=PA, mStatus=0}
        Temperature{mValue=0.0, mType=2, mName=SUBBAT, mStatus=0}
        Temperature{mValue=0.0, mType=2, mName=SUBBATRAW, mStatus=0}
        Temperature{mValue=0.0, mType=4, mName=USB, mStatus=0}
Current cooling devices from HAL:
Temperature static thresholds from HAL:

A Samsung Galaxy Tab A7 Lite with Android 11 has (trimmed down):

Current temperatures from HAL:
        Temperature{mValue=29.1, mType=0, mName=CPU, mStatus=0}
        Temperature{mValue=29.1, mType=1, mName=GPU, mStatus=0}
        Temperature{mValue=24.0, mType=2, mName=BATTERY, mStatus=0}
        Temperature{mValue=26.0, mType=3, mName=SKIN, mStatus=0}
        Temperature{mValue=25.0, mType=5, mName=POWER_AMPLIFIER, mStatus=0}
        Temperature{mValue=29.1, mType=9, mName=NPU, mStatus=0}

My very cheap Chinese Android 10 tablet says:

IsStatusOverride: false
ThermalEventListeners:
        callbacks: 1
        killed: false
        broadcasts count: -1
ThermalStatusListeners:
        callbacks: 2
        killed: false
        broadcasts count: -1
Thermal Status: 0
Cached temperatures:
        Temperature{mValue=30.8, mType=3, mName=test temperature sensor, mStatus=0}
HAL Ready: true
HAL connection:
        ThermalHAL 2.0 connected: yes
Current temperatures from HAL:
        Temperature{mValue=30.8, mType=3, mName=test temperature sensor, mStatus=0}
Current cooling devices from HAL:
        CoolingDevice{mValue=100, mType=0, mName=test cooling device}

That's probably the default configuration in Android 10.

The underlying Android service for this is a bit complicated. It says that HAL 2.0 appeared at Android 10, and previous versions only had HAL 1.0. The only pre-Android 10 device I've tried so far was a Black Shark 2 with Android 9, where dumpsys thermalservice didn't produce any output.

I have only figured out parts of the mName values so far. It seems clear that the names vary between manufacturers, but the mType values seem to be consistent.

  • AP = Application Processor - maybe the SoC, or the CPU? mType 0.
  • BAT = BATTERY = Battery. mType 2, which makes it very plausible that SUBBAT and SUBBATRAW are battery-related, as the names suggest.
  • CPU = CPU. mType 0.
  • GPU = GPU. mType 1.
  • NPU = Neural Processing Unit? mType 9.
  • PA = Power Amplifier. mType 5.
  • SKIN = Device case, presumably. mType 3. That suggests that LRB, LRF and LRP on the Samsung are something to do with the case or buttons, and that the sole sensor on the cheap tablet is monitoring the case.
  • USB = Universal Serial Bus, presumably. mType 4.

Source for some of those.

The mStatus values are the power throttling status, from 0 (no throttling) to 6 (shut down due to heat).

Evaluating the results

Rather than trying to decide on temperature limits myself, the best way seems to be to parse the output for "Temperature{ ... }" lines, and if any of them have mStatus values greater than zero, treat the device as overheating and stop giving it work for a while. That delegates the decision to the device manufacturer, who will inevitably know more than me about the thermal behaviour of their designs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .