Added in API level 24

HardwarePropertiesManager


open class HardwarePropertiesManager
kotlin.Any
   ↳ android.os.HardwarePropertiesManager

The HardwarePropertiesManager class provides a mechanism of accessing hardware state of a device: CPU, GPU and battery temperatures, CPU usage per core, fan speed, etc.

Summary

Constants
static Int

Temperature of battery in Celsius.

static Int

Temperature of CPUs in Celsius.

static Int

Temperature of GPUs in Celsius.

static Int

Temperature of device skin in Celsius.

static Int

Get current temperature.

static Int

Get shutdown temperature threshold.

static Int

Get throttling temperature threshold.

static Int

Get throttling temperature threshold above which minimum clockrates for VR mode will not be met.

static Float

Undefined temperature constant.

Public methods
open Array<CpuUsageInfo!>

Return an array of CPU usage info for each core.

open FloatArray
getDeviceTemperatures(type: Int, source: Int)

Return an array of device temperatures in Celsius.

open FloatArray

Return an array of fan speeds in RPM.

Constants

DEVICE_TEMPERATURE_BATTERY

Added in API level 24
static val DEVICE_TEMPERATURE_BATTERY: Int

Temperature of battery in Celsius.

Value: 2

DEVICE_TEMPERATURE_CPU

Added in API level 24
static val DEVICE_TEMPERATURE_CPU: Int

Temperature of CPUs in Celsius.

Value: 0

DEVICE_TEMPERATURE_GPU

Added in API level 24
static val DEVICE_TEMPERATURE_GPU: Int

Temperature of GPUs in Celsius.

Value: 1

DEVICE_TEMPERATURE_SKIN

Added in API level 24
static val DEVICE_TEMPERATURE_SKIN: Int

Temperature of device skin in Celsius.

Value: 3

TEMPERATURE_CURRENT

Added in API level 24
static val TEMPERATURE_CURRENT: Int

Get current temperature.

Value: 0

TEMPERATURE_SHUTDOWN

Added in API level 24
static val TEMPERATURE_SHUTDOWN: Int

Get shutdown temperature threshold.

Value: 2

TEMPERATURE_THROTTLING

Added in API level 24
static val TEMPERATURE_THROTTLING: Int

Get throttling temperature threshold.

Value: 1

TEMPERATURE_THROTTLING_BELOW_VR_MIN

Added in API level 24
static val TEMPERATURE_THROTTLING_BELOW_VR_MIN: Int

Get throttling temperature threshold above which minimum clockrates for VR mode will not be met.

Value: 3

UNDEFINED_TEMPERATURE

Added in API level 24
static val UNDEFINED_TEMPERATURE: Float

Undefined temperature constant.

Value: -3.4028235E38f

Public methods

getCpuUsages

Added in API level 24
open fun getCpuUsages(): Array<CpuUsageInfo!>

Return an array of CPU usage info for each core.

Return
Array<CpuUsageInfo!> an array of android.os.CpuUsageInfo for each core. Return null for each unplugged core. Empty if CPU usage is not supported on this system.
Exceptions
java.lang.SecurityException if something other than the device owner or the current VR service tries to retrieve information provided by this service.

getDeviceTemperatures

Added in API level 24
open fun getDeviceTemperatures(
    type: Int,
    source: Int
): FloatArray

Return an array of device temperatures in Celsius.

Parameters
type Int: type of requested device temperature, one of DEVICE_TEMPERATURE_CPU, DEVICE_TEMPERATURE_GPU, DEVICE_TEMPERATURE_BATTERY or DEVICE_TEMPERATURE_SKIN. Value is android.os.HardwarePropertiesManager#DEVICE_TEMPERATURE_CPU, android.os.HardwarePropertiesManager#DEVICE_TEMPERATURE_GPU, android.os.HardwarePropertiesManager#DEVICE_TEMPERATURE_BATTERY, or android.os.HardwarePropertiesManager#DEVICE_TEMPERATURE_SKIN
source Int: source of requested device temperature, one of TEMPERATURE_CURRENT, TEMPERATURE_THROTTLING, TEMPERATURE_THROTTLING_BELOW_VR_MIN or TEMPERATURE_SHUTDOWN. Value is android.os.HardwarePropertiesManager#TEMPERATURE_CURRENT, android.os.HardwarePropertiesManager#TEMPERATURE_THROTTLING, android.os.HardwarePropertiesManager#TEMPERATURE_SHUTDOWN, or android.os.HardwarePropertiesManager#TEMPERATURE_THROTTLING_BELOW_VR_MIN
Return
FloatArray an array of requested float device temperatures. Temperature equals to UNDEFINED_TEMPERATURE if undefined. Empty if platform doesn't provide the queried temperature. This value cannot be null.
Exceptions
java.lang.SecurityException if something other than the device owner or the current VR service tries to retrieve information provided by this service.

getFanSpeeds

Added in API level 24
open fun getFanSpeeds(): FloatArray

Return an array of fan speeds in RPM.

Return
FloatArray an array of float fan speeds in RPM. Empty if there are no fans or fan speed is not supported on this system. This value cannot be null.
Exceptions
java.lang.SecurityException if something other than the device owner or the current VR service tries to retrieve information provided by this service.