diff options
author | Rebecca Silberstein <silberst@google.com> | 2018-05-08 23:05:18 -0700 |
---|---|---|
committer | Rebecca Silberstein <silberst@google.com> | 2018-05-09 11:24:03 -0700 |
commit | 5b63400e5624455eeb9ddb3fe8078e1bc5ebcd13 (patch) | |
tree | d48df02bf2a6074aa62d65e26c0d531eed4c6a88 /service | |
parent | fdd8945c3952dd368918e24c84028f19092fc663 (diff) |
ClientModeManager: immediately clean up state onDestroyed
When onDestroyed is called in Client mode, make sure we immediately
handle the network disconnect. This avoids a race in connectivity
when dynamically switching between operating modes.
Bug: 79400794
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: atest android.net.wifi.cts
Test: manually toggled wifi tethering when wifi on and connected
Test: manually toggled wifi tethering when wifi on and disconnected
Test: manually toggled wifi tethering when wifi off and scan mode on
Test: manually toggled wifi tethering when wifi fully disabled
Change-Id: I848ba9b1f4a16687e48adb76513213a0906144c4
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeManager.java | 7 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeManager.java b/service/java/com/android/server/wifi/ClientModeManager.java index 8aecd1ebd..f55d9d297 100644 --- a/service/java/com/android/server/wifi/ClientModeManager.java +++ b/service/java/com/android/server/wifi/ClientModeManager.java @@ -133,6 +133,13 @@ public class ClientModeManager implements ActiveModeManager { @Override public void onDestroyed(String ifaceName) { if (mClientInterfaceName != null && mClientInterfaceName.equals(ifaceName)) { + Log.d(TAG, "STA iface " + ifaceName + " was destroyed, stopping client mode"); + + // we must immediately clean up state in WSM to unregister all client mode + // related objects + // Note: onDestroyed is only called from the WSM thread + mWifiStateMachine.handleIfaceDestroyed(); + sendMessage(CMD_INTERFACE_DESTROYED); } } diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 4a0a24a21..6754da32a 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -1474,6 +1474,14 @@ public class WifiStateMachine extends StateMachine { } /** + * When the underlying interface is destroyed, we must immediately tell connectivity service to + * mark network agent as disconnected and stop the ip client. + */ + public void handleIfaceDestroyed() { + handleNetworkDisconnect(); + } + + /** * TODO: doc */ public void setOperationalMode(int mode, String ifaceName) { |