UidHealthStats.java revision 713fec85b8612256211f09c62b8958a99fe5b9db
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
17package 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 */
25public final class UidHealthStats {
26
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    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS)
78    public static final int TIMERS_WAKELOCKS_DRAW = HealthKeys.BASE_UID + 8;
79
80    /**
81     * Key for a map of Timers for the sync adapter syncs that were done for
82     * this uid.
83     */
84    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS)
85    public static final int TIMERS_SYNCS = HealthKeys.BASE_UID + 9;
86
87    /**
88     * Key for a map of Timers for the {@link android.app.job.JobScheduler} jobs for
89     * this uid.
90     */
91    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS)
92    public static final int TIMERS_JOBS = HealthKeys.BASE_UID + 10;
93
94    /**
95     * Key for a timer for the applications use of the GPS sensor.
96     */
97    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
98    public static final int TIMER_GPS_SENSOR = HealthKeys.BASE_UID + 11;
99
100    /**
101     * Key for a map of the sensor usage for this uid. The keys are a
102     * string representation of the handle for the sensor.
103     */
104    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMERS)
105    public static final int TIMERS_SENSORS = HealthKeys.BASE_UID + 12;
106
107    /**
108     * Key for a HealthStats with {@link PidHealthStats} keys for each of the
109     * currently running processes for this uid.
110     */
111    @HealthKeys.Constant(type=HealthKeys.TYPE_STATS)
112    public static final int STATS_PIDS = HealthKeys.BASE_UID + 13;
113
114    /**
115     * Key for a HealthStats with {@link ProcessHealthStats} keys for each of the
116     * named processes for this uid.
117     */
118    @HealthKeys.Constant(type=HealthKeys.TYPE_STATS)
119    public static final int STATS_PROCESSES = HealthKeys.BASE_UID + 14;
120
121    /**
122     * Key for a HealthStats with {@link PackageHealthStats} keys for each of the
123     * APKs that share this uid.
124     */
125    @HealthKeys.Constant(type=HealthKeys.TYPE_STATS)
126    public static final int STATS_PACKAGES = HealthKeys.BASE_UID + 15;
127
128    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
129    public static final int MEASUREMENT_WIFI_IDLE_MS = HealthKeys.BASE_UID + 16;
130
131    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
132    public static final int MEASUREMENT_WIFI_RX_MS = HealthKeys.BASE_UID + 17;
133
134    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
135    public static final int MEASUREMENT_WIFI_TX_MS = HealthKeys.BASE_UID + 18;
136
137    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
138    public static final int MEASUREMENT_WIFI_POWER_MAMS = HealthKeys.BASE_UID + 19;
139
140    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
141    public static final int MEASUREMENT_BLUETOOTH_IDLE_MS = HealthKeys.BASE_UID + 20;
142
143    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
144    public static final int MEASUREMENT_BLUETOOTH_RX_MS = HealthKeys.BASE_UID + 21;
145
146    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
147    public static final int MEASUREMENT_BLUETOOTH_TX_MS = HealthKeys.BASE_UID + 22;
148
149    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
150    public static final int MEASUREMENT_BLUETOOTH_POWER_MAMS = HealthKeys.BASE_UID + 23;
151
152    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
153    public static final int MEASUREMENT_MOBILE_IDLE_MS = HealthKeys.BASE_UID + 24;
154
155    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
156    public static final int MEASUREMENT_MOBILE_RX_MS = HealthKeys.BASE_UID + 25;
157
158    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
159    public static final int MEASUREMENT_MOBILE_TX_MS = HealthKeys.BASE_UID + 26;
160
161    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
162    public static final int MEASUREMENT_MOBILE_POWER_MAMS = HealthKeys.BASE_UID + 27;
163
164    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
165    public static final int MEASUREMENT_WIFI_RUNNING_MS = HealthKeys.BASE_UID + 28;
166
167    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
168    public static final int MEASUREMENT_WIFI_FULL_LOCK_MS = HealthKeys.BASE_UID + 29;
169
170    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
171    public static final int TIMER_WIFI_SCAN = HealthKeys.BASE_UID + 30;
172
173    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
174    public static final int MEASUREMENT_WIFI_MULTICAST_MS = HealthKeys.BASE_UID + 31;
175
176    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
177    public static final int TIMER_AUDIO = HealthKeys.BASE_UID + 32;
178
179    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
180    public static final int TIMER_VIDEO = HealthKeys.BASE_UID + 33;
181
182    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
183    public static final int TIMER_FLASHLIGHT = HealthKeys.BASE_UID + 34;
184
185    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
186    public static final int TIMER_CAMERA = HealthKeys.BASE_UID + 35;
187
188    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
189    public static final int TIMER_FOREGROUND_ACTIVITY = HealthKeys.BASE_UID + 36;
190
191    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
192    public static final int TIMER_BLUETOOTH_SCAN = HealthKeys.BASE_UID + 37;
193
194    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
195    public static final int TIMER_PROCESS_STATE_TOP_MS = HealthKeys.BASE_UID + 38;
196
197    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
198    public static final int TIMER_PROCESS_STATE_FOREGROUND_SERVICE_MS = HealthKeys.BASE_UID + 39;
199
200    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
201    public static final int TIMER_PROCESS_STATE_TOP_SLEEPING_MS = HealthKeys.BASE_UID + 40;
202
203    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
204    public static final int TIMER_PROCESS_STATE_FOREGROUND_MS = HealthKeys.BASE_UID + 41;
205
206    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
207    public static final int TIMER_PROCESS_STATE_BACKGROUND_MS = HealthKeys.BASE_UID + 42;
208
209    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
210    public static final int TIMER_PROCESS_STATE_CACHED_MS = HealthKeys.BASE_UID + 43;
211
212    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
213    public static final int TIMER_VIBRATOR = HealthKeys.BASE_UID + 44;
214
215    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
216    public static final int MEASUREMENT_OTHER_USER_ACTIVITY_COUNT = HealthKeys.BASE_UID + 45;
217
218    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
219    public static final int MEASUREMENT_BUTTON_USER_ACTIVITY_COUNT = HealthKeys.BASE_UID + 46;
220
221    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
222    public static final int MEASUREMENT_TOUCH_USER_ACTIVITY_COUNT = HealthKeys.BASE_UID + 47;
223
224    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
225    public static final int MEASUREMENT_MOBILE_RX_BYTES = HealthKeys.BASE_UID + 48;
226
227    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
228    public static final int MEASUREMENT_MOBILE_TX_BYTES = HealthKeys.BASE_UID + 49;
229
230    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
231    public static final int MEASUREMENT_WIFI_RX_BYTES = HealthKeys.BASE_UID + 50;
232
233    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
234    public static final int MEASUREMENT_WIFI_TX_BYTES = HealthKeys.BASE_UID + 51;
235
236    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
237    public static final int MEASUREMENT_BLUETOOTH_RX_BYTES = HealthKeys.BASE_UID + 52;
238
239    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
240    public static final int MEASUREMENT_BLUETOOTH_TX_BYTES = HealthKeys.BASE_UID + 53;
241
242    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
243    public static final int MEASUREMENT_MOBILE_RX_PACKETS = HealthKeys.BASE_UID + 54;
244
245    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
246    public static final int MEASUREMENT_MOBILE_TX_PACKETS = HealthKeys.BASE_UID + 55;
247
248    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
249    public static final int MEASUREMENT_WIFI_RX_PACKETS = HealthKeys.BASE_UID + 56;
250
251    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
252    public static final int MEASUREMENT_WIFI_TX_PACKETS = HealthKeys.BASE_UID + 57;
253
254    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
255    public static final int MEASUREMENT_BLUETOOTH_RX_PACKETS = HealthKeys.BASE_UID + 58;
256
257    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
258    public static final int MEASUREMENT_BLUETOOTH_TX_PACKETS = HealthKeys.BASE_UID + 59;
259
260    @HealthKeys.Constant(type=HealthKeys.TYPE_TIMER)
261    public static final int TIMER_MOBILE_RADIO_ACTIVE = HealthKeys.BASE_UID + 61;
262
263    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
264    public static final int MEASUREMENT_USER_CPU_TIME_US = HealthKeys.BASE_UID + 62;
265
266    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
267    public static final int MEASUREMENT_SYSTEM_CPU_TIME_US = HealthKeys.BASE_UID + 63;
268
269    /**
270     * An estimate of the number of milliamp-microsends used by this uid.
271     */
272    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
273    public static final int MEASUREMENT_CPU_POWER_MAUS = HealthKeys.BASE_UID + 64;
274
275    /**
276     * @hide
277     */
278    public static final HealthKeys.Constants CONSTANTS = new HealthKeys.Constants(UidHealthStats.class);
279}
280
281