diff options
author | Roshan Pius <rpius@google.com> | 2017-03-20 08:13:39 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-03-21 11:26:08 -0700 |
commit | 56ee240e9e4c6a4967f08faa50cef95bfd5c2949 (patch) | |
tree | cabcd0b80bcf4a978d8b94cca15b4084d1bb97e2 /service | |
parent | 1555c030405df64cb4c52cff44598e678045b82b (diff) |
WifiStateMachine: Remove networks on enter/exit ConnectMode
Bug: 36189070
Test: Unit tests
Test: Turned on/off wifi several times & verified that the networks are
removed.
Change-Id: I0faf4cffacb440746516122845667a7a7a5e6546
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index b49268163..20f7ac5af 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -4682,6 +4682,10 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss @Override public void enter() { + if (!mWifiNative.removeAllNetworks()) { + loge("Failed to remove networks on entering connect mode"); + } + // Let the system know that wifi is available in client mode. setWifiState(WIFI_STATE_ENABLED); @@ -4691,7 +4695,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss // initialize network state setNetworkDetailedState(DetailedState.DISCONNECTED); - // Inform WifiConnectivityManager that Wifi is enabled mWifiConnectivityManager.setWifiEnabled(true); // Inform metrics that Wifi is Enabled (but not yet connected) @@ -4705,10 +4708,15 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss // Let the system know that wifi is not available since we are exiting client mode. mNetworkInfo.setIsAvailable(false); if (mNetworkAgent != null) mNetworkAgent.sendNetworkInfo(mNetworkInfo); + // Inform WifiConnectivityManager that Wifi is disabled mWifiConnectivityManager.setWifiEnabled(false); // Inform metrics that Wifi is being disabled (Toggled, airplane enabled, etc) mWifiMetrics.setWifiState(WifiMetricsProto.WifiLog.WIFI_DISABLED); + + if (!mWifiNative.removeAllNetworks()) { + loge("Failed to remove networks on exiting connect mode"); + } } @Override |