diff options
author | Quang Luong <qal@google.com> | 2024-05-02 06:52:23 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-05-02 06:52:23 +0000 |
commit | 60935694d5ab62bd07d847ea8a75824b3cd87cd7 (patch) | |
tree | 95ccfe678b7936e5c2aab1723cb773174de8e045 | |
parent | 41aec33dffd5adb3bdbced2a0879be42ff149da7 (diff) | |
parent | 021342b4d7789458d0de591cf220e2e0292ee21e (diff) | |
download | cts-60935694d5ab62bd07d847ea8a75824b3cd87cd7.tar.gz |
Merge "[CTS] Restart wifi before disabling always-on scanning" into main
-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(); |