summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/SoftApManager.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index 9ef52e796..b321a78a1 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -221,16 +221,7 @@ public class SoftApManager implements ActiveModeManager {
public void stop() {
Log.d(TAG, " currentstate: " + getCurrentStateName());
mTargetRole = ROLE_UNSPECIFIED;
- if (mApInterfaceName != null) {
- if (mIfaceIsUp) {
- updateApState(WifiManager.WIFI_AP_STATE_DISABLING,
- WifiManager.WIFI_AP_STATE_ENABLED, 0);
- } else {
- updateApState(WifiManager.WIFI_AP_STATE_DISABLING,
- WifiManager.WIFI_AP_STATE_ENABLING, 0);
- }
- }
- mStateMachine.quitNow();
+ mStateMachine.sendMessage(SoftApStateMachine.CMD_STOP);
}
@Override
@@ -517,6 +508,7 @@ public class SoftApManager implements ActiveModeManager {
private class SoftApStateMachine extends StateMachine {
// Commands for the state machine.
public static final int CMD_START = 0;
+ public static final int CMD_STOP = 1;
public static final int CMD_FAILURE = 2;
public static final int CMD_INTERFACE_STATUS_CHANGED = 3;
public static final int CMD_ASSOCIATED_STATIONS_CHANGED = 4;
@@ -574,6 +566,9 @@ public class SoftApManager implements ActiveModeManager {
@Override
public boolean processMessage(Message message) {
switch (message.what) {
+ case CMD_STOP:
+ mStateMachine.quitNow();
+ break;
case CMD_START:
mApInterfaceName = mWifiNative.setupInterfaceForSoftApMode(
mWifiNativeInterfaceCallback);
@@ -908,6 +903,16 @@ public class SoftApManager implements ActiveModeManager {
boolean isUp = message.arg1 == 1;
onUpChanged(isUp);
break;
+ case CMD_STOP:
+ if (mIfaceIsUp) {
+ updateApState(WifiManager.WIFI_AP_STATE_DISABLING,
+ WifiManager.WIFI_AP_STATE_ENABLED, 0);
+ } else {
+ updateApState(WifiManager.WIFI_AP_STATE_DISABLING,
+ WifiManager.WIFI_AP_STATE_ENABLING, 0);
+ }
+ transitionTo(mIdleState);
+ break;
case CMD_START:
// Already started, ignore this command.
break;