summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ClientModeManager.java7
-rw-r--r--service/java/com/android/server/wifi/SoftApManager.java6
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java8
3 files changed, 18 insertions, 3 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/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index a23d046e3..1716015a2 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -456,10 +456,9 @@ public class SoftApManager implements ActiveModeManager {
@Override
public void exit() {
- if (mApInterfaceName == null) {
- return;
+ if (mApInterfaceName != null) {
+ stopSoftAp();
}
- stopSoftAp();
if (mSettingObserver != null) {
mSettingObserver.unregister();
}
@@ -531,6 +530,7 @@ public class SoftApManager implements ActiveModeManager {
Log.d(TAG, "Interface was cleanly destroyed.");
updateApState(WifiManager.WIFI_AP_STATE_DISABLING,
WifiManager.WIFI_AP_STATE_ENABLED, 0);
+ mApInterfaceName = null;
transitionTo(mIdleState);
break;
case CMD_INTERFACE_DOWN:
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 18241d57a..bca20e43d 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -1440,6 +1440,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) {