diff options
-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 */ |