• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2018 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 com_android_server_wifi;
20
21option java_package = "com.android.server.wifi.proto";
22option java_outer_classname = "WifiScoreCardProto";
23
24message NetworkList {
25  optional int64 start_time_millis = 1; // Start of collection period
26  optional int64 end_time_millis = 2;   // End of collection period
27  // A collection of network descriptions
28  repeated Network networks = 3;
29};
30
31// Describes a network, consisting of a collection of access points that share
32// the same SSID, the same security type, and (hopefully) the same L3 subnet.
33// This message is not stored in the MemoryStore. It is used to package
34// the access points of a network together in dumpsys output or similar.
35// For this purpose, the network_config_id and network_agent_id may be useful
36// for cross-referencing with other parts of the bug report. Neither of these
37// are meaningful across reboots.
38message Network {
39  optional string ssid = 1;                // The SSID (not stored)
40  optional SecurityType security_type = 2; // Wireless security type
41  repeated AccessPoint access_points = 3;  // The list of related APs
42  optional int32 network_config_id = 4;    // The networkId of WifiConfiguration
43  optional int32 network_agent_id = 5;     // Latest NetworkAgent netId
44  optional NetworkStats network_stats = 6; // Network stats of current SSID
45};
46
47// Describes an access point (single BSSID)
48//
49// Beyond the BSSID, a concise id is assigned to track references
50// among APs. These ids are local to the device, but unique among all APs
51// known to the device. The BSSID itself is not stored in persistent storage.
52message AccessPoint {
53  optional int32 id = 1;               // Concise id
54  optional bytes bssid = 2;            // BSSID of the access point (not stored)
55  optional SecurityType security_type = 6; // Wireless security type
56  reserved 3;
57  repeated Signal event_stats = 4;     // Statistics taken at specific events
58  reserved 5;
59  // Link bandwidth stats of all bands, links and signal levels
60  optional BandwidthStatsAll bandwidth_stats_all = 7;
61};
62
63// Describes the IEEE 802.11 security type
64enum SecurityType {
65    OPEN = 0;         // Open - no encryption
66    WEP = 1;          // Should not be used
67    PSK = 2;          // WPA2
68    EAP = 3;          // Extensible Authentication Protocol
69    SAE = 4;          // WPA3
70    EAP_SUITE_B = 5;
71    OWE = 6;          // Opportunistic Wireless Encryption
72};
73
74// Records statistics gathered at various points in the life-cycle of
75// a connection, e.g., at disconnections of various flavors. May be
76// further split out by frequency.
77//
78message Signal {
79  optional Event event = 1;                   // Type of the event
80  optional int32 frequency = 2;               // Frequency (MHz)
81  optional UnivariateStatistic rssi = 3;      // Signal strength (dBm) of beacons
82  optional UnivariateStatistic linkspeed = 4; // Link speed (Mbits/sec)
83  optional UnivariateStatistic elapsed_ms = 5; // Milliseconds since connection attempt
84};
85
86// Statistics about a real value
87message UnivariateStatistic {
88  // Short-term statistics (for current collection period)
89  optional int64 count = 1;           // Number of events
90  optional double sum = 2;            // Sum of values
91  optional double sum_of_squares = 3; // Sum of squares of values
92  optional double min_value = 4;      // Minimum value during period
93  optional double max_value = 5;      // Maximum value during period
94
95  // Long-term statistics
96  // These are accumulated over a longer time span, and are aged so that
97  // more recent measurements get a higher weight.
98  optional double historical_mean = 6;     // Long-term average
99  optional double historical_variance = 7; // Long-term variance
100
101  // Arranged by increasing value
102  repeated HistogramBucket buckets = 8;
103};
104
105message HistogramBucket {
106  // Lower bound (inclusive) for values falling in this bucket.
107  // Compact signed encoding used here, because rssi values are negative.
108  // The upper bound is not stored explicitly.
109  optional sint64 low = 1;
110  // Number of occurrences for this value or bucket.
111  optional int64 number = 2;
112}
113
114message BandwidthStatsAll {
115  // Stats of 2g band
116  optional BandwidthStatsAllLink stats_2g = 1;
117  // Stats of above-2g band
118  optional BandwidthStatsAllLink stats_above_2g = 2;
119}
120
121message BandwidthStatsAllLink {
122  // Tx bandwidth stats
123  optional BandwidthStatsAllLevel tx = 1;
124  // Rx bandwidth stats
125  optional BandwidthStatsAllLevel rx = 2;
126}
127
128// Bandwidth of all signal levels
129// The number of entries will match WifiScoreCard.NUM_SIGNAL_LEVEL
130message BandwidthStatsAllLevel {
131  repeated BandwidthStats level = 1;
132}
133
134message BandwidthStats {
135  // Accumulated bandwidth sample value
136  optional uint64 value = 1;
137  // Accumulated bandwidth sample count
138  optional uint32 count = 2;
139}
140
141// Events where statistics may be collected
142enum Event {
143  SIGNAL_POLL = 1;
144  SCAN_BEFORE_SUCCESSFUL_CONNECTION = 2;
145  FIRST_POLL_AFTER_CONNECTION = 3;
146  IP_CONFIGURATION_SUCCESS = 4;
147  SCAN_BEFORE_FAILED_CONNECTION = 5;
148  CONNECTION_FAILURE = 6;
149  IP_REACHABILITY_LOST = 7;
150  LAST_POLL_BEFORE_ROAM = 8;
151  ROAM_SUCCESS = 9;
152  WIFI_DISABLED = 10;
153  ROAM_FAILURE = 11;
154  LAST_POLL_BEFORE_SWITCH = 12;
155  VALIDATION_SUCCESS = 13;
156  DISCONNECTION = 14;
157  CONNECTION_ATTEMPT = 15;
158  VALIDATION_FAILURE = 16;
159};
160
161message SystemInfoStats {
162  // Current software build information
163  optional SoftwareBuildInfo curr_software_build_info = 1;
164  // Previous software build information
165  optional SoftwareBuildInfo prev_software_build_info = 2;
166  // Most recent WiFi scan time
167  optional int64 last_scan_time_ms = 3;
168  // Number of access points found in most recent WiFi scan at 2G
169  optional int32 num_bssid_last_scan_2g = 4;
170  // Number of access points found in most recent WiFi scan above 2G
171  optional int32 num_bssid_last_scan_above_2g = 5;
172}
173
174message SoftwareBuildInfo {
175  // Android OS build version
176  optional string os_build_version = 1;
177  // WiFi stack APK version, 0 means not available.
178  optional int64 wifi_stack_version = 2;
179  // WiFi driver version
180  optional string wifi_driver_version = 3;
181  // WiFi firmware version
182  optional string wifi_firmware_version = 4;
183}
184
185message NetworkStats {
186  optional int32 id = 1;    // Concise id
187  // The most recent connection stats with current SW build that may be collected over days
188  optional ConnectionStats recent_stats = 2;
189  // Accumulated connection stats with current SW build
190  optional ConnectionStats stats_curr_build = 3;
191  // Accumulated connection stats with previous SW build
192  optional ConnectionStats stats_prev_build = 4;
193  // List of frequencies observed for this network from scan results, sorted by most recent first.
194  repeated int32 frequencies = 5;
195  // Link bandwidth stats of all bands, links and signal levels
196  optional BandwidthStatsAll bandwidth_stats_all = 6;
197};
198
199message ConnectionStats {
200  // Number of connection attempts at high RSSI
201  optional int32 num_connection_attempt = 1;
202  // Number of connection failures at high RSSI
203  // Does not include wrong password but does include DHCP
204  optional int32 num_connection_failure = 2;
205  // Total connection duration in seconds
206  optional int32 connection_duration_sec = 3;
207  // Number of association rejections at high RSSI
208  optional int32 num_association_rejection = 4;
209  // Number of association timeouts at high RSSI
210  optional int32 num_association_timeout = 5;
211  // Number of authentication failures (excluding wrong password) at high RSSI
212  optional int32 num_authentication_failure = 6;
213  // Number of short connections caused by nonlocal disconnection at high RSSI
214  // or at high Tx speed with a recent RSSI poll
215  optional int32 num_short_connection_nonlocal = 7;
216  // Number of non-local disconnections after L3 connection at high RSSI
217  // or Tx speed with a recent RSSI poll
218  optional int32 num_disconnection_nonlocal = 8;
219  // Number of disconnections after L3 connection with a recent RSSI poll
220  optional int32 num_disconnection = 9;
221  // Number of non-local disconnections during the connecting state at high RSSI
222  optional int32 num_disconnection_nonlocal_connecting = 10;
223}
224