summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2020-07-06 18:58:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-07-06 18:58:06 +0000
commit4d67769d0680687e696186f0bb456ee08b53a2cd (patch)
tree237244fd61326457c0eda0644925913a513fe16e /service
parentc8d001912a0d37fcea4146c3333ea48b0a0f0b6f (diff)
parent9e80c7bb6a53d2a4ba1df348ea36b43707167840 (diff)
Merge "Fix quickly toggling airplane mode on then off could leave Wifi disabled" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ActiveModeWarden.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/ActiveModeWarden.java b/service/java/com/android/server/wifi/ActiveModeWarden.java
index e0a0a3d29..cf54e328b 100644
--- a/service/java/com/android/server/wifi/ActiveModeWarden.java
+++ b/service/java/com/android/server/wifi/ActiveModeWarden.java
@@ -850,6 +850,9 @@ public class ActiveModeWarden {
}
class EnabledState extends BaseState {
+
+ private boolean mIsDisablingDueToAirplaneMode;
+
@Override
public void enter() {
log("EnabledState.enter()");
@@ -857,6 +860,7 @@ public class ActiveModeWarden {
if (!hasAnyModeManager()) {
Log.e(TAG, "Entered EnabledState, but no active mode managers");
}
+ mIsDisablingDueToAirplaneMode = false;
}
@Override
@@ -894,11 +898,15 @@ public class ActiveModeWarden {
case CMD_AIRPLANE_TOGGLED:
// airplane mode toggled on is handled in the default state
if (mSettingsStore.isAirplaneModeOn()) {
+ mIsDisablingDueToAirplaneMode = true;
return NOT_HANDLED;
} else {
- if (hasAnyModeManagerStopping()) {
- // previous airplane mode toggle on is being processed, defer the
+ if (mIsDisablingDueToAirplaneMode) {
+ // Previous airplane mode toggle on is being processed, defer the
// message toggle off until previous processing is completed.
+ // Once previous airplane mode toggle is complete, we should
+ // transition to DisabledState. There, we will process the deferred
+ // airplane mode toggle message to disable airplane mode.
deferMessage(msg);
} else {
// when airplane mode is toggled off, but wifi is on, we can keep it