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
static val DEVICE_TEMPERATURE_BATTERY: Int
Temperature of battery in Celsius.
Value: 2DEVICE_TEMPERATURE_CPU
static val DEVICE_TEMPERATURE_CPU: Int
Temperature of CPUs in Celsius.
Value: 0DEVICE_TEMPERATURE_GPU
static val DEVICE_TEMPERATURE_GPU: Int
Temperature of GPUs in Celsius.
Value: 1DEVICE_TEMPERATURE_SKIN
static val DEVICE_TEMPERATURE_SKIN: Int
Temperature of device skin in Celsius.
Value: 3TEMPERATURE_CURRENT
static val TEMPERATURE_CURRENT: Int
Get current temperature.
Value: 0TEMPERATURE_SHUTDOWN
static val TEMPERATURE_SHUTDOWN: Int
Get shutdown temperature threshold.
Value: 2TEMPERATURE_THROTTLING
static val TEMPERATURE_THROTTLING: Int
Get throttling temperature threshold.
Value: 1TEMPERATURE_THROTTLING_BELOW_VR_MIN
static val TEMPERATURE_THROTTLING_BELOW_VR_MIN: Int
Get throttling temperature threshold above which minimum clockrates for VR mode will not be met.
Value: 3UNDEFINED_TEMPERATURE
static val UNDEFINED_TEMPERATURE: Float
Undefined temperature constant.
Value: -3.4028235E38fPublic methods
getCpuUsages
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
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
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. |