diff options
author | Roshan Pius <rpius@google.com> | 2018-08-08 21:27:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-08-08 21:27:30 +0000 |
commit | 9f3a4b778063c49eda3847e6692e9444b0ff865b (patch) | |
tree | d1f5be5e7031db6671d09e53bee3b3e15dbc2c0d | |
parent | 3880da181c0662780c6cd85f7b4bd4f2ba7aa209 (diff) | |
parent | c85e8813b449fc339c9bf775de044ce78190c908 (diff) |
Merge "WifiController: Enable softap toggle in airplane mode"
-rw-r--r-- | service/java/com/android/server/wifi/WifiController.java | 11 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java | 20 |
2 files changed, 20 insertions, 11 deletions
diff --git a/service/java/com/android/server/wifi/WifiController.java b/service/java/com/android/server/wifi/WifiController.java index 671fd63f5..0b0445d92 100644 --- a/service/java/com/android/server/wifi/WifiController.java +++ b/service/java/com/android/server/wifi/WifiController.java @@ -260,12 +260,6 @@ public class WifiController extends StateMachine { break; case CMD_SET_AP: // note: CMD_SET_AP is handled/dropped in ECM mode - will not start here - - // first make sure we aren't in airplane mode - if (mSettingsStore.isAirplaneModeOn()) { - log("drop softap requests when in airplane mode"); - break; - } if (msg.arg1 == 1) { SoftApModeConfiguration config = (SoftApModeConfiguration) msg.obj; mActiveModeWarden.enterSoftAPMode((SoftApModeConfiguration) msg.obj); @@ -352,11 +346,6 @@ public class WifiController extends StateMachine { } break; case CMD_SET_AP: - // first make sure we aren't in airplane mode - if (mSettingsStore.isAirplaneModeOn()) { - log("drop softap requests when in airplane mode"); - break; - } if (msg.arg1 == 1) { // remember that we were disabled, but pass the command up to start softap mSettingsStore.setWifiSavedState(WifiSettingsStore.WIFI_DISABLED); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java index f40875624..f07a256a4 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java @@ -829,6 +829,25 @@ public class WifiControllerTest { } /** + * Toggling softap mode when in airplane mode needs to enable softap + */ + @Test + public void testSoftApModeToggleWhenInAirplaneMode() throws Exception { + // Test with airplane mode turned on: + when(mSettingsStore.isAirplaneModeOn()).thenReturn(true); + + // Turn on SoftAp. + mWifiController.sendMessage(CMD_SET_AP, 1); + mLooper.dispatchAll(); + verify(mActiveModeWarden).enterSoftAPMode(any()); + + // Turn off SoftAp. + mWifiController.sendMessage(CMD_SET_AP, 0); + mLooper.dispatchAll(); + verify(mActiveModeWarden).stopSoftAPMode(); + } + + /** * Toggling off scan mode when in ECM does not induce a mode change */ @Test @@ -850,6 +869,7 @@ public class WifiControllerTest { verifyNoMoreInteractions(mActiveModeWarden); } + /** * Toggling off client mode when in ECM does not induce a mode change */ |