Added in API level 24

SystemHealthManager


open class SystemHealthManager
kotlin.Any
   ↳ android.os.health.SystemHealthManager

Provides access to data about how various system resources are used by applications.

Summary

Public methods
open Unit

Asynchronously retrieves the accumulated power consumption reported by the specified power monitors.

open Unit

Asynchronously retrieves a list of supported PowerMonitor's, which include raw ODPM (on-device power rail monitor) rails and modeled energy consumers.

open HealthStats!

Return a HealthStats object containing a snapshot of system health metrics for the application calling this API.

open HealthStats!

Return a HealthStats object containing a snapshot of system health metrics for the given uid (user-id, which in usually corresponds to application).

open Array<HealthStats!>!

Return a HealthStats object containing a snapshot of system health metrics for the given uids (user-id, which in usually corresponds to application).

Public methods

getPowerMonitorReadings

Added in API level 35
open fun getPowerMonitorReadings(
    powerMonitors: MutableList<PowerMonitor!>,
    executor: Executor?,
    onResult: OutcomeReceiver<PowerMonitorReadings!, RuntimeException!>
): Unit

Asynchronously retrieves the accumulated power consumption reported by the specified power monitors.

Parameters
powerMonitors MutableList<PowerMonitor!>: power monitors to be retrieved. This value cannot be null.
executor Executor?: optional Executor to deliver the callbacks. If not supplied, the callback may be invoked on an arbitrary thread. This value may be null.
onResult OutcomeReceiver<PowerMonitorReadings!, RuntimeException!>: callback for the result This value cannot be null.

getSupportedPowerMonitors

Added in API level 35
open fun getSupportedPowerMonitors(
    executor: Executor?,
    onResult: Consumer<MutableList<PowerMonitor!>!>
): Unit

Asynchronously retrieves a list of supported PowerMonitor's, which include raw ODPM (on-device power rail monitor) rails and modeled energy consumers. If ODPM is unsupported on this device this method delivers an empty list.

Parameters
executor Executor?: optional Handler to deliver the callback. If not supplied, the callback may be invoked on an arbitrary thread. This value may be null.
onResult Consumer<MutableList<PowerMonitor!>!>: callback for the result This value cannot be null.

takeMyUidSnapshot

Added in API level 24
open fun takeMyUidSnapshot(): HealthStats!

Return a HealthStats object containing a snapshot of system health metrics for the application calling this API. This method is the same as calling takeUidSnapshot(Process.myUid()).

Return
HealthStats! A HealthStats object containing the metrics for this application. The keys for this HealthStats object will be from the UidHealthStats class.

takeUidSnapshot

Added in API level 24
open fun takeUidSnapshot(uid: Int): HealthStats!

Return a HealthStats object containing a snapshot of system health metrics for the given uid (user-id, which in usually corresponds to application).

Parameters
uid Int: User ID for a given application.
Return
HealthStats! A HealthStats object containing the metrics for the requested application. The keys for this HealthStats object will be from the UidHealthStats class.

takeUidSnapshots

Added in API level 24
open fun takeUidSnapshots(uids: IntArray!): Array<HealthStats!>!

Return a HealthStats object containing a snapshot of system health metrics for the given uids (user-id, which in usually corresponds to application).

Parameters
uids IntArray!: An array of User IDs to retrieve.
Return
Array<HealthStats!>! An array of HealthStats objects containing the metrics for each of the requested uids. The keys for this HealthStats object will be from the UidHealthStats class.