1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.os.health; 18 19 /** 20 * Keys for {@link HealthStats} returned from 21 * {@link SystemHealthManager#takeUidSnapshot(int) SystemHealthManager.takeUidSnapshot(int)}, 22 * {@link SystemHealthManager#takeMyUidSnapshot() SystemHealthManager.takeMyUidSnapshot()}, and 23 * {@link SystemHealthManager#takeUidSnapshots(int[]) SystemHealthManager.takeUidSnapshots(int[])}. 24 */ 25 public final class UidHealthStats { 26 UidHealthStats()27 private UidHealthStats() { 28 } 29 30 /** 31 * How many milliseconds this statistics report covers in wall-clock time while the 32 * device was on battery including both screen-on and screen-off time. 33 */ 34 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 35 public static final int MEASUREMENT_REALTIME_BATTERY_MS = HealthKeys.BASE_UID + 1; 36 37 /** 38 * How many milliseconds this statistics report covers that the CPU was running while the 39 * device was on battery including both screen-on and screen-off time. 40 */ 41 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 42 public static final int MEASUREMENT_UPTIME_BATTERY_MS = HealthKeys.BASE_UID + 2; 43 44 /** 45 * How many milliseconds this statistics report covers in wall-clock time while the 46 * device was on battery including both screen-on and screen-off time. 47 */ 48 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 49 public static final int MEASUREMENT_REALTIME_SCREEN_OFF_BATTERY_MS = HealthKeys.BASE_UID + 3; 50 51 /** 52 * How many milliseconds this statistics report covers that the CPU was running while the 53 * device was on battery including both screen-on and screen-off time. 54 */ 55 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 56 public static final int MEASUREMENT_UPTIME_SCREEN_OFF_BATTERY_MS = HealthKeys.BASE_UID + 4; 57 58 /** 59 * Key for a TimerStat for the times a 60 * {@link android.os.PowerManager#FULL_WAKE_LOCK full wake lock} 61 * was acquired for this uid. 62 */ 63 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS) 64 public static final int TIMERS_WAKELOCKS_FULL = HealthKeys.BASE_UID + 5; 65 66 /** 67 * Key for a TimerStat for the times a 68 * {@link android.os.PowerManager#PARTIAL_WAKE_LOCK full wake lock} 69 * was acquired for this uid. 70 */ 71 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS) 72 public static final int TIMERS_WAKELOCKS_PARTIAL = HealthKeys.BASE_UID + 6; 73 74 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS) 75 public static final int TIMERS_WAKELOCKS_WINDOW = HealthKeys.BASE_UID + 7; 76 77 /** 78 * Key for a TimerStat for the times a system-defined wakelock was acquired 79 * to allow the application to draw when it otherwise would not be able to 80 * (e.g. on the lock screen or doze screen). 81 */ 82 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS) 83 public static final int TIMERS_WAKELOCKS_DRAW = HealthKeys.BASE_UID + 8; 84 85 /** 86 * Key for a map of Timers for the sync adapter syncs that were done for 87 * this uid. 88 */ 89 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS) 90 public static final int TIMERS_SYNCS = HealthKeys.BASE_UID + 9; 91 92 /** 93 * Key for a map of Timers for the {@link android.app.job.JobScheduler} jobs for 94 * this uid. 95 */ 96 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS) 97 public static final int TIMERS_JOBS = HealthKeys.BASE_UID + 10; 98 99 /** 100 * Key for a timer for the applications use of the GPS sensor. 101 */ 102 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 103 public static final int TIMER_GPS_SENSOR = HealthKeys.BASE_UID + 11; 104 105 /** 106 * Key for a map of the sensor usage for this uid. The keys are a 107 * string representation of the handle for the sensor. 108 */ 109 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS) 110 public static final int TIMERS_SENSORS = HealthKeys.BASE_UID + 12; 111 112 /** 113 * Key for a HealthStats with {@link PidHealthStats} keys for each of the 114 * currently running processes for this uid. 115 */ 116 @HealthKeys.Constant(type=HealthKeys.TYPE_STATS) 117 public static final int STATS_PIDS = HealthKeys.BASE_UID + 13; 118 119 /** 120 * Key for a HealthStats with {@link ProcessHealthStats} keys for each of the 121 * named processes for this uid. 122 */ 123 @HealthKeys.Constant(type=HealthKeys.TYPE_STATS) 124 public static final int STATS_PROCESSES = HealthKeys.BASE_UID + 14; 125 126 /** 127 * Key for a HealthStats with {@link PackageHealthStats} keys for each of the 128 * APKs that share this uid. 129 */ 130 @HealthKeys.Constant(type=HealthKeys.TYPE_STATS) 131 public static final int STATS_PACKAGES = HealthKeys.BASE_UID + 15; 132 133 /** 134 * Key for a measurement of number of millseconds the wifi controller was 135 * idle but turned on on behalf of this uid. 136 */ 137 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 138 public static final int MEASUREMENT_WIFI_IDLE_MS = HealthKeys.BASE_UID + 16; 139 140 /** 141 * Key for a measurement of number of millseconds the wifi transmitter was 142 * receiving data for this uid. 143 */ 144 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 145 public static final int MEASUREMENT_WIFI_RX_MS = HealthKeys.BASE_UID + 17; 146 147 /** 148 * Key for a measurement of number of millseconds the wifi transmitter was 149 * transmitting data for this uid. 150 */ 151 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 152 public static final int MEASUREMENT_WIFI_TX_MS = HealthKeys.BASE_UID + 18; 153 154 /** 155 * Key for a measurement of the estimated number of mA*ms used by this uid 156 * for wifi, that is to say the number of milliseconds of wifi activity 157 * times the mA current during that period. 158 */ 159 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 160 public static final int MEASUREMENT_WIFI_POWER_MAMS = HealthKeys.BASE_UID + 19; 161 162 /** 163 * Key for a measurement of number of millseconds the bluetooth controller was 164 * idle but turned on on behalf of this uid. 165 */ 166 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 167 public static final int MEASUREMENT_BLUETOOTH_IDLE_MS = HealthKeys.BASE_UID + 20; 168 169 /** 170 * Key for a measurement of number of millseconds the bluetooth transmitter was 171 * receiving data for this uid. 172 */ 173 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 174 public static final int MEASUREMENT_BLUETOOTH_RX_MS = HealthKeys.BASE_UID + 21; 175 176 /** 177 * Key for a measurement of number of millseconds the bluetooth transmitter was 178 * transmitting data for this uid. 179 */ 180 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 181 public static final int MEASUREMENT_BLUETOOTH_TX_MS = HealthKeys.BASE_UID + 22; 182 183 /** 184 * Key for a measurement of the estimated number of mA*ms used by this uid 185 * for bluetooth, that is to say the number of milliseconds of activity 186 * times the mA current during that period. 187 */ 188 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 189 public static final int MEASUREMENT_BLUETOOTH_POWER_MAMS = HealthKeys.BASE_UID + 23; 190 191 /** 192 * Key for a measurement of number of millseconds the mobile radio controller was 193 * idle but turned on on behalf of this uid. 194 */ 195 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 196 public static final int MEASUREMENT_MOBILE_IDLE_MS = HealthKeys.BASE_UID + 24; 197 198 /** 199 * Key for a measurement of number of millseconds the mobile radio transmitter was 200 * receiving data for this uid. 201 */ 202 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 203 public static final int MEASUREMENT_MOBILE_RX_MS = HealthKeys.BASE_UID + 25; 204 205 /** 206 * Key for a measurement of number of millseconds the mobile radio transmitter was 207 * transmitting data for this uid. 208 */ 209 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 210 public static final int MEASUREMENT_MOBILE_TX_MS = HealthKeys.BASE_UID + 26; 211 212 /** 213 * Key for a measurement of the estimated number of mA*ms used by this uid 214 * for mobile data, that is to say the number of milliseconds of activity 215 * times the mA current during that period. 216 */ 217 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 218 public static final int MEASUREMENT_MOBILE_POWER_MAMS = HealthKeys.BASE_UID + 27; 219 220 /** 221 * Key for a measurement of number of millseconds the wifi controller was 222 * active on behalf of this uid. 223 */ 224 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 225 public static final int MEASUREMENT_WIFI_RUNNING_MS = HealthKeys.BASE_UID + 28; 226 227 /** 228 * Key for a measurement of number of millseconds that this uid held a full wifi lock. 229 */ 230 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 231 public static final int MEASUREMENT_WIFI_FULL_LOCK_MS = HealthKeys.BASE_UID + 29; 232 233 /** 234 * Key for a timer for the count and duration of wifi scans done by this uid. 235 */ 236 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 237 public static final int TIMER_WIFI_SCAN = HealthKeys.BASE_UID + 30; 238 239 /** 240 * Key for a measurement of number of millseconds that this uid was performing 241 * multicast wifi traffic. 242 */ 243 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 244 public static final int MEASUREMENT_WIFI_MULTICAST_MS = HealthKeys.BASE_UID + 31; 245 246 /** 247 * Key for a timer for the count and duration of audio playback done by this uid. 248 */ 249 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 250 public static final int TIMER_AUDIO = HealthKeys.BASE_UID + 32; 251 252 /** 253 * Key for a timer for the count and duration of video playback done by this uid. 254 */ 255 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 256 public static final int TIMER_VIDEO = HealthKeys.BASE_UID + 33; 257 258 /** 259 * Key for a timer for the count and duration this uid had the flashlight turned on. 260 */ 261 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 262 public static final int TIMER_FLASHLIGHT = HealthKeys.BASE_UID + 34; 263 264 /** 265 * Key for a timer for the count and duration this uid had the camera turned on. 266 */ 267 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 268 public static final int TIMER_CAMERA = HealthKeys.BASE_UID + 35; 269 270 /** 271 * Key for a timer for the count and duration of when an activity from this uid 272 * was the foreground activitiy. 273 */ 274 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 275 public static final int TIMER_FOREGROUND_ACTIVITY = HealthKeys.BASE_UID + 36; 276 277 /** 278 * Key for a timer for the count and duration of when this uid was doing bluetooth scans. 279 */ 280 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 281 public static final int TIMER_BLUETOOTH_SCAN = HealthKeys.BASE_UID + 37; 282 283 /** 284 * Key for a timer for the count and duration of when this uid was in the "top" process state. 285 */ 286 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 287 public static final int TIMER_PROCESS_STATE_TOP_MS = HealthKeys.BASE_UID + 38; 288 289 /** 290 * Key for a timer for the count and duration of when this uid was in the "foreground service" 291 * process state. 292 */ 293 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 294 public static final int TIMER_PROCESS_STATE_FOREGROUND_SERVICE_MS = HealthKeys.BASE_UID + 39; 295 296 /** 297 * Key for a timer for the count and duration of when this uid was in the "top sleeping" 298 * process state. 299 */ 300 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 301 public static final int TIMER_PROCESS_STATE_TOP_SLEEPING_MS = HealthKeys.BASE_UID + 40; 302 303 /** 304 * Key for a timer for the count and duration of when this uid was in the "foreground" 305 * process state. 306 */ 307 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 308 public static final int TIMER_PROCESS_STATE_FOREGROUND_MS = HealthKeys.BASE_UID + 41; 309 310 /** 311 * Key for a timer for the count and duration of when this uid was in the "background" 312 * process state. 313 */ 314 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 315 public static final int TIMER_PROCESS_STATE_BACKGROUND_MS = HealthKeys.BASE_UID + 42; 316 317 /** 318 * Key for a timer for the count and duration of when this uid was in the "cached" process 319 * state. 320 */ 321 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 322 public static final int TIMER_PROCESS_STATE_CACHED_MS = HealthKeys.BASE_UID + 43; 323 324 /** 325 * Key for a timer for the count and duration this uid had the vibrator turned on. 326 */ 327 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 328 public static final int TIMER_VIBRATOR = HealthKeys.BASE_UID + 44; 329 330 /** 331 * Key for a measurement of number of software-generated user activity events caused 332 * by the UID. Calls to userActivity() reset the user activity countdown timer and 333 * keep the screen on for the user's preferred screen-on setting. 334 */ 335 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 336 public static final int MEASUREMENT_OTHER_USER_ACTIVITY_COUNT = HealthKeys.BASE_UID + 45; 337 338 /** 339 * Key for a measurement of number of user activity events due to physical button presses caused 340 * by the UID. Calls to userActivity() reset the user activity countdown timer and 341 * keep the screen on for the user's preferred screen-on setting. 342 */ 343 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 344 public static final int MEASUREMENT_BUTTON_USER_ACTIVITY_COUNT = HealthKeys.BASE_UID + 46; 345 346 /** 347 * Key for a measurement of number of user activity events due to touch events caused 348 * by the UID. Calls to userActivity() reset the user activity countdown timer and 349 * keep the screen on for the user's preferred screen-on setting. 350 */ 351 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 352 public static final int MEASUREMENT_TOUCH_USER_ACTIVITY_COUNT = HealthKeys.BASE_UID + 47; 353 354 /** 355 * Key for a measurement of number of bytes received for this uid by the mobile radio. 356 */ 357 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 358 public static final int MEASUREMENT_MOBILE_RX_BYTES = HealthKeys.BASE_UID + 48; 359 360 /** 361 * Key for a measurement of number of bytes transmitted for this uid by the mobile radio. 362 */ 363 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 364 public static final int MEASUREMENT_MOBILE_TX_BYTES = HealthKeys.BASE_UID + 49; 365 366 /** 367 * Key for a measurement of number of bytes received for this uid by the wifi radio. 368 */ 369 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 370 public static final int MEASUREMENT_WIFI_RX_BYTES = HealthKeys.BASE_UID + 50; 371 372 /** 373 * Key for a measurement of number of bytes transmitted for this uid by the wifi radio. 374 */ 375 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 376 public static final int MEASUREMENT_WIFI_TX_BYTES = HealthKeys.BASE_UID + 51; 377 378 /** 379 * Key for a measurement of number of bytes received for this uid by the bluetooth radio. 380 */ 381 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 382 public static final int MEASUREMENT_BLUETOOTH_RX_BYTES = HealthKeys.BASE_UID + 52; 383 384 /** 385 * Key for a measurement of number of bytes transmitted for this uid by the bluetooth radio. 386 */ 387 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 388 public static final int MEASUREMENT_BLUETOOTH_TX_BYTES = HealthKeys.BASE_UID + 53; 389 390 /** 391 * Key for a measurement of number of packets received for this uid by the mobile radio. 392 */ 393 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 394 public static final int MEASUREMENT_MOBILE_RX_PACKETS = HealthKeys.BASE_UID + 54; 395 396 /** 397 * Key for a measurement of number of packets transmitted for this uid by the mobile radio. 398 */ 399 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 400 public static final int MEASUREMENT_MOBILE_TX_PACKETS = HealthKeys.BASE_UID + 55; 401 402 /** 403 * Key for a measurement of number of packets received for this uid by the wifi radio. 404 */ 405 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 406 public static final int MEASUREMENT_WIFI_RX_PACKETS = HealthKeys.BASE_UID + 56; 407 408 /** 409 * Key for a measurement of number of packets transmitted for this uid by the wifi radio. 410 */ 411 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 412 public static final int MEASUREMENT_WIFI_TX_PACKETS = HealthKeys.BASE_UID + 57; 413 414 /** 415 * Key for a measurement of number of packets received for this uid by the bluetooth radio. 416 */ 417 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 418 public static final int MEASUREMENT_BLUETOOTH_RX_PACKETS = HealthKeys.BASE_UID + 58; 419 420 /** 421 * Key for a measurement of number of packets transmitted for this uid by the bluetooth radio. 422 */ 423 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 424 public static final int MEASUREMENT_BLUETOOTH_TX_PACKETS = HealthKeys.BASE_UID + 59; 425 426 /** 427 * Key for a timer for the count and duration the mobile radio was turned on for this uid. 428 */ 429 @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER) 430 public static final int TIMER_MOBILE_RADIO_ACTIVE = HealthKeys.BASE_UID + 61; 431 432 /** 433 * Key for a measurement of the number of milliseconds spent by the CPU running user space 434 * code for this uid. 435 */ 436 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 437 public static final int MEASUREMENT_USER_CPU_TIME_MS = HealthKeys.BASE_UID + 62; 438 439 /** 440 * Key for a measurement of the number of milliseconds spent by the CPU running kernel 441 * code for this uid. 442 */ 443 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 444 public static final int MEASUREMENT_SYSTEM_CPU_TIME_MS = HealthKeys.BASE_UID + 63; 445 446 /** 447 * An estimate of the number of milliamp-microsends used by this uid. 448 * 449 * @deprecated this measurement is vendor-dependent and not reliable. 450 */ 451 @Deprecated 452 @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) 453 public static final int MEASUREMENT_CPU_POWER_MAMS = HealthKeys.BASE_UID + 64; 454 455 /** 456 * @hide 457 */ 458 public static final HealthKeys.Constants CONSTANTS = new HealthKeys.Constants(UidHealthStats.class); 459 } 460 461