summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorLes Lee <lesl@google.com>2020-08-12 10:10:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-08-12 10:10:35 +0000
commitedbf442c77ef5731138e803b56b2bb9a196f07ae (patch)
tree8e042dc23fb69bee79a7148fb29a1d16e4a79ed0 /service
parentc6cf48cd848c87e9331662f3a24103340f459b94 (diff)
parent636b3519ba904a53f52076ab8eca8d24b9311142 (diff)
Merge "wifi: Move stop softap flow to looper thread" into rvc-qpr-dev
Diffstat (limited to 'service')
-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;