From c85e8813b449fc339c9bf775de044ce78190c908 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 30 Jul 2018 13:19:50 -0700 Subject: WifiController: Enable softap toggle in airplane mode Wifi tethering should work even in airplane mode. So, remove the restriction in WifiController which prevents enabling SoftAp in airplane mode. There is no FCC or carrier requirements to disable SoftAp in airplane mode. LTE tethering would obviously disabled because the mobile radio is off in airplane mode. Note: We need some UI changes for this to be available to the users (details mentioned in the associated bug). Bug: 111681176 Test: Unit tests Test: Added a new ACTS test which toggle softap state after turning on airplane mode. Change-Id: Ie67b1de1d31615a75683c1e91290e647eaae809c --- .../com/android/server/wifi/WifiControllerTest.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') 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 @@ -828,6 +828,25 @@ public class WifiControllerTest { verifyNoMoreInteractions(mActiveModeWarden); } + /** + * 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 */ @@ -850,6 +869,7 @@ public class WifiControllerTest { verifyNoMoreInteractions(mActiveModeWarden); } + /** * Toggling off client mode when in ECM does not induce a mode change */ -- cgit v1.2.3