diff options
author | Roshan Pius <rpius@google.com> | 2017-02-17 13:27:55 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-02-21 09:23:36 -0800 |
commit | 5317e7c11c99d5cc8417c65cc73cf548f8f52b87 (patch) | |
tree | 017ab41cc6bfdbf03d584b5422346ed2ade15acd /service/java/com/android/server/wifi/WifiMonitor.java | |
parent | bcf35be52f93d09a3f2ac8d4272a6d66467309b9 (diff) | |
download | android_frameworks_opt_net_wifi-5317e7c11c99d5cc8417c65cc73cf548f8f52b87.tar.gz android_frameworks_opt_net_wifi-5317e7c11c99d5cc8417c65cc73cf548f8f52b87.tar.bz2 android_frameworks_opt_net_wifi-5317e7c11c99d5cc8417c65cc73cf548f8f52b87.zip |
SupplicantStaIface: Handle wpa_supplicant death
Trigger the existing WifiMonitor events to indicate
establishment/loss of contact with wpa_supplicant.
Bug: 33383725
Test: Unit tests
Change-Id: I394a3ed7dad4f201456e2aaa53ba380c7a130f33
Diffstat (limited to 'service/java/com/android/server/wifi/WifiMonitor.java')
-rw-r--r-- | service/java/com/android/server/wifi/WifiMonitor.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiMonitor.java b/service/java/com/android/server/wifi/WifiMonitor.java index b95d48ebb..cf2efd4bb 100644 --- a/service/java/com/android/server/wifi/WifiMonitor.java +++ b/service/java/com/android/server/wifi/WifiMonitor.java @@ -636,12 +636,12 @@ public class WifiMonitor { if (ensureConnectedLocked()) { setMonitoring(iface, true); - sendMessage(iface, SUP_CONNECTION_EVENT); + broadcastSupplicantConnectionEvent(iface); } else { boolean originalMonitoring = isMonitoring(iface); setMonitoring(iface, true); - sendMessage(iface, SUP_DISCONNECTION_EVENT); + broadcastSupplicantDisconnectionEvent(iface); setMonitoring(iface, originalMonitoring); Log.e(TAG, "startMonitoring(" + iface + ") failed!"); } @@ -650,7 +650,7 @@ public class WifiMonitor { public synchronized void stopMonitoring(String iface) { if (mVerboseLoggingEnabled) Log.d(TAG, "stopMonitoring(" + iface + ")"); setMonitoring(iface, true); - sendMessage(iface, SUP_DISCONNECTION_EVENT); + broadcastSupplicantDisconnectionEvent(iface); setMonitoring(iface, false); } @@ -1018,7 +1018,7 @@ public class WifiMonitor { } // Notify and exit - sendMessage(null, SUP_DISCONNECTION_EVENT, eventLogCounter); + broadcastSupplicantDisconnectionEvent(null); return true; } else if (event == EAP_FAILURE) { if (eventData.startsWith(EAP_AUTH_FAILURE_STR)) { @@ -1728,4 +1728,24 @@ public class WifiMonitor { sendMessage(iface, SUPPLICANT_STATE_CHANGE_EVENT, 0, 0, new StateChangeResult(networkId, wifiSsid, bssid, newSupplicantState)); } + + /** + * Broadcast the connection to wpa_supplicant event to all the handlers registered for + * this event. + * + * @param iface Name of iface on which this occurred. + */ + public void broadcastSupplicantConnectionEvent(String iface) { + sendMessage(iface, SUP_CONNECTION_EVENT); + } + + /** + * Broadcast the loss of connection to wpa_supplicant event to all the handlers registered for + * this event. + * + * @param iface Name of iface on which this occurred. + */ + public void broadcastSupplicantDisconnectionEvent(String iface) { + sendMessage(iface, SUP_DISCONNECTION_EVENT); + } } |