• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 #ifndef WIFI_LEGACY_HAL_H_
18 #define WIFI_LEGACY_HAL_H_
19 
20 #include <hardware_legacy/wifi_hal.h>
21 #include <wifi_system/interface_tool.h>
22 
23 #include <condition_variable>
24 #include <functional>
25 #include <map>
26 #include <mutex>
27 #include <thread>
28 #include <vector>
29 
30 namespace aidl {
31 namespace android {
32 namespace hardware {
33 namespace wifi {
34 // This is in a separate namespace to prevent typename conflicts between
35 // the legacy HAL types and the AIDL interface types.
36 namespace legacy_hal {
37 // Import all the types defined inside the legacy HAL header files into this
38 // namespace.
39 using ::chre_nan_rtt_state;
40 using ::frame_info;
41 using ::frame_type;
42 using ::FRAME_TYPE_80211_MGMT;
43 using ::FRAME_TYPE_ETHERNET_II;
44 using ::FRAME_TYPE_UNKNOWN;
45 using ::fw_roaming_state_t;
46 using ::mac_addr;
47 using ::NAN_BOOTSTRAPPING_INITIATOR_RESPONSE;
48 using ::NAN_BOOTSTRAPPING_RESPONDER_RESPONSE;
49 using ::NAN_CHANNEL_24G_BAND;
50 using ::NAN_CHANNEL_5G_BAND_HIGH;
51 using ::NAN_CHANNEL_5G_BAND_LOW;
52 using ::NAN_DISABLE_RANGE_REPORT;
53 using ::NAN_DO_NOT_USE_SRF;
54 using ::NAN_DP_CHANNEL_NOT_REQUESTED;
55 using ::NAN_DP_CONFIG_NO_SECURITY;
56 using ::NAN_DP_CONFIG_SECURITY;
57 using ::NAN_DP_END;
58 using ::NAN_DP_FORCE_CHANNEL_SETUP;
59 using ::NAN_DP_INITIATOR_RESPONSE;
60 using ::NAN_DP_INTERFACE_CREATE;
61 using ::NAN_DP_INTERFACE_DELETE;
62 using ::NAN_DP_REQUEST_ACCEPT;
63 using ::NAN_DP_REQUEST_CHANNEL_SETUP;
64 using ::NAN_DP_REQUEST_REJECT;
65 using ::NAN_DP_RESPONDER_RESPONSE;
66 using ::NAN_GET_CAPABILITIES;
67 using ::NAN_MATCH_ALG_MATCH_CONTINUOUS;
68 using ::NAN_MATCH_ALG_MATCH_NEVER;
69 using ::NAN_MATCH_ALG_MATCH_ONCE;
70 using ::NAN_PAIRING_END;
71 using ::NAN_PAIRING_INITIATOR_RESPONSE;
72 using ::NAN_PAIRING_RESPONDER_RESPONSE;
73 using ::NAN_PAIRING_SETUP;
74 using ::NAN_PAIRING_VERIFICATION;
75 using ::NAN_PUBLISH_TYPE_SOLICITED;
76 using ::NAN_PUBLISH_TYPE_UNSOLICITED;
77 using ::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED;
78 using ::NAN_RANGING_AUTO_RESPONSE_DISABLE;
79 using ::NAN_RANGING_AUTO_RESPONSE_ENABLE;
80 using ::NAN_RANGING_DISABLE;
81 using ::NAN_RANGING_ENABLE;
82 using ::NAN_RESPONSE_BEACON_SDF_PAYLOAD;
83 using ::NAN_RESPONSE_CONFIG;
84 using ::NAN_RESPONSE_DISABLED;
85 using ::NAN_RESPONSE_ENABLED;
86 using ::NAN_RESPONSE_ERROR;
87 using ::NAN_RESPONSE_PUBLISH;
88 using ::NAN_RESPONSE_PUBLISH_CANCEL;
89 using ::NAN_RESPONSE_STATS;
90 using ::NAN_RESPONSE_SUBSCRIBE;
91 using ::NAN_RESPONSE_SUBSCRIBE_CANCEL;
92 using ::NAN_RESPONSE_TCA;
93 using ::NAN_RESPONSE_TRANSMIT_FOLLOWUP;
94 using ::NAN_RESUME_REQUEST_RESPONSE;
95 using ::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
96 using ::NAN_SECURITY_KEY_INPUT_PMK;
97 using ::NAN_SERVICE_ACCEPT_POLICY_ALL;
98 using ::NAN_SERVICE_ACCEPT_POLICY_NONE;
99 using ::NAN_SRF_ATTR_BLOOM_FILTER;
100 using ::NAN_SRF_ATTR_PARTIAL_MAC_ADDR;
101 using ::NAN_SRF_INCLUDE_DO_NOT_RESPOND;
102 using ::NAN_SRF_INCLUDE_RESPOND;
103 using ::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND;
104 using ::NAN_SSI_REQUIRED_IN_MATCH_IND;
105 using ::NAN_STATUS_ALREADY_ENABLED;
106 using ::NAN_STATUS_FOLLOWUP_QUEUE_FULL;
107 using ::NAN_STATUS_INTERNAL_FAILURE;
108 using ::NAN_STATUS_INVALID_BOOTSTRAPPING_ID;
109 using ::NAN_STATUS_INVALID_NDP_ID;
110 using ::NAN_STATUS_INVALID_PAIRING_ID;
111 using ::NAN_STATUS_INVALID_PARAM;
112 using ::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID;
113 using ::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID;
114 using ::NAN_STATUS_NAN_NOT_ALLOWED;
115 using ::NAN_STATUS_NO_CONNECTION;
116 using ::NAN_STATUS_NO_OTA_ACK;
117 using ::NAN_STATUS_NO_RESOURCE_AVAILABLE;
118 using ::NAN_STATUS_NOT_SUPPORTED;
119 using ::NAN_STATUS_PROTOCOL_FAILURE;
120 using ::NAN_STATUS_REDUNDANT_REQUEST;
121 using ::NAN_STATUS_SUCCESS;
122 using ::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED;
123 using ::NAN_SUBSCRIBE_TYPE_ACTIVE;
124 using ::NAN_SUBSCRIBE_TYPE_PASSIVE;
125 using ::NAN_SUSPEND_REQUEST_RESPONSE;
126 using ::NAN_TRANSMIT_IN_DW;
127 using ::NAN_TRANSMIT_IN_FAW;
128 using ::NAN_TX_PRIORITY_HIGH;
129 using ::NAN_TX_PRIORITY_NORMAL;
130 using ::NAN_TX_TYPE_BROADCAST;
131 using ::NAN_TX_TYPE_UNICAST;
132 using ::NAN_USE_SRF;
133 using ::NanAkm;
134 using ::NanBeaconSdfPayloadInd;
135 using ::NanBootstrappingConfirmInd;
136 using ::NanBootstrappingIndicationResponse;
137 using ::NanBootstrappingRequest;
138 using ::NanBootstrappingRequestInd;
139 using ::NanBootstrappingRequestResponse;
140 using ::NanBootstrappingResponseCode;
141 using ::NanCapabilities;
142 using ::NanChannelInfo;
143 using ::NanConfigRequest;
144 using ::NanDataPathChannelCfg;
145 using ::NanDataPathConfirmInd;
146 using ::NanDataPathEndInd;
147 using ::NanDataPathIndicationResponse;
148 using ::NanDataPathInitiatorRequest;
149 using ::NanDataPathRequestInd;
150 using ::NanDataPathScheduleUpdateInd;
151 using ::NanDisabledInd;
152 using ::NanDiscEngEventInd;
153 using ::NanEnableRequest;
154 using ::NanFollowupInd;
155 using ::NanIdentityResolutionAttribute;
156 using ::NanMatchAlg;
157 using ::NanMatchExpiredInd;
158 using ::NanMatchInd;
159 using ::NanPairingConfig;
160 using ::NanPairingConfirmInd;
161 using ::NanPairingEndRequest;
162 using ::NanPairingIndicationResponse;
163 using ::NanPairingRequest;
164 using ::NanPairingRequestInd;
165 using ::NanPairingRequestResponse;
166 using ::NanPairingRequestType;
167 using ::NanPairingResponseCode;
168 using ::NanPublishCancelRequest;
169 using ::NanPublishRequest;
170 using ::NanPublishTerminatedInd;
171 using ::NanPublishType;
172 using ::NanRangeReportInd;
173 using ::NanRangeRequestInd;
174 using ::NanResponseMsg;
175 using ::NanResumeRequest;
176 using ::NanSRFType;
177 using ::NanStatusType;
178 using ::NanSubscribeCancelRequest;
179 using ::NanSubscribeRequest;
180 using ::NanSubscribeTerminatedInd;
181 using ::NanSubscribeType;
182 using ::NanSuspendRequest;
183 using ::NanSuspensionModeChangeInd;
184 using ::NanTransmitFollowupInd;
185 using ::NanTransmitFollowupRequest;
186 using ::NanTxType;
187 using ::NpkSecurityAssociation;
188 using ::PASN;
189 using ::ROAMING_AGGRESSIVE;
190 using ::ROAMING_DISABLE;
191 using ::ROAMING_ENABLE;
192 using ::RTT_PEER_AP;
193 using ::RTT_PEER_NAN;
194 using ::RTT_PEER_P2P_CLIENT;
195 using ::RTT_PEER_P2P_GO;
196 using ::RTT_PEER_STA;
197 using ::rtt_peer_type;
198 using ::RTT_STATUS_ABORTED;
199 using ::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL;
200 using ::RTT_STATUS_FAIL_BUSY_TRY_LATER;
201 using ::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE;
202 using ::RTT_STATUS_FAIL_INVALID_TS;
203 using ::RTT_STATUS_FAIL_NO_CAPABILITY;
204 using ::RTT_STATUS_FAIL_NO_RSP;
205 using ::RTT_STATUS_FAIL_NOT_SCHEDULED_YET;
206 using ::RTT_STATUS_FAIL_PROTOCOL;
207 using ::RTT_STATUS_FAIL_REJECTED;
208 using ::RTT_STATUS_FAIL_SCHEDULE;
209 using ::RTT_STATUS_FAIL_TM_TIMEOUT;
210 using ::RTT_STATUS_FAILURE;
211 using ::RTT_STATUS_INVALID_REQ;
212 using ::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED;
213 using ::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE;
214 using ::RTT_STATUS_NO_WIFI;
215 using ::RTT_STATUS_SUCCESS;
216 using ::RTT_TYPE_1_SIDED;
217 using ::RTT_TYPE_2_SIDED;
218 using ::RTT_TYPE_2_SIDED_11AZ_NTB;
219 using ::RTT_TYPE_2_SIDED_11MC;
220 using ::RX_PKT_FATE_DRV_DROP_FILTER;
221 using ::RX_PKT_FATE_DRV_DROP_INVALID;
222 using ::RX_PKT_FATE_DRV_DROP_NOBUFS;
223 using ::RX_PKT_FATE_DRV_DROP_OTHER;
224 using ::RX_PKT_FATE_DRV_QUEUED;
225 using ::RX_PKT_FATE_FW_DROP_FILTER;
226 using ::RX_PKT_FATE_FW_DROP_INVALID;
227 using ::RX_PKT_FATE_FW_DROP_NOBUFS;
228 using ::RX_PKT_FATE_FW_DROP_OTHER;
229 using ::RX_PKT_FATE_FW_QUEUED;
230 using ::RX_PKT_FATE_SUCCESS;
231 using ::SAE;
232 using ::ssid_t;
233 using ::transaction_id;
234 using ::TX_PKT_FATE_ACKED;
235 using ::TX_PKT_FATE_DRV_DROP_INVALID;
236 using ::TX_PKT_FATE_DRV_DROP_NOBUFS;
237 using ::TX_PKT_FATE_DRV_DROP_OTHER;
238 using ::TX_PKT_FATE_DRV_QUEUED;
239 using ::TX_PKT_FATE_FW_DROP_INVALID;
240 using ::TX_PKT_FATE_FW_DROP_NOBUFS;
241 using ::TX_PKT_FATE_FW_DROP_OTHER;
242 using ::TX_PKT_FATE_FW_QUEUED;
243 using ::TX_PKT_FATE_SENT;
244 using ::WIFI_AC_BE;
245 using ::WIFI_AC_BK;
246 using ::WIFI_AC_VI;
247 using ::WIFI_AC_VO;
248 using ::WIFI_ANTENNA_1X1;
249 using ::WIFI_ANTENNA_2X2;
250 using ::WIFI_ANTENNA_3X3;
251 using ::WIFI_ANTENNA_4X4;
252 using ::WIFI_ANTENNA_UNSPECIFIED;
253 using ::wifi_band;
254 using ::WIFI_BAND_A;
255 using ::WIFI_BAND_A_DFS;
256 using ::WIFI_BAND_A_WITH_DFS;
257 using ::WIFI_BAND_ABG;
258 using ::WIFI_BAND_ABG_WITH_DFS;
259 using ::WIFI_BAND_BG;
260 using ::WIFI_BAND_UNSPECIFIED;
261 using ::wifi_cached_scan_report;
262 using ::wifi_cached_scan_result;
263 using ::wifi_cached_scan_results;
264 using ::WIFI_CHAN_WIDTH_10;
265 using ::WIFI_CHAN_WIDTH_160;
266 using ::WIFI_CHAN_WIDTH_20;
267 using ::WIFI_CHAN_WIDTH_320;
268 using ::WIFI_CHAN_WIDTH_40;
269 using ::WIFI_CHAN_WIDTH_5;
270 using ::WIFI_CHAN_WIDTH_80;
271 using ::WIFI_CHAN_WIDTH_80P80;
272 using ::WIFI_CHAN_WIDTH_INVALID;
273 using ::wifi_channel_category;
274 using ::wifi_channel_info;
275 using ::wifi_channel_stat;
276 using ::wifi_channel_width;
277 using ::wifi_chip_capabilities;
278 using ::wifi_coex_restriction;
279 using ::wifi_coex_unsafe_channel;
280 using ::WIFI_DFS_CHANNEL;
281 using ::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED;
282 using ::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY;
283 using ::wifi_error;
284 using ::WIFI_ERROR_BUSY;
285 using ::WIFI_ERROR_INVALID_ARGS;
286 using ::WIFI_ERROR_INVALID_REQUEST_ID;
287 using ::WIFI_ERROR_NONE;
288 using ::WIFI_ERROR_NOT_AVAILABLE;
289 using ::WIFI_ERROR_NOT_SUPPORTED;
290 using ::WIFI_ERROR_OUT_OF_MEMORY;
291 using ::WIFI_ERROR_TIMED_OUT;
292 using ::WIFI_ERROR_TOO_MANY_REQUESTS;
293 using ::WIFI_ERROR_UNINITIALIZED;
294 using ::WIFI_ERROR_UNKNOWN;
295 using ::wifi_gscan_capabilities;
296 using ::wifi_hal_fn;
297 using ::wifi_iface_concurrency_matrix;
298 using ::WIFI_INDOOR_CHANNEL;
299 using ::wifi_information_element;
300 using ::WIFI_INTERFACE_IBSS;
301 using ::WIFI_INTERFACE_MESH;
302 using ::wifi_interface_mode;
303 using ::WIFI_INTERFACE_NAN;
304 using ::WIFI_INTERFACE_P2P_CLIENT;
305 using ::WIFI_INTERFACE_P2P_GO;
306 using ::WIFI_INTERFACE_SOFTAP;
307 using ::WIFI_INTERFACE_STA;
308 using ::WIFI_INTERFACE_TDLS;
309 using ::wifi_interface_type;
310 using ::WIFI_INTERFACE_TYPE_AP;
311 using ::WIFI_INTERFACE_TYPE_NAN;
312 using ::WIFI_INTERFACE_TYPE_P2P;
313 using ::WIFI_INTERFACE_TYPE_STA;
314 using ::WIFI_INTERFACE_UNKNOWN;
315 using ::wifi_latency_mode;
316 using ::WIFI_LATENCY_MODE_LOW;
317 using ::WIFI_LATENCY_MODE_NORMAL;
318 using ::wifi_lci_information;
319 using ::wifi_lcr_information;
320 using ::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED;
321 using ::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED;
322 using ::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED;
323 using ::WIFI_LOGGER_PACKET_FATE_SUPPORTED;
324 using ::WIFI_LOGGER_POWER_EVENT_SUPPORTED;
325 using ::WIFI_LOGGER_WAKE_LOCK_SUPPORTED;
326 using ::wifi_mlo_mode;
327 using ::WIFI_MOTION_EXPECTED;
328 using ::WIFI_MOTION_NOT_EXPECTED;
329 using ::wifi_motion_pattern;
330 using ::WIFI_MOTION_UNKNOWN;
331 using ::wifi_multi_sta_use_case;
332 using ::wifi_power_scenario;
333 using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF;
334 using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON;
335 using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF;
336 using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON;
337 using ::WIFI_POWER_SCENARIO_VOICE_CALL;
338 using ::wifi_radio_combination;
339 using ::wifi_radio_combination_matrix;
340 using ::wifi_radio_configuration;
341 using ::wifi_rate;
342 using ::wifi_request_id;
343 using ::wifi_ring_buffer_status;
344 using ::wifi_roaming_capabilities;
345 using ::wifi_roaming_config;
346 using ::wifi_rtt_bw;
347 using ::WIFI_RTT_BW_10;
348 using ::WIFI_RTT_BW_160;
349 using ::WIFI_RTT_BW_20;
350 using ::WIFI_RTT_BW_320;
351 using ::WIFI_RTT_BW_40;
352 using ::WIFI_RTT_BW_5;
353 using ::WIFI_RTT_BW_80;
354 using ::WIFI_RTT_BW_UNSPECIFIED;
355 using ::wifi_rtt_capabilities;
356 using ::wifi_rtt_capabilities_v3;
357 using ::wifi_rtt_config;
358 using ::wifi_rtt_config_v3;
359 using ::wifi_rtt_preamble;
360 using ::WIFI_RTT_PREAMBLE_EHT;
361 using ::WIFI_RTT_PREAMBLE_HE;
362 using ::WIFI_RTT_PREAMBLE_HT;
363 using ::WIFI_RTT_PREAMBLE_INVALID;
364 using ::WIFI_RTT_PREAMBLE_LEGACY;
365 using ::WIFI_RTT_PREAMBLE_VHT;
366 using ::wifi_rtt_responder;
367 using ::wifi_rtt_result;
368 using ::wifi_rtt_result_v2;
369 using ::wifi_rtt_result_v3;
370 using ::wifi_rtt_status;
371 using ::wifi_rtt_type;
372 using ::wifi_rx_packet_fate;
373 using ::wifi_rx_report;
374 using ::wifi_scan_bucket_spec;
375 using ::wifi_scan_cmd_params;
376 using ::WIFI_SCAN_FLAG_INTERRUPTED;
377 using ::wifi_scan_result;
378 using ::WIFI_SUCCESS;
379 using ::wifi_twt_capabilities;
380 using ::wifi_twt_error_code;
381 using ::wifi_twt_events;
382 using ::wifi_twt_request;
383 using ::wifi_twt_session;
384 using ::wifi_twt_session_stats;
385 using ::wifi_twt_teardown_reason_code;
386 using ::wifi_tx_packet_fate;
387 using ::wifi_tx_report;
388 using ::wifi_usable_channel;
389 using ::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE;
390 using ::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY;
391 using ::WLAN_MAC_2_4_BAND;
392 using ::WLAN_MAC_5_0_BAND;
393 using ::WLAN_MAC_60_0_BAND;
394 using ::WLAN_MAC_6_0_BAND;
395 
396 // APF capabilities supported by the iface.
397 struct PacketFilterCapabilities {
398     uint32_t version;
399     uint32_t max_len;
400 };
401 
402 // WARNING: We don't care about the variable sized members of either
403 // |wifi_iface_stat|, |wifi_radio_stat| structures. So, using the pragma
404 // to escape the compiler warnings regarding this.
405 #pragma GCC diagnostic push
406 #pragma GCC diagnostic ignored "-Wgnu-variable-sized-type-not-at-end"
407 // The |wifi_radio_stat.tx_time_per_levels| stats is provided as a pointer in
408 // |wifi_radio_stat| structure in the legacy HAL API. Separate that out
409 // into a separate return element to avoid passing pointers around.
410 struct LinkLayerRadioStats {
411     wifi_radio_stat stats;
412     std::vector<uint32_t> tx_time_per_levels;
413     std::vector<wifi_channel_stat> channel_stats;
414 };
415 
416 struct WifiPeerInfo {
417     wifi_peer_info peer_info;
418     std::vector<wifi_rate_stat> rate_stats;
419 };
420 
421 struct LinkLayerStats {
422     wifi_iface_stat iface;
423     std::vector<LinkLayerRadioStats> radios;
424     std::vector<WifiPeerInfo> peers;
425     bool valid;
426 };
427 
428 struct LinkStats {
429     wifi_link_stat stat;
430     std::vector<WifiPeerInfo> peers;
431 };
432 
433 struct LinkLayerMlStats {
434     wifi_iface_ml_stat iface;
435     std::vector<LinkStats> links;
436     std::vector<LinkLayerRadioStats> radios;
437     bool valid;
438 };
439 
440 struct WifiCachedScanReport {
441     uint64_t ts;
442     std::vector<int> scanned_freqs;
443     std::vector<wifi_cached_scan_result> results;
444 };
445 
446 #pragma GCC diagnostic pop
447 
448 // The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and
449 // |WLAN_DRIVER_WAKE_REASON_CNT.driver_fw_local_wake_cnt| stats is provided
450 // as a pointer in |WLAN_DRIVER_WAKE_REASON_CNT| structure in the legacy HAL
451 // API. Separate that out into a separate return elements to avoid passing
452 // pointers around.
453 struct WakeReasonStats {
454     WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt;
455     std::vector<uint32_t> cmd_event_wake_cnt;
456     std::vector<uint32_t> driver_fw_local_wake_cnt;
457 };
458 
459 // NAN response and event callbacks struct.
460 struct NanCallbackHandlers {
461     // NotifyResponse invoked to notify the status of the Request.
462     std::function<void(transaction_id, const NanResponseMsg&)> on_notify_response;
463     // Various event callbacks.
464     std::function<void(const NanPublishTerminatedInd&)> on_event_publish_terminated;
465     std::function<void(const NanMatchInd&)> on_event_match;
466     std::function<void(const NanMatchExpiredInd&)> on_event_match_expired;
467     std::function<void(const NanSubscribeTerminatedInd&)> on_event_subscribe_terminated;
468     std::function<void(const NanFollowupInd&)> on_event_followup;
469     std::function<void(const NanDiscEngEventInd&)> on_event_disc_eng_event;
470     std::function<void(const NanDisabledInd&)> on_event_disabled;
471     std::function<void(const NanTCAInd&)> on_event_tca;
472     std::function<void(const NanBeaconSdfPayloadInd&)> on_event_beacon_sdf_payload;
473     std::function<void(const NanDataPathRequestInd&)> on_event_data_path_request;
474     std::function<void(const NanDataPathConfirmInd&)> on_event_data_path_confirm;
475     std::function<void(const NanDataPathEndInd&)> on_event_data_path_end;
476     std::function<void(const NanTransmitFollowupInd&)> on_event_transmit_follow_up;
477     std::function<void(const NanRangeRequestInd&)> on_event_range_request;
478     std::function<void(const NanRangeReportInd&)> on_event_range_report;
479     std::function<void(const NanDataPathScheduleUpdateInd&)> on_event_schedule_update;
480     std::function<void(const NanPairingRequestInd&)> on_event_pairing_request;
481     std::function<void(const NanPairingConfirmInd&)> on_event_pairing_confirm;
482     std::function<void(const NanBootstrappingRequestInd&)> on_event_bootstrapping_request;
483     std::function<void(const NanBootstrappingConfirmInd&)> on_event_bootstrapping_confirm;
484     std::function<void(const NanSuspensionModeChangeInd&)> on_event_suspension_mode_change;
485 };
486 
487 // Full scan results contain IE info and are hence passed by reference, to
488 // preserve the variable length array member |ie_data|. Callee must not retain
489 // the pointer.
490 using on_gscan_full_result_callback =
491         std::function<void(wifi_request_id, const wifi_scan_result*, uint32_t)>;
492 // These scan results don't contain any IE info, so no need to pass by
493 // reference.
494 using on_gscan_results_callback =
495         std::function<void(wifi_request_id, const std::vector<wifi_cached_scan_results>&)>;
496 
497 // Invoked when the rssi value breaches the thresholds set.
498 using on_rssi_threshold_breached_callback =
499         std::function<void(wifi_request_id, std::array<uint8_t, ETH_ALEN>, int8_t)>;
500 
501 // Callback for RTT range request results.
502 // Rtt results contain IE info and are hence passed by reference, to
503 // preserve the |LCI| and |LCR| pointers. Callee must not retain
504 // the pointer.
505 using on_rtt_results_callback =
506         std::function<void(wifi_request_id, const std::vector<const wifi_rtt_result*>&)>;
507 using on_rtt_results_callback_v2 =
508         std::function<void(wifi_request_id, const std::vector<const wifi_rtt_result_v2*>&)>;
509 using on_rtt_results_callback_v3 =
510         std::function<void(wifi_request_id, const std::vector<const wifi_rtt_result_v3*>&)>;
511 
512 // Callback for ring buffer data.
513 using on_ring_buffer_data_callback = std::function<void(
514         const std::string&, const std::vector<uint8_t>&, const wifi_ring_buffer_status&)>;
515 
516 // Callback for alerts.
517 using on_error_alert_callback = std::function<void(int32_t, const std::vector<uint8_t>&)>;
518 
519 // Callback for subsystem restart
520 using on_subsystem_restart_callback = std::function<void(const std::string&)>;
521 
522 // Struct for the mac info from the legacy HAL. This is a cleaner version
523 // of the |wifi_mac_info| & |wifi_iface_info|.
524 typedef struct {
525     std::string name;
526     wifi_channel channel;
527 } WifiIfaceInfo;
528 
529 typedef struct {
530     uint32_t wlan_mac_id;
531     /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */
532     uint32_t mac_band;
533     /* Represents the connected Wi-Fi interfaces associated with each MAC */
534     std::vector<WifiIfaceInfo> iface_infos;
535 } WifiMacInfo;
536 
537 // Callback for radio mode change
538 using on_radio_mode_change_callback = std::function<void(const std::vector<WifiMacInfo>&)>;
539 
540 // TWT response and event callbacks struct.
541 struct TwtCallbackHandlers {
542     // Callback for TWT setup response
543     std::function<void(const TwtSetupResponse&)> on_setup_response;
544     // Callback for TWT teardown completion
545     std::function<void(const TwtTeardownCompletion&)> on_teardown_completion;
546     // Callback for TWT info frame received event
547     std::function<void(const TwtInfoFrameReceived&)> on_info_frame_received;
548     // Callback for TWT notification from the device
549     std::function<void(const TwtDeviceNotify&)> on_device_notify;
550 };
551 
552 // CHRE response and event callbacks struct.
553 struct ChreCallbackHandlers {
554     // Callback for CHRE NAN RTT
555     std::function<void(chre_nan_rtt_state)> on_wifi_chre_nan_rtt_state;
556 };
557 
558 using on_cached_scan_results_callback = std::function<void(wifi_cached_scan_report*)>;
559 
560 struct CachedScanResultsCallbfackHandlers {
561     // Callback for Cached Scan Results
562     std::function<void(wifi_cached_scan_report*)> on_cached_scan_results;
563 };
564 
565 using on_twt_failure = std::function<void(wifi_request_id id, wifi_twt_error_code error_code)>;
566 using on_twt_session_create = std::function<void(wifi_request_id id, wifi_twt_session twt_session)>;
567 using on_twt_session_update = std::function<void(wifi_request_id id, wifi_twt_session twt_session)>;
568 using on_twt_session_teardown = std::function<void(wifi_request_id id, int session_id,
569                                                    wifi_twt_teardown_reason_code reason_code)>;
570 using on_twt_session_stats =
571         std::function<void(wifi_request_id id, int session_id, wifi_twt_session_stats stats)>;
572 using on_twt_session_suspend = std::function<void(wifi_request_id id, int session_id)>;
573 using on_twt_session_resume = std::function<void(wifi_request_id id, int session_id)>;
574 
575 /**
576  * Class that encapsulates all legacy HAL interactions.
577  * This class manages the lifetime of the event loop thread used by legacy HAL.
578  *
579  * Note: There will only be a single instance of this class created in the Wifi
580  * object and will be valid for the lifetime of the process.
581  */
582 class WifiLegacyHal {
583   public:
584     WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool,
585                   const wifi_hal_fn& fn, bool is_primary);
586     virtual ~WifiLegacyHal() = default;
587 
588     // Initialize the legacy HAL function table.
589     virtual wifi_error initialize();
590     // Start the legacy HAL and the event looper thread.
591     virtual wifi_error start();
592     // Deinitialize the legacy HAL and wait for the event loop thread to exit
593     // using a predefined timeout.
594     virtual wifi_error stop(std::unique_lock<std::recursive_mutex>* lock,
595                             const std::function<void()>& on_complete_callback);
596     virtual wifi_error waitForDriverReady();
597     // Checks if legacy HAL has successfully started
598     bool isStarted();
599     // Wrappers for all the functions in the legacy HAL function table.
600     virtual std::pair<wifi_error, std::string> getDriverVersion(const std::string& iface_name);
601     virtual std::pair<wifi_error, std::string> getFirmwareVersion(const std::string& iface_name);
602     std::pair<wifi_error, std::vector<uint8_t>> requestDriverMemoryDump(
603             const std::string& iface_name);
604     std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump(
605             const std::string& iface_name);
606     virtual std::pair<wifi_error, uint64_t> getSupportedFeatureSet(const std::string& iface_name);
607     // APF functions.
608     std::pair<wifi_error, PacketFilterCapabilities> getPacketFilterCapabilities(
609             const std::string& iface_name);
610     wifi_error setPacketFilter(const std::string& iface_name, const std::vector<uint8_t>& program);
611     std::pair<wifi_error, std::vector<uint8_t>> readApfPacketFilterData(
612             const std::string& iface_name);
613     // Gscan functions.
614     std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities(
615             const std::string& iface_name);
616     // These API's provides a simplified interface over the legacy Gscan API's:
617     // a) All scan events from the legacy HAL API other than the
618     //    |WIFI_SCAN_FAILED| are treated as notification of results.
619     //    This method then retrieves the cached scan results from the legacy
620     //    HAL API and triggers the externally provided
621     //    |on_results_user_callback| on success.
622     // b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan
623     // results
624     //    Triggers the externally provided |on_failure_user_callback|.
625     // c) Full scan result event triggers the externally provided
626     //    |on_full_result_user_callback|.
627     wifi_error startGscan(const std::string& iface_name, wifi_request_id id,
628                           const wifi_scan_cmd_params& params,
629                           const std::function<void(wifi_request_id)>& on_failure_callback,
630                           const on_gscan_results_callback& on_results_callback,
631                           const on_gscan_full_result_callback& on_full_result_callback);
632     wifi_error stopGscan(const std::string& iface_name, wifi_request_id id);
633     std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForBand(
634             const std::string& iface_name, wifi_band band);
635     virtual wifi_error setDfsFlag(const std::string& iface_name, bool dfs_on);
636     // Link layer stats functions.
637     wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug);
638     wifi_error disableLinkLayerStats(const std::string& iface_name);
639     wifi_error getLinkLayerStats(const std::string& iface_name,
640                                  legacy_hal::LinkLayerStats& legacy_stats,
641                                  legacy_hal::LinkLayerMlStats& legacy_ml_stats);
642     // RSSI monitor functions.
643     wifi_error startRssiMonitoring(
644             const std::string& iface_name, wifi_request_id id, int8_t max_rssi, int8_t min_rssi,
645             const on_rssi_threshold_breached_callback& on_threshold_breached_callback);
646     wifi_error stopRssiMonitoring(const std::string& iface_name, wifi_request_id id);
647     std::pair<wifi_error, wifi_roaming_capabilities> getRoamingCapabilities(
648             const std::string& iface_name);
649     wifi_error configureRoaming(const std::string& iface_name, const wifi_roaming_config& config);
650     wifi_error enableFirmwareRoaming(const std::string& iface_name, fw_roaming_state_t state);
651     wifi_error configureNdOffload(const std::string& iface_name, bool enable);
652     wifi_error startSendingOffloadedPacket(const std::string& iface_name, int32_t cmd_id,
653                                            uint16_t ether_type,
654                                            const std::vector<uint8_t>& ip_packet_data,
655                                            const std::array<uint8_t, 6>& src_address,
656                                            const std::array<uint8_t, 6>& dst_address,
657                                            int32_t period_in_ms);
658     wifi_error stopSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id);
659     virtual wifi_error selectTxPowerScenario(const std::string& iface_name,
660                                              wifi_power_scenario scenario);
661     virtual wifi_error resetTxPowerScenario(const std::string& iface_name);
662     wifi_error setLatencyMode(const std::string& iface_name, wifi_latency_mode mode);
663     wifi_error setThermalMitigationMode(wifi_thermal_mode mode, uint32_t completion_window);
664     wifi_error setDscpToAccessCategoryMapping(uint32_t start, uint32_t end,
665                                               uint32_t access_category);
666     wifi_error resetDscpToAccessCategoryMapping();
667     // Logger/debug functions.
668     std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet(const std::string& iface_name);
669     wifi_error startPktFateMonitoring(const std::string& iface_name);
670     std::pair<wifi_error, std::vector<wifi_tx_report>> getTxPktFates(const std::string& iface_name);
671     std::pair<wifi_error, std::vector<wifi_rx_report>> getRxPktFates(const std::string& iface_name);
672     std::pair<wifi_error, WakeReasonStats> getWakeReasonStats(const std::string& iface_name);
673     wifi_error registerRingBufferCallbackHandler(
674             const std::string& iface_name, const on_ring_buffer_data_callback& on_data_callback);
675     wifi_error deregisterRingBufferCallbackHandler(const std::string& iface_name);
676     virtual wifi_error registerSubsystemRestartCallbackHandler(
677             const on_subsystem_restart_callback& on_restart_callback);
678     std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> getRingBuffersStatus(
679             const std::string& iface_name);
680     wifi_error startRingBufferLogging(const std::string& iface_name, const std::string& ring_name,
681                                       uint32_t verbose_level, uint32_t max_interval_sec,
682                                       uint32_t min_data_size);
683     wifi_error getRingBufferData(const std::string& iface_name, const std::string& ring_name);
684     wifi_error registerErrorAlertCallbackHandler(const std::string& iface_name,
685                                                  const on_error_alert_callback& on_alert_callback);
686     wifi_error deregisterErrorAlertCallbackHandler(const std::string& iface_name);
687     // Radio mode functions.
688     virtual wifi_error registerRadioModeChangeCallbackHandler(
689             const std::string& iface_name,
690             const on_radio_mode_change_callback& on_user_change_callback);
691     // RTT functions.
692     wifi_error startRttRangeRequest(const std::string& iface_name, wifi_request_id id,
693                                     const std::vector<wifi_rtt_config>& rtt_configs,
694                                     const on_rtt_results_callback& on_results_callback,
695                                     const on_rtt_results_callback_v2& on_results_callback_v2);
696     wifi_error startRttRangeRequestV3(const std::string& iface_name, wifi_request_id id,
697                                       const std::vector<wifi_rtt_config_v3>& rtt_configs,
698                                       const on_rtt_results_callback_v3& on_results_callback);
699 
700     wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id,
701                                      const std::vector<std::array<uint8_t, ETH_ALEN>>& mac_addrs);
702     std::pair<wifi_error, wifi_rtt_capabilities> getRttCapabilities(const std::string& iface_name);
703     std::pair<wifi_error, wifi_rtt_capabilities_v3> getRttCapabilitiesV3(
704             const std::string& iface_name);
705     std::pair<wifi_error, wifi_rtt_responder> getRttResponderInfo(const std::string& iface_name);
706     wifi_error enableRttResponder(const std::string& iface_name, wifi_request_id id,
707                                   const wifi_channel_info& channel_hint, uint32_t max_duration_secs,
708                                   const wifi_rtt_responder& info);
709     wifi_error disableRttResponder(const std::string& iface_name, wifi_request_id id);
710     wifi_error setRttLci(const std::string& iface_name, wifi_request_id id,
711                          const wifi_lci_information& info);
712     wifi_error setRttLcr(const std::string& iface_name, wifi_request_id id,
713                          const wifi_lcr_information& info);
714     // NAN functions.
715     virtual wifi_error nanRegisterCallbackHandlers(const std::string& iface_name,
716                                                    const NanCallbackHandlers& callbacks);
717     wifi_error nanEnableRequest(const std::string& iface_name, transaction_id id,
718                                 const NanEnableRequest& msg);
719     virtual wifi_error nanDisableRequest(const std::string& iface_name, transaction_id id);
720     wifi_error nanPublishRequest(const std::string& iface_name, transaction_id id,
721                                  const NanPublishRequest& msg);
722     wifi_error nanPublishCancelRequest(const std::string& iface_name, transaction_id id,
723                                        const NanPublishCancelRequest& msg);
724     wifi_error nanSubscribeRequest(const std::string& iface_name, transaction_id id,
725                                    const NanSubscribeRequest& msg);
726     wifi_error nanSubscribeCancelRequest(const std::string& iface_name, transaction_id id,
727                                          const NanSubscribeCancelRequest& msg);
728     wifi_error nanTransmitFollowupRequest(const std::string& iface_name, transaction_id id,
729                                           const NanTransmitFollowupRequest& msg);
730     wifi_error nanStatsRequest(const std::string& iface_name, transaction_id id,
731                                const NanStatsRequest& msg);
732     wifi_error nanConfigRequest(const std::string& iface_name, transaction_id id,
733                                 const NanConfigRequest& msg);
734     wifi_error nanTcaRequest(const std::string& iface_name, transaction_id id,
735                              const NanTCARequest& msg);
736     wifi_error nanBeaconSdfPayloadRequest(const std::string& iface_name, transaction_id id,
737                                           const NanBeaconSdfPayloadRequest& msg);
738     std::pair<wifi_error, NanVersion> nanGetVersion();
739     wifi_error nanGetCapabilities(const std::string& iface_name, transaction_id id);
740     wifi_error nanDataInterfaceCreate(const std::string& iface_name, transaction_id id,
741                                       const std::string& data_iface_name);
742     virtual wifi_error nanDataInterfaceDelete(const std::string& iface_name, transaction_id id,
743                                               const std::string& data_iface_name);
744     wifi_error nanDataRequestInitiator(const std::string& iface_name, transaction_id id,
745                                        const NanDataPathInitiatorRequest& msg);
746     wifi_error nanDataIndicationResponse(const std::string& iface_name, transaction_id id,
747                                          const NanDataPathIndicationResponse& msg);
748     wifi_error nanPairingRequest(const std::string& iface_name, transaction_id id,
749                                  const NanPairingRequest& msg);
750     wifi_error nanPairingIndicationResponse(const std::string& iface_name, transaction_id id,
751                                             const NanPairingIndicationResponse& msg);
752     wifi_error nanBootstrappingRequest(const std::string& iface_name, transaction_id id,
753                                        const NanBootstrappingRequest& msg);
754     wifi_error nanBootstrappingIndicationResponse(const std::string& iface_name, transaction_id id,
755                                                   const NanBootstrappingIndicationResponse& msg);
756     wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId);
757     wifi_error nanPairingEnd(const std::string& iface_name, transaction_id id, uint32_t pairingId);
758     wifi_error nanSuspendRequest(const std::string& iface_name, transaction_id id,
759                                  const NanSuspendRequest& msg);
760     wifi_error nanResumeRequest(const std::string& iface_name, transaction_id id,
761                                 const NanResumeRequest& msg);
762     // AP functions.
763     wifi_error setCountryCode(const std::string& iface_name, const std::array<uint8_t, 2> code);
764 
765     // Interface functions.
766     virtual wifi_error createVirtualInterface(const std::string& ifname,
767                                               wifi_interface_type iftype);
768     virtual wifi_error deleteVirtualInterface(const std::string& ifname);
769     virtual wifi_error getSupportedIfaceName(uint32_t iface_type, std::string& ifname);
770 
771     // STA + STA functions
772     virtual wifi_error multiStaSetPrimaryConnection(const std::string& ifname);
773     virtual wifi_error multiStaSetUseCase(wifi_multi_sta_use_case use_case);
774 
775     // Coex functions.
776     virtual wifi_error setCoexUnsafeChannels(std::vector<wifi_coex_unsafe_channel> unsafe_channels,
777                                              uint32_t restrictions);
778 
779     wifi_error setVoipMode(const std::string& iface_name, wifi_voip_mode mode);
780 
781     // TWT functions
782     std::pair<wifi_twt_capabilities, wifi_error> twtGetCapabilities(const std::string& ifaceName);
783     wifi_error twtRegisterEvents(
784             const std::string& ifaceName, const on_twt_failure& on_twt_failure_user_callback,
785             const on_twt_session_create& on_twt_session_create_user_callback,
786             const on_twt_session_update& on_twt_session_update_user_callback,
787             const on_twt_session_teardown& on_twt_session_teardown_user_callback,
788             const on_twt_session_stats& on_twt_session_stats_user_callback,
789             const on_twt_session_suspend& on_twt_session_suspend_user_callback,
790             const on_twt_session_resume& on_twt_session_resume_user_callback);
791     wifi_error twtSessionSetup(const std::string& ifaceName, uint32_t cmdId,
792                                const wifi_twt_request& request);
793     wifi_error twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId,
794                                 const wifi_twt_request& request);
795     wifi_error twtSessionSuspend(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId);
796     wifi_error twtSessionResume(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId);
797     wifi_error twtSessionTeardown(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId);
798     wifi_error twtSessionGetStats(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId);
799 
800     // Note: Following TWT functions are deprecated
801     // Deprecated by twtRegisterEvegnts
802     wifi_error twtRegisterHandler(const std::string& iface_name,
803                                   const TwtCallbackHandlers& handler);
804     // Deprecated by twtGetCapabilities
805     std::pair<wifi_error, TwtCapabilitySet> twtGetCapability(const std::string& iface_name);
806     // Deprecated by twtSessionSetup
807     wifi_error twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg);
808     // Deprecated by twtSessionTeardown
809     wifi_error twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg);
810     // Deprecated by twtSessionSuspend and twtSessionResume
811     wifi_error twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg);
812     // Deprecated by twtSessionGetStats
813     std::pair<wifi_error, TwtStats> twtGetStats(const std::string& iface_name, uint8_t configId);
814     // Deprecated
815     wifi_error twtClearStats(const std::string& iface_name, uint8_t configId);
816 
817     wifi_error setScanMode(const std::string& iface_name, bool enable);
818 
819     wifi_error setDtimConfig(const std::string& iface_name, uint32_t multiplier);
820 
821     // Retrieve the list of usable channels in the requested bands
822     // for the requested modes
823     std::pair<wifi_error, std::vector<wifi_usable_channel>> getUsableChannels(
824             uint32_t band_mask, uint32_t iface_mode_mask, uint32_t filter_mask);
825 
826     wifi_error triggerSubsystemRestart();
827 
828     wifi_error setIndoorState(bool isIndoor);
829 
830     std::pair<wifi_error, wifi_radio_combination_matrix*> getSupportedRadioCombinationsMatrix();
831 
832     // CHRE NAN RTT function
833     wifi_error chreNanRttRequest(const std::string& iface_name, bool enable);
834 
835     wifi_error chreRegisterHandler(const std::string& iface_name,
836                                    const ChreCallbackHandlers& handler);
837 
838     wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable);
839     wifi_error getWifiCachedScanResults(const std::string& iface_name,
840                                         WifiCachedScanReport& report);
841     std::pair<wifi_error, wifi_chip_capabilities> getWifiChipCapabilities();
842     wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag);
843     wifi_error setMloMode(wifi_mlo_mode mode);
844     std::pair<wifi_error, wifi_iface_concurrency_matrix> getSupportedIfaceConcurrencyMatrix();
845 
846   private:
847     // Retrieve interface handles for all the available interfaces.
848     wifi_error retrieveIfaceHandles();
849     wifi_interface_handle getIfaceHandle(const std::string& iface_name);
850     // Run the legacy HAL event loop thread.
851     void runEventLoop();
852     // Retrieve the cached gscan results to pass the results back to the
853     // external callbacks.
854     std::pair<wifi_error, std::vector<wifi_cached_scan_results>> getGscanCachedResults(
855             const std::string& iface_name);
856     void invalidate();
857     // Handles wifi (error) status of Virtual interface create/delete
858     wifi_error handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname,
859                                                           wifi_error status);
860     wifi_link_stat* copyLinkStat(wifi_link_stat* stat_ptr, std::vector<LinkStats>& stats);
861     wifi_peer_info* copyPeerInfo(wifi_peer_info* peer_ptr, std::vector<WifiPeerInfo>& peers);
862 
863     // Global function table of legacy HAL.
864     wifi_hal_fn global_func_table_;
865     // Opaque handle to be used for all global operations.
866     wifi_handle global_handle_;
867     // Map of interface name to handle that is to be used for all interface
868     // specific operations.
869     std::map<std::string, wifi_interface_handle> iface_name_to_handle_;
870     // Flag to indicate if we have initiated the cleanup of legacy HAL.
871     std::atomic<bool> awaiting_event_loop_termination_;
872     std::condition_variable_any stop_wait_cv_;
873     // Flag to indicate if the legacy HAL has been started.
874     bool is_started_;
875     std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_;
876     // Flag to indicate if this HAL is for the primary chip. This is used
877     // in order to avoid some hard-coded behavior used with older HALs,
878     // such as bring wlan0 interface up/down on start/stop HAL.
879     // it may be removed once vendor HALs are updated.
880     bool is_primary_;
881 };
882 
883 }  // namespace legacy_hal
884 }  // namespace wifi
885 }  // namespace hardware
886 }  // namespace android
887 }  // namespace aidl
888 
889 #endif  // WIFI_LEGACY_HAL_H_
890