diff options
Diffstat (limited to 'tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java')
-rw-r--r-- | tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java index bed0933d6e3..21e156c8d1a 100644 --- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java +++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java @@ -1171,19 +1171,19 @@ public class WifiManagerTest extends WifiJUnit4TestBase { if (!sWifiManager.isPortableHotspotSupported()) { return; } + boolean wifiEnabled = sWifiManager.isWifiEnabled(); + if (wifiEnabled) { + // Re-enabled Wi-Fi as shell for HalDeviceManager legacy LOHS behavior when there's + // no STA+AP concurrency. + ShellIdentityUtils.invokeWithShellPermissions(() -> + sWifiManager.setWifiEnabled(false)); + PollingCheck.check("Wifi turn off failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, + () -> !sWifiManager.isWifiEnabled()); + SystemUtil.runShellCommand("cmd wifi set-wifi-enabled enabled"); + PollingCheck.check("Wifi turn on failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, + () -> sWifiManager.isWifiEnabled()); + } runWithScanning(() -> { - boolean wifiEnabled = sWifiManager.isWifiEnabled(); - if (wifiEnabled) { - // Re-enabled Wi-Fi as shell for HalDeviceManager legacy LOHS behavior when there's - // no STA+AP concurrency. - ShellIdentityUtils.invokeWithShellPermissions(() -> - sWifiManager.setWifiEnabled(false)); - PollingCheck.check("Wifi turn off failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, - () -> !sWifiManager.isWifiEnabled()); - SystemUtil.runShellCommand("cmd wifi set-wifi-enabled enabled"); - PollingCheck.check("Wifi turn on failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, - () -> sWifiManager.isWifiEnabled()); - } TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot(); // add sleep to avoid calling stopLocalOnlyHotspot before TetherController @@ -1956,21 +1956,21 @@ public class WifiManagerTest extends WifiJUnit4TestBase { // check that softap mode is supported by the device assumeTrue(sWifiManager.isPortableHotspotSupported()); + boolean wifiEnabled = sWifiManager.isWifiEnabled(); + if (wifiEnabled) { + // Re-enabled Wi-Fi as shell for HalDeviceManager legacy LOHS behavior when there's + // no STA+AP concurrency. + ShellIdentityUtils.invokeWithShellPermissions(() -> + sWifiManager.setWifiEnabled(false)); + PollingCheck.check("Wifi turn off failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, + () -> !sWifiManager.isWifiEnabled()); + SystemUtil.runShellCommand("cmd wifi set-wifi-enabled enabled"); + PollingCheck.check("Wifi turn on failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, + () -> sWifiManager.isWifiEnabled()); + } + runWithScanning(() -> { boolean caughtException = false; - boolean wifiEnabled = sWifiManager.isWifiEnabled(); - if (wifiEnabled) { - // Re-enabled Wi-Fi as shell for HalDeviceManager legacy LOHS behavior when there's - // no STA+AP concurrency. - ShellIdentityUtils.invokeWithShellPermissions(() -> - sWifiManager.setWifiEnabled(false)); - PollingCheck.check("Wifi turn off failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, - () -> !sWifiManager.isWifiEnabled()); - SystemUtil.runShellCommand("cmd wifi set-wifi-enabled enabled"); - PollingCheck.check("Wifi turn on failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, - () -> sWifiManager.isWifiEnabled()); - } - TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot(); // now make a second request - this should fail. @@ -3707,15 +3707,15 @@ public class WifiManagerTest extends WifiJUnit4TestBase { // check that softap mode is supported by the device assumeTrue(sWifiManager.isPortableHotspotSupported()); - runWithScanning(() -> { - // Re-enabled Wi-Fi as shell for HalDeviceManager legacy LOHS behavior when there's no - // STA+AP concurrency. - ShellIdentityUtils.invokeWithShellPermissions(() -> sWifiManager.setWifiEnabled(false)); - PollingCheck.check("Wifi turn off failed!", 2_000, () -> !sWifiManager.isWifiEnabled()); - SystemUtil.runShellCommand("cmd wifi set-wifi-enabled enabled"); - PollingCheck.check("Wifi turn on failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, - () -> sWifiManager.isWifiEnabled()); + // Re-enabled Wi-Fi as shell for HalDeviceManager legacy LOHS behavior when there's no + // STA+AP concurrency. + ShellIdentityUtils.invokeWithShellPermissions(() -> sWifiManager.setWifiEnabled(false)); + PollingCheck.check("Wifi turn off failed!", 2_000, () -> !sWifiManager.isWifiEnabled()); + SystemUtil.runShellCommand("cmd wifi set-wifi-enabled enabled"); + PollingCheck.check("Wifi turn on failed!", WIFI_OFF_ON_TIMEOUT_MILLIS, + () -> sWifiManager.isWifiEnabled()); + runWithScanning(() -> { boolean isStaApConcurrencySupported = sWifiManager.isStaApConcurrencySupported(); // start local only hotspot. TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot(); |