• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2023 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 android.os.statsd.wifi;
20
21import "frameworks/proto_logging/stats/atom_field_options.proto";
22import "frameworks/proto_logging/stats/atoms.proto";
23import "frameworks/proto_logging/stats/enums/wifi/enums.proto";
24import "frameworks/proto_logging/stats/attribution_node.proto";
25
26option java_package = "com.android.os.wifi";
27option java_multiple_files = true;
28
29extend Atom {
30    // Push metrics
31    optional WifiAwareNdpReported wifi_aware_ndp_reported = 638 [(module) = "wifi"];
32    optional WifiAwareAttachReported wifi_aware_attach_reported = 639 [(module) = "wifi"];
33    optional WifiSelfRecoveryTriggered wifi_self_recovery_triggered = 661 [(module) = "wifi"];
34    optional SoftApStarted soft_ap_started = 680 [(module) = "wifi"];
35    optional SoftApStopped soft_ap_stopped = 681 [(module) = "wifi"];
36    optional WifiLockReleased wifi_lock_released = 687 [(module) = "wifi"];
37    optional WifiLockDeactivated wifi_lock_deactivated = 688 [(module) = "wifi"];
38    optional WifiConfigSaved wifi_config_saved = 689 [(module) = "wifi"];
39    optional WifiAwareResourceUsingChanged wifi_aware_resource_using_changed
40        = 690 [(module) = "wifi"];
41    optional WifiAwareHalApiCalled wifi_aware_hal_api_called = 691 [(module) = "wifi"];
42    optional WifiLocalOnlyRequestReceived wifi_local_only_request_received
43        = 692 [(module) = "wifi"];
44    optional WifiLocalOnlyRequestScanTriggered wifi_local_only_request_scan_triggered
45        = 693 [(module) = "wifi"];
46    optional WifiThreadTaskExecuted wifi_thread_task_executed = 694 [(module) = "wifi"];
47    optional WifiStateChanged wifi_state_changed = 700 [(module) = "wifi"];
48
49    // Pull metrics
50    optional WifiAwareCapabilities wifi_aware_capabilities = 10190 [(module) = "wifi"];
51    optional WifiModuleInfo wifi_module_info = 10193 [(module) = "wifi"];
52}
53
54/**
55 * Pulled atom for tracking wifi version number.
56 */
57message WifiModuleInfo {
58    enum BuildType {
59        TYPE_UNKNOWN = 0;
60        TYPE_BUILT_FROM_SOURCE = 1;
61        TYPE_PREBUILT = 2;
62    }
63    // Version number of the wifi module
64    optional int32 version_number = 1;
65    // The type of the wifi module
66    optional BuildType build_type = 2;
67}
68
69
70/**
71 * Logged when wifi aware data path is completed
72 */
73message WifiAwareNdpReported {
74    enum Role {
75        ROLE_UNKNOWN = 0;
76        ROLE_INITIATOR = 1;
77        ROLE_RESPONDER = 2;
78    }
79    // Role of data path
80    optional Role role = 1;
81    // If it is over out-of-band
82    optional bool is_out_of_band = 2;
83    // Status of NDP
84    optional android.net.wifi.AwareStatus status = 3;
85    // Duration to create NDP in millis.
86    optional int32 ndp_latency_ms= 4;
87    // The latency of discovery + NDP in millis.
88    optional int32 discovery_ndp_latency_ms= 5;
89    // Channel frequency in MHz, 0 if unavailable, >= 2400 otherwise.
90    optional int32 channel_frequency_mhz= 6;
91    // If the instant mode is enabled
92    optional bool is_instant_mode = 7;
93    // The caller type of the NDP request
94    optional android.net.wifi.WifiCallerType caller_type = 8;
95    // The Attribution tag to identify the caller
96    optional string attribution_tag = 9;
97    // The uid of the caller
98    optional int32 uid = 10;
99}
100
101/**
102 * Logged when wifi aware attach is completed
103 */
104message WifiAwareAttachReported {
105    // Status of attach
106    optional android.net.wifi.AwareStatus status = 1;
107    // The caller type of the attach
108    optional android.net.wifi.WifiCallerType caller_type = 2;
109    // The Attribution tag to identify the caller
110    optional string attribution_tag = 3;
111    // The uid of the caller
112    optional int32 uid = 4;
113}
114
115/**
116 * Logged when wifi self recovery triggered
117 */
118message WifiSelfRecoveryTriggered {
119    enum Reason {
120        REASON_UNKNOWN = 0;
121        REASON_LAST_RESORT_WDOG = 1;
122        REASON_WIFINATIVE_FAILURE = 2;
123        REASON_STA_IFACE_DOWN = 3;
124        REASON_API_CALL = 4;
125        REASON_SUBSYSTEM_RESTART = 5;
126        REASON_IFACE_ADDED = 6;
127    }
128    enum Result {
129        RES_UNSPECIFIED = 0;
130        RES_RESTART_SUCCESS = 1;
131        RES_INVALID_REASON = 2;
132        RES_IFACE_DOWN = 3;
133        RES_IFACE_ADD_DISABLED = 4;
134        RES_RETRY_DISABLED = 5;
135        RES_ABOVE_MAX_RETRY = 6;
136        RES_RESTART_FAILURE = 7;
137    }
138
139    // Trigger reason
140    optional Reason reason = 1;
141    // Self recovery result
142    optional Result result = 2;
143    // Record time elapsed from last trigger event
144    optional int64 time_elapsed_from_last_millis = 3;
145}
146
147/**
148 * Logged when Soft AP is started
149 */
150message SoftApStarted {
151    /**
152     * Result of starting Soft AP
153     */
154    enum StartResult {
155        // Unknown
156        START_RESULT_UNKNOWN = 0;
157        // Successful start
158        START_RESULT_SUCCESS = 1;
159        // General failure
160        START_RESULT_FAILURE_GENERAL = 2;
161        // Failed due to no channel available
162        START_RESULT_FAILURE_NO_CHANNEL = 3;
163        // Failed due to config being unsupported
164        START_RESULT_FAILURE_UNSUPPORTED_CONFIG = 4;
165        // Failed to start the HAL
166        START_RESULT_FAILURE_START_HAL = 5;
167        // Failed to start hostapd
168        START_RESULT_FAILURE_START_HOSTAPD = 6;
169        // Failed due to interface conflict with user rejection
170        START_RESULT_FAILURE_INTERFACE_CONFLICT_USER_REJECTED = 7;
171        // Failed due to interface conflict
172        START_RESULT_FAILURE_INTERFACE_CONFLICT = 8;
173        // Failed to create interface in vendor HAL
174        START_RESULT_FAILURE_CREATE_INTERFACE = 9;
175        // Failed to set country code
176        START_RESULT_FAILURE_SET_COUNTRY_CODE = 10;
177        // Failed to set mac address
178        START_RESULT_FAILURE_SET_MAC_ADDRESS = 11;
179        // Failed to register AP callback with hostapd
180        START_RESULT_FAILURE_REGISTER_AP_CALLBACK_HOSTAPD = 12;
181        // Failed to register AP callback with wificond
182        START_RESULT_FAILURE_REGISTER_AP_CALLBACK_WIFICOND = 13;
183        // Failed to add AP to hostapd
184        START_RESULT_FAILURE_ADD_AP_HOSTAPD = 14;
185    }
186    // Result of the start event
187    optional StartResult result = 1;
188    // Role of the Soft AP
189    optional android.net.wifi.SoftApRole role = 2;
190    // First band bitmask indexed by WifiBandBucket
191    optional int32 band1 = 3;
192    // Second band bitmask indexed by WifiBandBucket
193    optional int32 band2 = 4;
194    // Whether DBS is supported or not
195    optional bool dbs_supported = 5;
196    // STA + AP concurrency capability of the device
197    optional android.net.wifi.StaApConcurrency sta_ap_concurrency = 6;
198    // STA connection status at the time of starting
199    optional android.net.wifi.StaStatus sta_status = 7;
200    // Authentication type of the Soft AP
201    optional android.net.wifi.WifiAuthType auth_type = 8;
202}
203
204/**
205 * Logged when Soft AP is stopped
206 */
207message SoftApStopped {
208    /**
209     * Type of Soft AP stop event
210     */
211    enum StopEvent {
212        // Unknown
213        STOP_EVENT_UNKNOWN = 0;
214        // Stopped by the user
215        STOP_EVENT_STOPPED = 1;
216        // Stopped due to interface down
217        STOP_EVENT_INTERFACE_DOWN = 2;
218        // Stopped due to interface destroyed
219        STOP_EVENT_INTERFACE_DESTROYED = 3;
220        // Stopped due to hostapd failure
221        STOP_EVENT_HOSTAPD_FAILURE = 4;
222        // Stopped due to no usage timeout
223        STOP_EVENT_NO_USAGE_TIMEOUT = 5;
224        // Single DBS instance stopped due to no usage timeout
225        STOP_EVENT_NO_USAGE_TIMEOUT_ONE_INSTANCE = 6;
226        // Single DBS instance stopped due to failure
227        STOP_EVENT_INSTANCE_FAILURE = 7;
228    }
229    // Soft AP stop event
230    optional StopEvent stop_event = 1;
231    // Role of the Soft AP
232    optional android.net.wifi.SoftApRole role = 2;
233    // Band of the Soft AP at the time of stopping
234    optional int32 band = 3;
235    // Whether the Soft AP is DBS
236    optional bool is_dbs = 4;
237    // STA + AP concurrency capability of the device
238    optional android.net.wifi.StaApConcurrency sta_ap_concurrency = 5;
239    // STA connection status at the time of stopping
240    optional android.net.wifi.StaStatus sta_status = 6;
241    // Whether or not the no usage timeout is enabled
242    optional bool is_timeout_enabled = 7;
243    // Duration of the session in seconds
244    optional int32 session_duration_seconds = 8;
245    // Authentication type of the Soft AP
246    optional android.net.wifi.WifiAuthType auth_type = 9;
247    // Wi-Fi standard of the Soft AP
248    optional android.net.wifi.WifiStandard standard = 10;
249    // Max num of associated clients for the entire session
250    optional int32 max_clients = 11;
251}
252
253/**
254 * Logged when wifi lock is released
255 */
256message WifiLockReleased {
257    // Attribution tag of the caller
258    optional string attribution_tag = 1;
259    // UID of the caller
260    optional int32 uid = 2;
261    // Permission model of the caller
262    optional android.net.wifi.WifiCallerType caller_type = 3;
263    // Lock mode
264    optional android.net.wifi.WifiModeEnum mode = 4;
265    // For how long the lock is acquired in milliseconds
266    optional int32 acquired_duration = 5;
267    // Whether power save disable is allowed during lock acquire
268    optional bool is_powersave_disable_allowed = 6;
269    // Whether the application which acquired the lock is exempted from screen ON
270    optional bool is_app_exempted_from_screen_on = 7;
271    // Whether the application which acquired the lock is exempted from being foreground
272    optional bool is_app_exempted_from_foreground = 8;
273}
274
275/**
276 * Logged when wifi lock is deactivated
277 */
278message WifiLockDeactivated {
279    // Attribution tag of the caller
280    optional string attribution_tag = 1;
281    // UID of the caller
282    optional int32 uid = 2;
283    // Permission model of the caller
284    optional android.net.wifi.WifiCallerType caller_type = 3;
285    // Lock mode
286    optional android.net.wifi.WifiModeEnum mode = 4;
287    // For how long the lock is activated in milliseconds
288    optional int32 activated_duration = 5;
289    // Whether power save disable is allowed during the lock activation
290    optional bool is_powersave_disable_allowed = 6;
291    // Whether the application which activated the lock is exempted from screen ON
292    optional bool is_exempted_from_screen_on = 7;
293    // Whether the application which activated the lock is exempted from being foreground
294    optional bool is_exempted_from_foreground = 8;
295}
296
297/**
298 * Pull metrics for the Wifi Aware capabilities supported by the device
299 */
300message WifiAwareCapabilities {
301    // If instant mode supported
302    optional bool is_instant_mode_supported = 1;
303    // If pairing supported
304    optional bool is_pairing_supported = 2;
305    // If suspension supported
306    optional bool is_suspension_supported = 3;
307    // Supported cipher suites
308    optional int32 cipher_suites = 4;
309    // Max number of the NDI
310    optional int32 ndi_number = 5;
311    // Max number of the NDP
312    optional int32 ndp_number = 6;
313    // Max number of the discovery session
314    optional int32 discovery_session_number = 7;
315}
316
317// Logged when the Wifi Aware resources is used by Apps
318message WifiAwareResourceUsingChanged {
319    optional int32 ndp_num = 1;
320    optional int32 discovery_session_num = 2;
321}
322
323/**
324 * Logged when Aware HAL API is called and send response
325 */
326message WifiAwareHalApiCalled {
327    // The API name
328    optional android.net.wifi.AwareHalApi command = 1;
329    // Status of the API call
330    optional android.net.wifi.AwareStatus status = 2;
331    // The time for this API call to execute
332    optional int32 running_time_ms = 3;
333}
334
335/**
336 * Logged when local-only request received
337 */
338message WifiLocalOnlyRequestReceived {
339    enum UserAction {
340        USER_UNSPECIFIED = 0;
341        USER_BYPASS = 1;
342        USER_ACCEPT = 2;
343        USER_REJECT = 3;
344    }
345    // The AttributionNode to identify the caller
346    repeated AttributionNode attribution_node = 1;
347    // User action on the local-only request
348    optional UserAction action = 2;
349    // The caller type of the request
350    optional android.net.wifi.WifiCallerType caller_type = 3;
351}
352
353// Logged when matched scan result received for local only request
354message WifiLocalOnlyRequestScanTriggered {
355    // The AttributionNode to identify the caller
356    repeated AttributionNode attribution_node = 1;
357    // How many channel specified in the request
358    optional int32 number_channel_specified = 2;
359    // Scan time to get a match
360    optional int32 match_delay_ms = 3;
361    // The caller type of the request
362    optional android.net.wifi.WifiCallerType caller_type = 4;
363}
364
365// Logged when a task on the Wifi thread is executed
366message WifiThreadTaskExecuted {
367    // How long does it take to execute the task
368    optional int32 running_time_ms = 1;
369    // How long does it take to start execute the task
370    optional int32 blocking_time_ms = 2;
371    // The name of the internal task running on Wifi Thread
372    optional string task_name = 3;
373}
374
375// Logged when Wifi config save to storage triggered
376message WifiConfigSaved {
377    // How long does it cost to save all config
378    optional int32 running_time_ms = 1;
379}
380
381// Logged when Wi-Fi state change happens.
382message WifiStateChanged {
383    // If Wi-Fi was enabled
384    optional bool wifi_enabled = 1;
385    // If Wi-Fi Wake feature was enabled
386    optional bool wifi_wake_enabled = 2;
387    // If the state change was due to Wi-Fi Wake
388    optional bool enabled_by_wifi_wake = 3;
389}