A timer metric contains an int count and a long time, measured in milliseconds. Timers track how many times a resource was used, and the total duration for that usage. For example, the android.os.health.UidHealthStats#TIMER_FLASHLIGHT timer tracks how many times the application turned on the flashlight, and for how many milliseconds total it kept it on.

The keys that are available are subject to change, depending on what a particular device or software version is capable of recording. Applications must handle the absence of data without crashing. Requires API level 24 (Android 7.0, Nougat)

getTimer

Return a TimerStat object for the given key. This will allocate a new TimerStat object, which may be wasteful. Instead, use #getTimerCount and #getTimerTime. Requires API level 24 (Android 7.0, Nougat)