ACTS(wifi): Use shell command for setting country code
WifiManager.setCountryCode() is being removed, use the shell command to
set country code instead from ACTS tests.
Bug: 141107015
Test: Verified the changes
Change-Id: I23ebe57fcb8bed71b6b85ec1697e80bf150044f2
diff --git a/acts/tests/google/coex/hotspot_tests/HotspotWiFiChannelTest.py b/acts/tests/google/coex/hotspot_tests/HotspotWiFiChannelTest.py
index b44f784..d5c5594 100644
--- a/acts/tests/google/coex/hotspot_tests/HotspotWiFiChannelTest.py
+++ b/acts/tests/google/coex/hotspot_tests/HotspotWiFiChannelTest.py
@@ -185,8 +185,8 @@
if wifi_band == '2g':
wband = WifiEnums.WIFI_CONFIG_APBAND_2G
elif wifi_band == '5g':
- self.pri_ad.droid.wifiSetCountryCode(WifiEnums.CountryCode.US)
- self.sec_ad.droid.wifiSetCountryCode(WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.pri_ad, WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.sec_ad, WifiEnums.CountryCode.US)
wband = WifiEnums.WIFI_CONFIG_APBAND_5G
elif wifi_band == 'auto':
wband = WifiEnums.WIFI_CONFIG_APBAND_AUTO
diff --git a/acts/tests/google/power/tel/lab/PowerTelHotspotTest.py b/acts/tests/google/power/tel/lab/PowerTelHotspotTest.py
index 59a9dc6..2c8c0c8 100644
--- a/acts/tests/google/power/tel/lab/PowerTelHotspotTest.py
+++ b/acts/tests/google/power/tel/lab/PowerTelHotspotTest.py
@@ -103,7 +103,7 @@
for dut in [hotspot_dut, slave_dut]:
self.log.info("Setting Country Code to %s for SN:%s" %
(country_code, dut.serial))
- dut.droid.wifiSetCountryCode(country_code)
+ wutils.set_wifi_country_code(dut, country_code)
# Setup tethering
wutils.start_wifi_tethering(
diff --git a/acts/tests/google/power/wifi/PowerWiFiHotspotTest.py b/acts/tests/google/power/wifi/PowerWiFiHotspotTest.py
index f554d12..52c6432 100644
--- a/acts/tests/google/power/wifi/PowerWiFiHotspotTest.py
+++ b/acts/tests/google/power/wifi/PowerWiFiHotspotTest.py
@@ -91,8 +91,8 @@
# Both devices need to have a country code in order
# to use the 5 GHz band.
- self.android_devices[0].droid.wifiSetCountryCode('US')
- self.android_devices[1].droid.wifiSetCountryCode('US')
+ wutils.set_wifi_country_code(self.android_devices[0], 'US')
+ wutils.set_wifi_country_code(self.android_devices[1], 'US')
def setup_test(self):
"""Set up test specific parameters or configs.
diff --git a/acts/tests/google/wifi/WifiChaosTest.py b/acts/tests/google/wifi/WifiChaosTest.py
index 0fa77b3..a4932d3 100755
--- a/acts/tests/google/wifi/WifiChaosTest.py
+++ b/acts/tests/google/wifi/WifiChaosTest.py
@@ -116,7 +116,7 @@
self.admin = 'admin' + str(random.randint(1000001, 12345678))
wutils.wifi_test_device_init(self.dut)
# Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
asserts.assert_true(
self.lock_pcap(),
diff --git a/acts/tests/google/wifi/WifiMacRandomizationTest.py b/acts/tests/google/wifi/WifiMacRandomizationTest.py
index 5ad2188..4485220 100644
--- a/acts/tests/google/wifi/WifiMacRandomizationTest.py
+++ b/acts/tests/google/wifi/WifiMacRandomizationTest.py
@@ -435,8 +435,8 @@
7. Verify the factory MAC is not leaked.
"""
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US)
mac_sta = self.connect_to_network_and_verify_mac_randomization(
self.wpapsk_2g)
softap = wutils.start_softap_and_verify(self, WIFI_CONFIG_APBAND_2G)
diff --git a/acts/tests/google/wifi/WifiPingTest.py b/acts/tests/google/wifi/WifiPingTest.py
index 9d5b16b..02ea4ff 100644
--- a/acts/tests/google/wifi/WifiPingTest.py
+++ b/acts/tests/google/wifi/WifiPingTest.py
@@ -386,7 +386,7 @@
self.log.info('Already connected to desired network')
else:
wutils.reset_wifi(self.dut)
- self.dut.droid.wifiSetCountryCode(
+ wutils.set_wifi_country_code(self.dut,
self.testclass_params['country_code'])
self.main_network[band]['channel'] = testcase_params['channel']
wutils.wifi_connect(
diff --git a/acts/tests/google/wifi/WifiRoamingPerformanceTest.py b/acts/tests/google/wifi/WifiRoamingPerformanceTest.py
index 07c10c9..32917f6 100644
--- a/acts/tests/google/wifi/WifiRoamingPerformanceTest.py
+++ b/acts/tests/google/wifi/WifiRoamingPerformanceTest.py
@@ -428,7 +428,7 @@
if not wputils.health_check(self.dut, 10):
asserts.skip('Battery level too low. Skipping test.')
wutils.reset_wifi(self.dut)
- self.dut.droid.wifiSetCountryCode(
+ wutils.set_wifi_country_code(self.dut,
self.testclass_params['country_code'])
(primary_net_id,
primary_net_config) = next(net for net in self.main_network.items()
diff --git a/acts/tests/google/wifi/WifiRssiTest.py b/acts/tests/google/wifi/WifiRssiTest.py
index 32afce6..9a05b9e 100644
--- a/acts/tests/google/wifi/WifiRssiTest.py
+++ b/acts/tests/google/wifi/WifiRssiTest.py
@@ -554,7 +554,7 @@
wutils.reset_wifi(self.dut)
self.main_network[testcase_params['band']][
'channel'] = testcase_params['channel']
- self.dut.droid.wifiSetCountryCode(
+ wutils.set_wifi_country_code(self.dut,
self.testclass_params['country_code'])
wutils.wifi_connect(
self.dut,
diff --git a/acts/tests/google/wifi/WifiRvrTest.py b/acts/tests/google/wifi/WifiRvrTest.py
index f69fbcb..99aa068 100644
--- a/acts/tests/google/wifi/WifiRvrTest.py
+++ b/acts/tests/google/wifi/WifiRvrTest.py
@@ -466,7 +466,7 @@
self.log.info('Already connected to desired network')
else:
wutils.reset_wifi(self.dut)
- self.dut.droid.wifiSetCountryCode(
+ wutils.set_wifi_country_code(self.dut,
self.testclass_params['country_code'])
self.main_network[band]['channel'] = testcase_params['channel']
wutils.wifi_connect(
diff --git a/acts/tests/google/wifi/WifiSensitivityTest.py b/acts/tests/google/wifi/WifiSensitivityTest.py
index d18a72b..d4f5082 100644
--- a/acts/tests/google/wifi/WifiSensitivityTest.py
+++ b/acts/tests/google/wifi/WifiSensitivityTest.py
@@ -371,7 +371,7 @@
self.log.info('Already connected to desired network')
else:
wutils.reset_wifi(self.dut)
- self.dut.droid.wifiSetCountryCode(
+ wutils.set_wifi_country_code(self.dut,
self.testclass_params['country_code'])
self.main_network[band]['channel'] = testcase_params['channel']
wutils.wifi_connect(
diff --git a/acts/tests/google/wifi/WifiSoftApAcsTest.py b/acts/tests/google/wifi/WifiSoftApAcsTest.py
index 7f92e27..3c08310 100644
--- a/acts/tests/google/wifi/WifiSoftApAcsTest.py
+++ b/acts/tests/google/wifi/WifiSoftApAcsTest.py
@@ -55,8 +55,8 @@
utils.sync_device_time(self.dut)
utils.sync_device_time(self.dut_client)
# Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US)
# Enable verbose logging on the duts
self.dut.droid.wifiEnableVerboseLogging(1)
asserts.assert_equal(self.dut.droid.wifiGetVerboseLoggingLevel(), 1,
diff --git a/acts/tests/google/wifi/WifiSoftApPerformanceTest.py b/acts/tests/google/wifi/WifiSoftApPerformanceTest.py
index 9b1f1b3..3625187 100644
--- a/acts/tests/google/wifi/WifiSoftApPerformanceTest.py
+++ b/acts/tests/google/wifi/WifiSoftApPerformanceTest.py
@@ -114,7 +114,7 @@
# Reset WiFi on all devices
for dev in self.android_devices:
wutils.reset_wifi(dev)
- dev.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(dev, wutils.WifiEnums.CountryCode.US)
# Setup Soft AP
sap_config = wutils.create_softap_config()
diff --git a/acts/tests/google/wifi/WifiSoftApTest.py b/acts/tests/google/wifi/WifiSoftApTest.py
index cfc62d9..d581dda 100644
--- a/acts/tests/google/wifi/WifiSoftApTest.py
+++ b/acts/tests/google/wifi/WifiSoftApTest.py
@@ -59,8 +59,8 @@
utils.sync_device_time(self.dut)
utils.sync_device_time(self.dut_client)
# Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US)
# Enable verbose logging on the duts
self.dut.droid.wifiEnableVerboseLogging(1)
asserts.assert_equal(self.dut.droid.wifiGetVerboseLoggingLevel(), 1,
@@ -75,7 +75,7 @@
self.AP_IFACE = 'wlan1'
if len(self.android_devices) > 2:
utils.sync_device_time(self.android_devices[2])
- self.android_devices[2].droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.android_devices[2], wutils.WifiEnums.CountryCode.US)
self.android_devices[2].droid.wifiEnableVerboseLogging(1)
asserts.assert_equal(self.android_devices[2].droid.wifiGetVerboseLoggingLevel(), 1,
"Failed to enable WiFi verbose logging on the client dut.")
@@ -90,8 +90,8 @@
def setup_test(self):
# Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US)
def teardown_test(self):
self.dut.log.debug("Toggling Airplane mode OFF.")
diff --git a/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py b/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py
index fae3103..6dda5dd 100755
--- a/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py
+++ b/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py
@@ -72,8 +72,8 @@
utils.sync_device_time(self.dut)
utils.sync_device_time(self.dut_client)
# Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US)
# Enable verbose logging on the duts
self.dut.droid.wifiEnableVerboseLogging(1)
asserts.assert_equal(self.dut.droid.wifiGetVerboseLoggingLevel(), 1,
@@ -104,7 +104,7 @@
if len(self.android_devices) > 2:
wutils.wifi_test_device_init(self.android_devices[2])
utils.sync_device_time(self.android_devices[2])
- self.android_devices[2].droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.android_devices[2], wutils.WifiEnums.CountryCode.US)
self.android_devices[2].droid.wifiEnableVerboseLogging(1)
asserts.assert_equal(self.android_devices[2].droid.wifiGetVerboseLoggingLevel(), 1,
"Failed to enable WiFi verbose logging on the client dut.")
diff --git a/acts/tests/google/wifi/WifiStaApConcurrencyTest.py b/acts/tests/google/wifi/WifiStaApConcurrencyTest.py
index 92dc7aa..e16e253 100644
--- a/acts/tests/google/wifi/WifiStaApConcurrencyTest.py
+++ b/acts/tests/google/wifi/WifiStaApConcurrencyTest.py
@@ -61,8 +61,8 @@
utils.sync_device_time(self.dut)
utils.sync_device_time(self.dut_client)
# Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US)
# Enable verbose logging on the duts
self.dut.droid.wifiEnableVerboseLogging(1)
asserts.assert_equal(self.dut.droid.wifiGetVerboseLoggingLevel(), 1,
@@ -86,7 +86,7 @@
if len(self.android_devices) > 2:
wutils.wifi_test_device_init(self.android_devices[2])
utils.sync_device_time(self.android_devices[2])
- self.android_devices[2].droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.android_devices[2], wutils.WifiEnums.CountryCode.US)
self.android_devices[2].droid.wifiEnableVerboseLogging(1)
asserts.assert_equal(self.android_devices[2].droid.wifiGetVerboseLoggingLevel(), 1,
"Failed to enable WiFi verbose logging on the client dut.")
diff --git a/acts/tests/google/wifi/WifiStressTest.py b/acts/tests/google/wifi/WifiStressTest.py
index 7ca8034..81cca05 100644
--- a/acts/tests/google/wifi/WifiStressTest.py
+++ b/acts/tests/google/wifi/WifiStressTest.py
@@ -440,17 +440,14 @@
4. Verify softAP is turned down and WiFi is up.
"""
- # Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
ap_ssid = "softap_" + utils.rand_ascii_str(8)
ap_password = utils.rand_ascii_str(8)
self.dut.log.info("softap setup: %s %s", ap_ssid, ap_password)
config = {wutils.WifiEnums.SSID_KEY: ap_ssid}
config[wutils.WifiEnums.PWD_KEY] = ap_password
# Set country code explicitly to "US".
- self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
- self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US)
for count in range(self.stress_count):
initial_wifi_state = self.dut.droid.wifiCheckState()
wutils.start_wifi_tethering(self.dut,
diff --git a/acts/tests/google/wifi/WifiThroughputStabilityTest.py b/acts/tests/google/wifi/WifiThroughputStabilityTest.py
index f14898f..3f2cb85 100644
--- a/acts/tests/google/wifi/WifiThroughputStabilityTest.py
+++ b/acts/tests/google/wifi/WifiThroughputStabilityTest.py
@@ -261,7 +261,7 @@
else:
wutils.wifi_toggle_state(self.dut, True)
wutils.reset_wifi(self.dut)
- self.dut.droid.wifiSetCountryCode(
+ wutils.set_wifi_country_code(self.dut,
self.testclass_params['country_code'])
self.main_network[band]['channel'] = testcase_params['channel']
wutils.wifi_connect(
diff --git a/acts/tests/google/wifi/aware/functional/DataPathTest.py b/acts/tests/google/wifi/aware/functional/DataPathTest.py
index 3016bb9..3f68376 100644
--- a/acts/tests/google/wifi/aware/functional/DataPathTest.py
+++ b/acts/tests/google/wifi/aware/functional/DataPathTest.py
@@ -1740,8 +1740,8 @@
init_dut = self.android_devices[0]
resp_dut = self.android_devices[1]
- init_dut.droid.wifiSetCountryCode(init_domain)
- resp_dut.droid.wifiSetCountryCode(resp_domain)
+ wutils.set_wifi_country_code(init_dut, init_domain)
+ wutils.set_wifi_country_code(resp_dut, resp_domain)
if use_ib:
(resp_req_key, init_req_key, resp_aware_if, init_aware_if,