1 /* 2 * Copyright (C) 2008 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 package com.android.server.wifi; 18 19 import android.annotation.IntDef; 20 import android.net.wifi.SupplicantState; 21 import android.net.wifi.WifiEnterpriseConfig; 22 import android.net.wifi.WifiManager; 23 import android.net.wifi.WifiSsid; 24 import android.os.Handler; 25 import android.os.Message; 26 import android.util.ArraySet; 27 import android.util.Log; 28 import android.util.SparseArray; 29 30 import com.android.internal.annotations.VisibleForTesting; 31 import com.android.internal.util.Protocol; 32 import com.android.server.wifi.MboOceController.BtmFrameData; 33 import com.android.server.wifi.WifiCarrierInfoManager.SimAuthRequestData; 34 import com.android.server.wifi.hotspot2.AnqpEvent; 35 import com.android.server.wifi.hotspot2.IconEvent; 36 import com.android.server.wifi.hotspot2.WnmData; 37 38 import java.lang.annotation.Retention; 39 import java.lang.annotation.RetentionPolicy; 40 import java.util.HashMap; 41 import java.util.Map; 42 import java.util.Set; 43 44 /** 45 * Listen for events from the wpa_supplicant & wificond and broadcast them on 46 * to the various {@link ClientModeImpl} modules interested in handling these events. 47 */ 48 public class WifiMonitor { 49 private static final String TAG = "WifiMonitor"; 50 51 /* Supplicant events reported to a state machine */ 52 private static final int BASE = Protocol.BASE_WIFI_MONITOR; 53 54 /* Network connection completed */ 55 public static final int NETWORK_CONNECTION_EVENT = BASE + 3; 56 /* Network disconnection completed */ 57 public static final int NETWORK_DISCONNECTION_EVENT = BASE + 4; 58 /* Scan results are available */ 59 public static final int SCAN_RESULTS_EVENT = BASE + 5; 60 /* Supplicate state changed */ 61 public static final int SUPPLICANT_STATE_CHANGE_EVENT = BASE + 6; 62 /* Password failure and EAP authentication failure */ 63 public static final int AUTHENTICATION_FAILURE_EVENT = BASE + 7; 64 /* WPS success detected */ 65 public static final int WPS_SUCCESS_EVENT = BASE + 8; 66 /* WPS failure detected */ 67 public static final int WPS_FAIL_EVENT = BASE + 9; 68 /* WPS overlap detected */ 69 public static final int WPS_OVERLAP_EVENT = BASE + 10; 70 /* WPS timeout detected */ 71 public static final int WPS_TIMEOUT_EVENT = BASE + 11; 72 73 /* Request Identity */ 74 public static final int SUP_REQUEST_IDENTITY = BASE + 15; 75 76 /* Request SIM Auth */ 77 public static final int SUP_REQUEST_SIM_AUTH = BASE + 16; 78 79 public static final int SCAN_FAILED_EVENT = BASE + 17; 80 /* Pno scan results are available */ 81 public static final int PNO_SCAN_RESULTS_EVENT = BASE + 18; 82 83 84 /* Indicates assoc reject event */ 85 public static final int ASSOCIATION_REJECTION_EVENT = BASE + 43; 86 public static final int ANQP_DONE_EVENT = BASE + 44; 87 public static final int ASSOCIATED_BSSID_EVENT = BASE + 45; 88 public static final int TARGET_BSSID_EVENT = BASE + 46; 89 public static final int NETWORK_NOT_FOUND_EVENT = BASE + 47; 90 91 /* Passpoint ANQP events */ 92 public static final int GAS_QUERY_START_EVENT = BASE + 51; 93 public static final int GAS_QUERY_DONE_EVENT = BASE + 52; 94 public static final int RX_HS20_ANQP_ICON_EVENT = BASE + 53; 95 96 /* Passpoint events */ 97 public static final int HS20_REMEDIATION_EVENT = BASE + 61; 98 public static final int HS20_DEAUTH_IMMINENT_EVENT = BASE + 62; 99 public static final int HS20_TERMS_AND_CONDITIONS_ACCEPTANCE_REQUIRED_EVENT = BASE + 63; 100 101 /* MBO/OCE events */ 102 public static final int MBO_OCE_BSS_TM_HANDLING_DONE = BASE + 71; 103 104 /* Transition Disable Indication */ 105 public static final int TRANSITION_DISABLE_INDICATION = BASE + 72; 106 107 108 /* WPS config errrors */ 109 private static final int CONFIG_MULTIPLE_PBC_DETECTED = 12; 110 private static final int CONFIG_AUTH_FAILURE = 18; 111 112 /* WPS error indications */ 113 private static final int REASON_TKIP_ONLY_PROHIBITED = 1; 114 private static final int REASON_WEP_PROHIBITED = 2; 115 116 /* Transition disable indication */ 117 public static final int TDI_USE_WPA3_PERSONAL = 1 << 0; 118 public static final int TDI_USE_SAE_PK = 1 << 1; 119 public static final int TDI_USE_WPA3_ENTERPRISE = 1 << 2; 120 public static final int TDI_USE_ENHANCED_OPEN = 1 << 3; 121 122 @IntDef(flag = true, prefix = { "TDI_" }, value = { 123 TDI_USE_WPA3_PERSONAL, 124 TDI_USE_SAE_PK, 125 TDI_USE_WPA3_ENTERPRISE, 126 TDI_USE_ENHANCED_OPEN, 127 }) 128 @Retention(RetentionPolicy.SOURCE) 129 @interface TransitionDisableIndication{} 130 131 /** 132 * Use this key to get the interface name of the message sent by WifiMonitor, 133 * or null if not available. 134 * 135 * <br /> 136 * Sample code: 137 * <code> 138 * message.getData().getString(KEY_IFACE) 139 * </code> 140 */ 141 public static final String KEY_IFACE = "com.android.server.wifi.WifiMonitor.KEY_IFACE"; 142 143 private boolean mVerboseLoggingEnabled = false; 144 enableVerboseLogging(boolean verbose)145 void enableVerboseLogging(boolean verbose) { 146 mVerboseLoggingEnabled = verbose; 147 } 148 149 private final Map<String, SparseArray<Set<Handler>>> mHandlerMap = new HashMap<>(); registerHandler(String iface, int what, Handler handler)150 public synchronized void registerHandler(String iface, int what, Handler handler) { 151 SparseArray<Set<Handler>> ifaceHandlers = mHandlerMap.get(iface); 152 if (ifaceHandlers == null) { 153 ifaceHandlers = new SparseArray<>(); 154 mHandlerMap.put(iface, ifaceHandlers); 155 } 156 Set<Handler> ifaceWhatHandlers = ifaceHandlers.get(what); 157 if (ifaceWhatHandlers == null) { 158 ifaceWhatHandlers = new ArraySet<>(); 159 ifaceHandlers.put(what, ifaceWhatHandlers); 160 } 161 ifaceWhatHandlers.add(handler); 162 } 163 164 /** 165 * Deregister the given |handler| 166 * @param iface 167 * @param what 168 * @param handler 169 */ deregisterHandler(String iface, int what, Handler handler)170 public synchronized void deregisterHandler(String iface, int what, Handler handler) { 171 SparseArray<Set<Handler>> ifaceHandlers = mHandlerMap.get(iface); 172 if (ifaceHandlers == null) { 173 return; 174 } 175 Set<Handler> ifaceWhatHandlers = ifaceHandlers.get(what); 176 if (ifaceWhatHandlers == null) { 177 return; 178 } 179 ifaceWhatHandlers.remove(handler); 180 } 181 182 private final Map<String, Boolean> mMonitoringMap = new HashMap<>(); isMonitoring(String iface)183 private boolean isMonitoring(String iface) { 184 Boolean val = mMonitoringMap.get(iface); 185 if (val == null) { 186 return false; 187 } else { 188 return val.booleanValue(); 189 } 190 } 191 192 /** 193 * Enable/Disable monitoring for the provided iface. 194 * 195 * @param iface Name of the iface. 196 * @param enabled true to enable, false to disable. 197 */ 198 @VisibleForTesting setMonitoring(String iface, boolean enabled)199 public void setMonitoring(String iface, boolean enabled) { 200 mMonitoringMap.put(iface, enabled); 201 } 202 203 /** 204 * Start Monitoring for wpa_supplicant events. 205 * 206 * @param iface Name of iface. 207 */ startMonitoring(String iface)208 public synchronized void startMonitoring(String iface) { 209 if (mVerboseLoggingEnabled) Log.d(TAG, "startMonitoring(" + iface + ")"); 210 setMonitoring(iface, true); 211 } 212 213 /** 214 * Stop Monitoring for wpa_supplicant events. 215 * 216 * @param iface Name of iface. 217 */ stopMonitoring(String iface)218 public synchronized void stopMonitoring(String iface) { 219 if (mVerboseLoggingEnabled) Log.d(TAG, "stopMonitoring(" + iface + ")"); 220 setMonitoring(iface, true); 221 setMonitoring(iface, false); 222 } 223 224 225 /** 226 * Similar functions to Handler#sendMessage that send the message to the registered handler 227 * for the given interface and message what. 228 * All of these should be called with the WifiMonitor class lock 229 */ sendMessage(String iface, int what)230 private void sendMessage(String iface, int what) { 231 sendMessage(iface, Message.obtain(null, what)); 232 } 233 sendMessage(String iface, int what, Object obj)234 private void sendMessage(String iface, int what, Object obj) { 235 sendMessage(iface, Message.obtain(null, what, obj)); 236 } 237 sendMessage(String iface, int what, int arg1)238 private void sendMessage(String iface, int what, int arg1) { 239 sendMessage(iface, Message.obtain(null, what, arg1, 0)); 240 } 241 sendMessage(String iface, int what, int arg1, int arg2)242 private void sendMessage(String iface, int what, int arg1, int arg2) { 243 sendMessage(iface, Message.obtain(null, what, arg1, arg2)); 244 } 245 sendMessage(String iface, int what, int arg1, int arg2, Object obj)246 private void sendMessage(String iface, int what, int arg1, int arg2, Object obj) { 247 sendMessage(iface, Message.obtain(null, what, arg1, arg2, obj)); 248 } 249 sendMessage(String iface, Message message)250 private void sendMessage(String iface, Message message) { 251 SparseArray<Set<Handler>> ifaceHandlers = mHandlerMap.get(iface); 252 if (iface != null && ifaceHandlers != null) { 253 if (isMonitoring(iface)) { 254 Set<Handler> ifaceWhatHandlers = ifaceHandlers.get(message.what); 255 if (ifaceWhatHandlers != null) { 256 for (Handler handler : ifaceWhatHandlers) { 257 if (handler != null) { 258 sendMessage(iface, handler, Message.obtain(message)); 259 } 260 } 261 } 262 } else { 263 if (mVerboseLoggingEnabled) { 264 Log.d(TAG, "Dropping event because (" + iface + ") is stopped"); 265 } 266 } 267 } else { 268 if (mVerboseLoggingEnabled) { 269 Log.d(TAG, "Sending to all monitors because there's no matching iface"); 270 } 271 for (Map.Entry<String, SparseArray<Set<Handler>>> entry : mHandlerMap.entrySet()) { 272 iface = entry.getKey(); 273 if (isMonitoring(iface)) { 274 Set<Handler> ifaceWhatHandlers = entry.getValue().get(message.what); 275 if (ifaceWhatHandlers == null) continue; 276 for (Handler handler : ifaceWhatHandlers) { 277 if (handler != null) { 278 sendMessage(iface, handler, Message.obtain(message)); 279 } 280 } 281 } 282 } 283 } 284 285 message.recycle(); 286 } 287 sendMessage(String iface, Handler handler, Message message)288 private void sendMessage(String iface, Handler handler, Message message) { 289 message.setTarget(handler); 290 // getData() will return the existing Bundle if it exists, or create a new one 291 // This prevents clearing the existing data. 292 message.getData().putString(KEY_IFACE, iface); 293 message.sendToTarget(); 294 } 295 296 /** 297 * Broadcast the WPS fail event to all the handlers registered for this event. 298 * 299 * @param iface Name of iface on which this occurred. 300 * @param cfgError Configuration error code. 301 * @param vendorErrorCode Vendor specific error indication code. 302 */ broadcastWpsFailEvent(String iface, int cfgError, int vendorErrorCode)303 public void broadcastWpsFailEvent(String iface, int cfgError, int vendorErrorCode) { 304 int reason = 0; 305 switch(vendorErrorCode) { 306 case REASON_TKIP_ONLY_PROHIBITED: 307 sendMessage(iface, WPS_FAIL_EVENT, WifiManager.WPS_TKIP_ONLY_PROHIBITED); 308 return; 309 case REASON_WEP_PROHIBITED: 310 sendMessage(iface, WPS_FAIL_EVENT, WifiManager.WPS_WEP_PROHIBITED); 311 return; 312 default: 313 reason = vendorErrorCode; 314 break; 315 } 316 switch(cfgError) { 317 case CONFIG_AUTH_FAILURE: 318 sendMessage(iface, WPS_FAIL_EVENT, WifiManager.WPS_AUTH_FAILURE); 319 return; 320 case CONFIG_MULTIPLE_PBC_DETECTED: 321 sendMessage(iface, WPS_FAIL_EVENT, WifiManager.WPS_OVERLAP_ERROR); 322 return; 323 default: 324 if (reason == 0) { 325 reason = cfgError; 326 } 327 break; 328 } 329 //For all other errors, return a generic internal error 330 sendMessage(iface, WPS_FAIL_EVENT, WifiManager.ERROR, reason); 331 } 332 333 /** 334 * Broadcast the WPS succes event to all the handlers registered for this event. 335 * 336 * @param iface Name of iface on which this occurred. 337 */ broadcastWpsSuccessEvent(String iface)338 public void broadcastWpsSuccessEvent(String iface) { 339 sendMessage(iface, WPS_SUCCESS_EVENT); 340 } 341 342 /** 343 * Broadcast the WPS overlap event to all the handlers registered for this event. 344 * 345 * @param iface Name of iface on which this occurred. 346 */ broadcastWpsOverlapEvent(String iface)347 public void broadcastWpsOverlapEvent(String iface) { 348 sendMessage(iface, WPS_OVERLAP_EVENT); 349 } 350 351 /** 352 * Broadcast the WPS timeout event to all the handlers registered for this event. 353 * 354 * @param iface Name of iface on which this occurred. 355 */ broadcastWpsTimeoutEvent(String iface)356 public void broadcastWpsTimeoutEvent(String iface) { 357 sendMessage(iface, WPS_TIMEOUT_EVENT); 358 } 359 360 /** 361 * Broadcast the ANQP done event to all the handlers registered for this event. 362 * 363 * @param iface Name of iface on which this occurred. 364 * @param anqpEvent ANQP result retrieved. 365 */ broadcastAnqpDoneEvent(String iface, AnqpEvent anqpEvent)366 public void broadcastAnqpDoneEvent(String iface, AnqpEvent anqpEvent) { 367 sendMessage(iface, ANQP_DONE_EVENT, anqpEvent); 368 } 369 370 /** 371 * Broadcast the Icon done event to all the handlers registered for this event. 372 * 373 * @param iface Name of iface on which this occurred. 374 * @param iconEvent Instance of IconEvent containing the icon data retrieved. 375 */ broadcastIconDoneEvent(String iface, IconEvent iconEvent)376 public void broadcastIconDoneEvent(String iface, IconEvent iconEvent) { 377 sendMessage(iface, RX_HS20_ANQP_ICON_EVENT, iconEvent); 378 } 379 380 /** 381 * Broadcast the WNM event to all the handlers registered for this event. 382 * 383 * @param iface Name of iface on which this occurred. 384 * @param wnmData Instance of WnmData containing the event data. 385 */ broadcastWnmEvent(String iface, WnmData wnmData)386 public void broadcastWnmEvent(String iface, WnmData wnmData) { 387 if (mVerboseLoggingEnabled) Log.d(TAG, "WNM-Notification " + wnmData.getEventType()); 388 switch (wnmData.getEventType()) { 389 case WnmData.HS20_REMEDIATION_EVENT: 390 sendMessage(iface, HS20_REMEDIATION_EVENT, wnmData); 391 break; 392 393 case WnmData.HS20_DEAUTH_IMMINENT_EVENT: 394 sendMessage(iface, HS20_DEAUTH_IMMINENT_EVENT, wnmData); 395 break; 396 397 case WnmData.HS20_TERMS_AND_CONDITIONS_ACCEPTANCE_REQUIRED_EVENT: 398 sendMessage(iface, HS20_TERMS_AND_CONDITIONS_ACCEPTANCE_REQUIRED_EVENT, wnmData); 399 break; 400 401 default: 402 Log.e(TAG, "Broadcast request for an unknown WNM-notification " 403 + wnmData.getEventType()); 404 break; 405 } 406 } 407 408 /** 409 * Broadcast the Network identity request event to all the handlers registered for this event. 410 * 411 * @param iface Name of iface on which this occurred. 412 * @param networkId ID of the network in wpa_supplicant. 413 * @param ssid SSID of the network. 414 */ broadcastNetworkIdentityRequestEvent(String iface, int networkId, String ssid)415 public void broadcastNetworkIdentityRequestEvent(String iface, int networkId, String ssid) { 416 sendMessage(iface, SUP_REQUEST_IDENTITY, 0, networkId, ssid); 417 } 418 419 /** 420 * Broadcast the transition disable event to all the handlers registered for this event. 421 * 422 * @param iface Name of iface on which this occurred. 423 * @param networkId ID of the network in wpa_supplicant. 424 * @param indicationBits bits of the disable indication. 425 */ broadcastTransitionDisableEvent( String iface, int networkId, @TransitionDisableIndication int indicationBits)426 public void broadcastTransitionDisableEvent( 427 String iface, int networkId, 428 @TransitionDisableIndication int indicationBits) { 429 sendMessage(iface, TRANSITION_DISABLE_INDICATION, networkId, indicationBits); 430 } 431 432 /** 433 * Broadcast the Network Gsm Sim auth request event to all the handlers registered for this 434 * event. 435 * 436 * @param iface Name of iface on which this occurred. 437 * @param networkId ID of the network in wpa_supplicant. 438 * @param ssid SSID of the network. 439 * @param data Accompanying event data. 440 */ broadcastNetworkGsmAuthRequestEvent(String iface, int networkId, String ssid, String[] data)441 public void broadcastNetworkGsmAuthRequestEvent(String iface, int networkId, String ssid, 442 String[] data) { 443 sendMessage(iface, SUP_REQUEST_SIM_AUTH, 444 new SimAuthRequestData(networkId, WifiEnterpriseConfig.Eap.SIM, ssid, data)); 445 } 446 447 /** 448 * Broadcast the Network Umts Sim auth request event to all the handlers registered for this 449 * event. 450 * 451 * @param iface Name of iface on which this occurred. 452 * @param networkId ID of the network in wpa_supplicant. 453 * @param ssid SSID of the network. 454 * @param data Accompanying event data. 455 */ broadcastNetworkUmtsAuthRequestEvent(String iface, int networkId, String ssid, String[] data)456 public void broadcastNetworkUmtsAuthRequestEvent(String iface, int networkId, String ssid, 457 String[] data) { 458 sendMessage(iface, SUP_REQUEST_SIM_AUTH, 459 new SimAuthRequestData(networkId, WifiEnterpriseConfig.Eap.AKA, ssid, data)); 460 } 461 462 /** 463 * Broadcast scan result event to all the handlers registered for this event. 464 * @param iface Name of iface on which this occurred. 465 */ broadcastScanResultEvent(String iface)466 public void broadcastScanResultEvent(String iface) { 467 sendMessage(iface, SCAN_RESULTS_EVENT); 468 } 469 470 /** 471 * Broadcast pno scan result event to all the handlers registered for this event. 472 * @param iface Name of iface on which this occurred. 473 */ broadcastPnoScanResultEvent(String iface)474 public void broadcastPnoScanResultEvent(String iface) { 475 sendMessage(iface, PNO_SCAN_RESULTS_EVENT); 476 } 477 478 /** 479 * Broadcast scan failed event to all the handlers registered for this event. 480 * @param iface Name of iface on which this occurred. 481 */ broadcastScanFailedEvent(String iface)482 public void broadcastScanFailedEvent(String iface) { 483 sendMessage(iface, SCAN_FAILED_EVENT); 484 } 485 486 /** 487 * Broadcast the authentication failure event to all the handlers registered for this event. 488 * 489 * @param iface Name of iface on which this occurred. 490 * @param reason Reason for authentication failure. This has to be one of the 491 * {@link android.net.wifi.WifiManager#ERROR_AUTH_FAILURE_NONE}, 492 * {@link android.net.wifi.WifiManager#ERROR_AUTH_FAILURE_TIMEOUT}, 493 * {@link android.net.wifi.WifiManager#ERROR_AUTH_FAILURE_WRONG_PSWD}, 494 * {@link android.net.wifi.WifiManager#ERROR_AUTH_FAILURE_EAP_FAILURE} 495 * @param errorCode Error code associated with the authentication failure event. 496 * A value of -1 is used when no error code is reported. 497 */ broadcastAuthenticationFailureEvent(String iface, int reason, int errorCode)498 public void broadcastAuthenticationFailureEvent(String iface, int reason, int errorCode) { 499 sendMessage(iface, AUTHENTICATION_FAILURE_EVENT, reason, errorCode); 500 } 501 502 /** 503 * Broadcast the association rejection event to all the handlers registered for this event. 504 * 505 * @param iface Name of iface on which this occurred. 506 * @param assocRejectInfo Instance of AssocRejectEventInfo containing the association 507 * rejection info. 508 */ broadcastAssociationRejectionEvent(String iface, AssocRejectEventInfo assocRejectInfo)509 public void broadcastAssociationRejectionEvent(String iface, 510 AssocRejectEventInfo assocRejectInfo) { 511 sendMessage(iface, ASSOCIATION_REJECTION_EVENT, assocRejectInfo); 512 } 513 514 /** 515 * Broadcast the association success event to all the handlers registered for this event. 516 * 517 * @param iface Name of iface on which this occurred. 518 * @param bssid BSSID of the access point. 519 */ broadcastAssociatedBssidEvent(String iface, String bssid)520 public void broadcastAssociatedBssidEvent(String iface, String bssid) { 521 sendMessage(iface, ASSOCIATED_BSSID_EVENT, 0, 0, bssid); 522 } 523 524 /** 525 * Broadcast the start of association event to all the handlers registered for this event. 526 * 527 * @param iface Name of iface on which this occurred. 528 * @param bssid BSSID of the access point. 529 */ broadcastTargetBssidEvent(String iface, String bssid)530 public void broadcastTargetBssidEvent(String iface, String bssid) { 531 sendMessage(iface, TARGET_BSSID_EVENT, 0, 0, bssid); 532 } 533 534 /** 535 * Broadcast the network connection event to all the handlers registered for this event. 536 * 537 * @param iface Name of iface on which this occurred. 538 * @param networkId ID of the network in wpa_supplicant. 539 * @param filsHlpSent Whether the connection used FILS. 540 * @param bssid BSSID of the access point. 541 */ broadcastNetworkConnectionEvent(String iface, int networkId, boolean filsHlpSent, WifiSsid ssid, String bssid)542 public void broadcastNetworkConnectionEvent(String iface, int networkId, boolean filsHlpSent, 543 WifiSsid ssid, String bssid) { 544 sendMessage(iface, NETWORK_CONNECTION_EVENT, 545 new NetworkConnectionEventInfo(networkId, ssid, bssid, filsHlpSent)); 546 } 547 548 /** 549 * Broadcast the network disconnection event to all the handlers registered for this event. 550 * 551 * @param iface Name of iface on which this occurred. 552 * @param locallyGenerated Whether the disconnect was locally triggered. 553 * @param reason Disconnect reason code. 554 * @param ssid SSID of the access point. 555 * @param bssid BSSID of the access point. 556 */ broadcastNetworkDisconnectionEvent(String iface, boolean locallyGenerated, int reason, String ssid, String bssid)557 public void broadcastNetworkDisconnectionEvent(String iface, boolean locallyGenerated, 558 int reason, String ssid, String bssid) { 559 sendMessage(iface, NETWORK_DISCONNECTION_EVENT, 560 new DisconnectEventInfo(ssid, bssid, reason, locallyGenerated)); 561 } 562 563 /** 564 * Broadcast the supplicant state change event to all the handlers registered for this event. 565 * 566 * @param iface Name of iface on which this occurred. 567 * @param networkId ID of the network in wpa_supplicant. 568 * @param bssid BSSID of the access point. 569 * @param newSupplicantState New supplicant state. 570 */ broadcastSupplicantStateChangeEvent(String iface, int networkId, WifiSsid wifiSsid, String bssid, SupplicantState newSupplicantState)571 public void broadcastSupplicantStateChangeEvent(String iface, int networkId, WifiSsid wifiSsid, 572 String bssid, 573 SupplicantState newSupplicantState) { 574 sendMessage(iface, SUPPLICANT_STATE_CHANGE_EVENT, 0, 0, 575 new StateChangeResult(networkId, wifiSsid, bssid, newSupplicantState)); 576 } 577 578 /** 579 * Broadcast the bss transition management frame handling event 580 * to all the handlers registered for this event. 581 * 582 * @param iface Name of iface on which this occurred. 583 */ broadcastBssTmHandlingDoneEvent(String iface, BtmFrameData btmFrmData)584 public void broadcastBssTmHandlingDoneEvent(String iface, BtmFrameData btmFrmData) { 585 sendMessage(iface, MBO_OCE_BSS_TM_HANDLING_DONE, btmFrmData); 586 } 587 588 /** 589 * Broadcast network not found event 590 * to all the handlers registered for this event. 591 * 592 * @param iface Name of iface on which this occurred. 593 */ broadcastNetworkNotFoundEvent(String iface, String ssid)594 public void broadcastNetworkNotFoundEvent(String iface, String ssid) { 595 sendMessage(iface, NETWORK_NOT_FOUND_EVENT, ssid); 596 } 597 } 598