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
17syntax = "proto2";
18
19package clearcut.connectivity;
20
21option java_package = "com.android.server.wifi";
22option java_outer_classname = "WifiMetricsProto";
23
24// The information about the Wifi events.
25message WifiLog {
26
27  // Session information that gets logged for every Wifi connection.
28  repeated ConnectionEvent connection_event = 1;
29
30  // Number of saved networks in the user profile.
31  optional int32 num_saved_networks = 2;
32
33  // Number of open networks in the saved networks.
34  optional int32 num_open_networks = 3;
35
36  // Number of personal networks.
37  optional int32 num_personal_networks = 4;
38
39  // Number of enterprise networks.
40  optional int32 num_enterprise_networks = 5;
41
42  // Does the user have location setting enabled.
43  optional bool is_location_enabled = 6;
44
45  // Does the user have scanning enabled.
46  optional bool is_scanning_always_enabled = 7;
47
48  // Number of times user toggled wifi using the settings menu.
49  optional int32 num_wifi_toggled_via_settings = 8;
50
51  // Number of times user toggled wifi using the airplane menu.
52  optional int32 num_wifi_toggled_via_airplane = 9;
53
54  // Number of networks added by the user.
55  optional int32 num_networks_added_by_user = 10;
56
57  // Number of networks added by applications.
58  optional int32 num_networks_added_by_apps = 11;
59
60  // Number scans that returned empty results.
61  optional int32 num_empty_scan_results = 12;
62
63  // Number scans that returned at least one result.
64  optional int32 num_non_empty_scan_results = 13;
65
66  // Number of scans that were one time.
67  optional int32 num_oneshot_scans = 14;
68
69  // Number of repeated background scans that were scheduled to the chip.
70  optional int32 num_background_scans = 15;
71
72  // Error codes that a scan can result in.
73  enum ScanReturnCode {
74
75    // Return Code is unknown.
76    SCAN_UNKNOWN = 0;
77
78    // Scan was successful.
79    SCAN_SUCCESS = 1;
80
81    // Scan was successfully started, but was interrupted.
82    SCAN_FAILURE_INTERRUPTED = 2;
83
84    //  Scan failed to start because of invalid configuration
85    //  (bad channel, etc).
86    SCAN_FAILURE_INVALID_CONFIGURATION = 3;
87
88    // Could not start a scan because wifi is disabled.
89    FAILURE_WIFI_DISABLED = 4;
90
91  }
92
93  // Mapping of error codes to the number of times that scans resulted
94  // in that error.
95  repeated ScanReturnEntry scan_return_entries = 16;
96
97  message ScanReturnEntry {
98
99     // Return code of the scan.
100     optional ScanReturnCode scan_return_code = 1;
101
102     // Number of entries that were found in the scan.
103     optional int32 scan_results_count = 2;
104  }
105
106  // State of the Wifi.
107  enum WifiState {
108
109    // State is unknown.
110    WIFI_UNKNOWN = 0;
111
112    // Wifi is disabled.
113    WIFI_DISABLED = 1;
114
115    // Wifi is enabled.
116    WIFI_DISCONNECTED = 2;
117
118    // Wifi is enabled and associated with an AP.
119    WIFI_ASSOCIATED = 3;
120  }
121
122  // Mapping of system state to the number of times that scans were requested in
123  // that state
124  repeated WifiSystemStateEntry wifi_system_state_entries = 17;
125
126  message WifiSystemStateEntry {
127
128     // Current WiFi state.
129     optional WifiState wifi_state = 1;
130
131     // Count of scans in state.
132     optional int32 wifi_state_count = 2;
133
134     // Is screen on.
135     optional bool is_screen_on = 3;
136  }
137
138  // Mapping of Error/Success codes to the number of background scans that resulted in it
139  repeated ScanReturnEntry background_scan_return_entries = 18;
140
141  // Mapping of system state to the number of times that Background scans were requested in that
142  // state
143  repeated WifiSystemStateEntry background_scan_request_state = 19;
144
145  // Total number of times the Watchdog of Last Resort triggered, resetting the wifi stack
146  optional int32 num_last_resort_watchdog_triggers = 20;
147
148  // Total number of networks over bad association threshold when watchdog triggered
149  optional int32 num_last_resort_watchdog_bad_association_networks_total = 21;
150
151  // Total number of networks over bad authentication threshold when watchdog triggered
152  optional int32 num_last_resort_watchdog_bad_authentication_networks_total = 22;
153
154  // Total number of networks over bad dhcp threshold when watchdog triggered
155  optional int32 num_last_resort_watchdog_bad_dhcp_networks_total = 23;
156
157  // Total number of networks over bad other threshold when watchdog triggered
158  optional int32 num_last_resort_watchdog_bad_other_networks_total = 24;
159
160  // Total count of networks seen when watchdog triggered
161  optional int32 num_last_resort_watchdog_available_networks_total = 25;
162
163  // Total count of triggers with atleast one bad association network
164  optional int32 num_last_resort_watchdog_triggers_with_bad_association = 26;
165
166  // Total count of triggers with atleast one bad authentication network
167  optional int32 num_last_resort_watchdog_triggers_with_bad_authentication = 27;
168
169  // Total count of triggers with atleast one bad dhcp network
170  optional int32 num_last_resort_watchdog_triggers_with_bad_dhcp = 28;
171
172  // Total count of triggers with atleast one bad other network
173  optional int32 num_last_resort_watchdog_triggers_with_bad_other = 29;
174
175  // Count of times connectivity watchdog confirmed pno is working
176  optional int32 num_connectivity_watchdog_pno_good = 30;
177
178  // Count of times connectivity watchdog found pno not working
179  optional int32 num_connectivity_watchdog_pno_bad = 31;
180
181  // Count of times connectivity watchdog confirmed background scan is working
182  optional int32 num_connectivity_watchdog_background_good = 32;
183
184  // Count of times connectivity watchdog found background scan not working
185  optional int32 num_connectivity_watchdog_background_bad = 33;
186
187  // The time duration represented by this wifi log, from start to end of capture
188  optional int32 record_duration_sec = 34;
189}
190
191// Information that gets logged for every WiFi connection.
192message RouterFingerPrint {
193
194  enum RoamType {
195
196    // Type is unknown.
197    ROAM_TYPE_UNKNOWN = 0;
198
199    // No roaming - usually happens on a single band (2.4 GHz) router.
200    ROAM_TYPE_NONE = 1;
201
202    // Enterprise router.
203    ROAM_TYPE_ENTERPRISE = 2;
204
205    // DBDC => Dual Band Dual Concurrent essentially a router that
206    // supports both 2.4 GHz and 5 GHz bands.
207    ROAM_TYPE_DBDC = 3;
208  }
209
210  enum Auth {
211
212    // Auth is unknown.
213    AUTH_UNKNOWN = 0;
214
215    // No authentication.
216    AUTH_OPEN = 1;
217
218    // If the router uses a personal authentication.
219    AUTH_PERSONAL = 2;
220
221    // If the router is setup for enterprise authentication.
222    AUTH_ENTERPRISE = 3;
223  }
224
225  enum RouterTechnology {
226
227    // Router is unknown.
228    ROUTER_TECH_UNKNOWN = 0;
229
230    // Router Channel A.
231    ROUTER_TECH_A = 1;
232
233    // Router Channel B.
234    ROUTER_TECH_B = 2;
235
236    // Router Channel G.
237    ROUTER_TECH_G = 3;
238
239    // Router Channel N.
240    ROUTER_TECH_N = 4;
241
242    // Router Channel AC.
243    ROUTER_TECH_AC = 5;
244
245    // When the channel is not one of the above.
246    ROUTER_TECH_OTHER = 6;
247  }
248
249  optional RoamType roam_type = 1;
250
251  // Channel on which the connection takes place.
252  optional int32 channel_info = 2;
253
254  // DTIM setting of the router.
255  optional int32 dtim = 3;
256
257  // Authentication scheme of the router.
258  optional Auth authentication = 4;
259
260  // If the router is hidded.
261  optional bool hidden = 5;
262
263  // Channel information.
264  optional RouterTechnology router_technology = 6;
265
266  // whether ipv6 is supported.
267  optional bool supports_ipv6 = 7;
268}
269
270message ConnectionEvent {
271
272  // Roam Type.
273  enum RoamType {
274
275    // Type is unknown.
276    ROAM_UNKNOWN = 0;
277
278    // No roaming.
279    ROAM_NONE  = 1;
280
281    // DBDC roaming.
282    ROAM_DBDC = 2;
283
284    // Enterprise roaming.
285    ROAM_ENTERPRISE = 3;
286
287    // User selected roaming.
288    ROAM_USER_SELECTED = 4;
289
290    // Unrelated.
291    ROAM_UNRELATED = 5;
292  }
293
294  // Connectivity Level Failure.
295  enum ConnectivityLevelFailure {
296
297    // Failure is unknown.
298    HLF_UNKNOWN = 0;
299
300    // No failure.
301    HLF_NONE = 1;
302
303    // DHCP failure.
304    HLF_DHCP = 2;
305
306    // No internet connection.
307    HLF_NO_INTERNET = 3;
308
309    // No internet connection.
310    HLF_UNWANTED = 4;
311  }
312
313  // Start time of the connection.
314  optional int64 start_time_millis = 1;// [(datapol.semantic_type) = ST_TIMESTAMP];
315
316  // Duration to connect.
317  optional int32 duration_taken_to_connect_millis = 2;
318
319  // Router information.
320  optional RouterFingerPrint router_fingerprint = 3;
321
322  // RSSI at the start of the connection.
323  optional int32 signal_strength = 4;
324
325  // Roam Type.
326  optional RoamType roam_type = 5;
327
328  // Result of the connection.
329  optional int32 connection_result = 6;
330
331  // Reasons for level 2 failure (needs to be coordinated with wpa-supplicant).
332  optional int32 level_2_failure_code = 7;
333
334  // Failures that happen at the connectivity layer.
335  optional ConnectivityLevelFailure connectivity_level_failure_code = 8;
336
337  // Has bug report been taken.
338  optional bool automatic_bug_report_taken = 9;
339}
340