Fix the typo in cconnectivityQueryDetailsForUid. am: 3f0179f0fc
am: 82de6d4214

Change-Id: Ia6675eb853d86724f70ba266ae99b95a8de99966
diff --git a/Android.mk b/Android.mk
index 4040a1c..11b923b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -23,11 +23,11 @@
 # general Android Conntectivity Test Suite
 ACTS_DISTRO := $(HOST_OUT)/acts-dist/acts.zip
 
-$(ACTS_DISTRO): $(sort $(shell find $(LOCAL_PATH)/acts/framework))
+$(ACTS_DISTRO): $(sort $(shell find $(LOCAL_PATH)/acts))
 	@echo "Packaging ACTS into $(ACTS_DISTRO)"
 	@mkdir -p $(HOST_OUT)/acts-dist/
 	@rm -f $(HOST_OUT)/acts-dist/acts.zip
-	$(hide) zip -r $(HOST_OUT)/acts-dist/acts.zip tools/test/connectivity/acts/*
+	$(hide) zip $(HOST_OUT)/acts-dist/acts.zip $(shell find tools/test/connectivity/acts/* ! -wholename "*__pycache__*")
 acts: $(ACTS_DISTRO)
 
 $(call dist-for-goals,tests,$(ACTS_DISTRO))
diff --git a/acts/framework/acts/test_utils/bt/bt_test_utils.py b/acts/framework/acts/test_utils/bt/bt_test_utils.py
index dede536..f51e476 100644
--- a/acts/framework/acts/test_utils/bt/bt_test_utils.py
+++ b/acts/framework/acts/test_utils/bt/bt_test_utils.py
@@ -1172,6 +1172,11 @@
     if not toggle_airplane_mode_by_adb(log, panu_dut, True):
         panu_dut.log.error("Failed to toggle airplane mode on")
         return False
+    if not toggle_airplane_mode_by_adb(log, panu_dut, False):
+        pan_dut.log.error("Failed to toggle airplane mode off")
+        return False
+    pan_dut.droid.bluetoothStartConnectionStateChangeMonitor("")
+    panu_dut.droid.bluetoothStartConnectionStateChangeMonitor("")
     if not bluetooth_enabled_check(panu_dut):
         return False
     if not bluetooth_enabled_check(pan_dut):
diff --git a/acts/framework/acts/test_utils/wifi/wifi_test_utils.py b/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
index 5e3ec9a..f48ec92 100755
--- a/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
+++ b/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
@@ -929,6 +929,49 @@
         raise signals.TestFailure("Device did not disconnect from the network")
 
 
+def connect_to_wifi_network(ad, network):
+    """Connection logic for open and psk wifi networks.
+
+    Args:
+        params: A tuple of network info and AndroidDevice object.
+    """
+    droid = ad.droid
+    ed = ad.ed
+    SSID = network[WifiEnums.SSID_KEY]
+    ed.clear_all_events()
+    start_wifi_connection_scan(ad)
+    scan_results = droid.wifiGetScanResults()
+    assert_network_in_list({WifiEnums.SSID_KEY: SSID}, scan_results)
+    wifi_connect(ad, network, num_of_tries=3)
+
+
+def connect_to_wifi_network_with_id(ad, network_id, network_ssid):
+    """Connect to the given network using network id and verify SSID.
+
+    Args:
+        network_id: int Network Id of the network.
+        network_ssid: string SSID of the network.
+
+    Returns: True if connect using network id was successful;
+             False otherwise.
+
+    """
+    ad.ed.clear_all_events()
+    start_wifi_connection_scan(ad)
+    scan_results = ad.droid.wifiGetScanResults()
+    assert_network_in_list({
+        WifiEnums.SSID_KEY: network_ssid
+    }, scan_results)
+    wifi_connect_by_id(ad, network_id)
+    connect_data = ad.droid.wifiGetConnectionInfo()
+    connect_ssid = connect_data[WifiEnums.SSID_KEY]
+    ad.log.debug("Expected SSID = %s Connected SSID = %s" %
+                   (network_ssid, connect_ssid))
+    if connect_ssid != network_ssid:
+        return False
+    return True
+
+
 def wifi_connect(ad, network, num_of_tries=1, assert_on_fail=True):
     """Connect an Android device to a wifi network.
 
diff --git a/acts/framework/tests/acts_android_device_test.py b/acts/framework/tests/acts_android_device_test.py
index 64faa0f..b2cb0b5 100755
--- a/acts/framework/tests/acts_android_device_test.py
+++ b/acts/framework/tests/acts_android_device_test.py
@@ -286,6 +286,26 @@
     @mock.patch(
         'acts.controllers.fastboot.FastbootProxy',
         return_value=MockFastbootProxy(MOCK_SERIAL))
+    def test_AndroidDevice_build_info_release(self, MockFastboot,
+                                              MockAdbProxy):
+        """Verifies the AndroidDevice object's basic attributes are correctly
+        set after instantiation.
+        """
+        global MOCK_BUILD_ID
+        ad = android_device.AndroidDevice(serial=1)
+        old_mock_build_id = MOCK_BUILD_ID
+        MOCK_BUILD_ID = "ABC-MR1"
+        build_info = ad.build_info
+        self.assertEqual(build_info["build_id"], "123456789")
+        self.assertEqual(build_info["build_type"], "userdebug")
+        MOCK_BUILD_ID = old_mock_build_id
+
+    @mock.patch(
+        'acts.controllers.adb.AdbProxy',
+        return_value=MockAdbProxy(MOCK_SERIAL))
+    @mock.patch(
+        'acts.controllers.fastboot.FastbootProxy',
+        return_value=MockFastbootProxy(MOCK_SERIAL))
     def test_AndroidDevice_build_info_dev(self, MockFastboot, MockAdbProxy):
         """Verifies the AndroidDevice object's basic attributes are correctly
         set after instantiation.
@@ -315,6 +335,7 @@
     @mock.patch(
         'acts.controllers.fastboot.FastbootProxy',
         return_value=MockFastbootProxy(MOCK_SERIAL))
+
     @mock.patch('acts.utils.create_dir')
     @mock.patch('acts.utils.exe_cmd')
     def test_AndroidDevice_take_bug_report(self, exe_mock, create_dir_mock,
diff --git a/acts/tests/google/wifi/WifiAutoUpdateTest.py b/acts/tests/google/wifi/WifiAutoUpdateTest.py
new file mode 100755
index 0000000..f91c18d
--- /dev/null
+++ b/acts/tests/google/wifi/WifiAutoUpdateTest.py
@@ -0,0 +1,242 @@
+#!/usr/bin/env python3.4
+#
+#   Copyright 2017 - The Android Open Source Project
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+import itertools
+import pprint
+import queue
+import time
+
+import acts.base_test
+import acts.signals
+import acts.test_utils.wifi.wifi_test_utils as wutils
+import acts.utils
+
+from acts import asserts
+from acts.libs.ota import ota_updater
+from acts.test_decorators import test_tracker_info
+from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
+
+WifiEnums = wutils.WifiEnums
+# Default timeout used for reboot, toggle WiFi and Airplane mode,
+# for the system to settle down after the operation.
+DEFAULT_TIMEOUT = 10
+BAND_2GHZ = 0
+BAND_5GHZ = 1
+
+
+class WifiAutoUpdateTest(WifiBaseTest):
+    """Tests for APIs in Android's WifiManager class.
+
+    Test Bed Requirement:
+    * One Android device
+    * Several Wi-Fi networks visible to the device, including an open Wi-Fi
+      network.
+    """
+
+    def __init__(self, controllers):
+        WifiBaseTest.__init__(self, controllers)
+        self.tests = (
+            "test_check_wifi_state_after_au",
+            "test_verify_networks_after_au",
+            "test_all_networks_connectable_after_au",
+            "test_connection_to_new_networks",
+            "test_check_wifi_toggling_after_au",
+            "test_reset_wifi_after_au")
+
+    def setup_class(self):
+        super(WifiAutoUpdateTest, self).setup_class()
+        ota_updater.initialize(self.user_params, self.android_devices)
+        self.dut = self.android_devices[0]
+        wutils.wifi_test_device_init(self.dut)
+        req_params = []
+        opt_param = [
+            "open_network", "reference_networks", "iperf_server_address"
+        ]
+        self.unpack_userparams(
+            req_param_names=req_params, opt_param_names=opt_param)
+
+        if "AccessPoint" in self.user_params:
+            self.legacy_configure_ap_and_start()
+
+        asserts.assert_true(
+            len(self.reference_networks) > 0,
+            "Need at least two reference network with psk.")
+        asserts.assert_true(
+            len(self.open_network) > 0,
+            "Need at least two open network with psk.")
+        wutils.wifi_toggle_state(self.dut, True)
+
+        self.wifi_config_list = []
+
+        # Setup WiFi and add few open and wpa networks before OTA.
+        self.add_network_and_enable(self.open_network[0]['2g'])
+        self.add_network_and_enable(self.reference_networks[0]['5g'])
+
+        # Add few dummy networks to the list.
+        self.add_and_enable_dummy_networks()
+
+        # Run OTA below, if ota fails then abort all tests.
+        try:
+            ota_updater.update(self.dut)
+        except Exception as err:
+            raise signals.TestSkipClass(
+                "Failed up apply OTA update. Aborting tests")
+
+    def setup_test(self):
+        self.dut.droid.wakeLockAcquireBright()
+        self.dut.droid.wakeUpNow()
+
+    def teardown_test(self):
+        self.dut.droid.wakeLockRelease()
+        self.dut.droid.goToSleepNow()
+
+    def on_fail(self, test_name, begin_time):
+        self.dut.take_bug_report(test_name, begin_time)
+        self.dut.cat_adb_log(test_name, begin_time)
+
+    def teardown_class(self):
+        if "AccessPoint" in self.user_params:
+            del self.user_params["reference_networks"]
+            del self.user_params["open_network"]
+
+    """Helper Functions"""
+
+    def add_network_and_enable(self, network):
+        """Add a network and enable it.
+
+        Args:
+            network : Network details for the network to be added.
+
+        """
+        ret = self.dut.droid.wifiAddNetwork(network)
+        asserts.assert_true(ret != -1, "Add network %r failed" % network)
+        self.wifi_config_list.append({
+                WifiEnums.SSID_KEY: network[WifiEnums.SSID_KEY],
+                WifiEnums.NETID_KEY: ret})
+        self.dut.droid.wifiEnableNetwork(ret, 0)
+
+    def add_and_enable_dummy_networks(self, num_networks=5):
+        """Add some dummy networks to the device and enable them.
+
+        Args:
+            num_networks: Number of networks to add.
+        """
+        ssid_name_base = "dummy_network_"
+        for i in range(0, num_networks):
+            network = {}
+            network[WifiEnums.SSID_KEY] = ssid_name_base + str(i)
+            network[WifiEnums.PWD_KEY] = "dummynet_password"
+            self.add_network_and_enable(network)
+
+    def check_networks_after_autoupdate(self, networks):
+        """Verify that all previously configured networks are presistent after
+           reboot.
+
+        Args:
+            networks: List of network dicts.
+
+        Return:
+            None. Raises TestFailure.
+
+        """
+        network_info = self.dut.droid.wifiGetConfiguredNetworks()
+        if len(network_info) != len(networks):
+            msg = (
+                "Number of configured networks before and after Auto-update "
+                "don't match. \nBefore reboot = %s \n After reboot = %s" %
+                (networks, network_info))
+            raise signals.TestFailure(msg)
+        current_count = 0
+        # For each network, check if it exists in configured list after Auto-
+        # update.
+        for network in networks:
+            exists = wutils.match_networks({
+                WifiEnums.SSID_KEY: network[WifiEnums.SSID_KEY]
+            }, network_info)
+            if not len(exists):
+                raise signals.TestFailure("%s network is not present in the"
+                                          " configured list after Auto-update" %
+                                          network[WifiEnums.SSID_KEY])
+            # Get the new network id for each network after reboot.
+            network[WifiEnums.NETID_KEY] = exists[0]['networkId']
+
+    """Tests"""
+
+    @test_tracker_info(uuid="9ff1f01e-e5ff-408b-9a95-29e87a2df2d8")
+    def test_check_wifi_state_after_au(self):
+        """Check if the state of WiFi is enabled after Auto-update."""
+        if not self.dut.droid.wifiCheckState():
+            raise signals.TestFailure("WiFi is disabled after Auto-update!!!")
+
+    @test_tracker_info(uuid="e3ebdbba-71dd-4281-aef8-5b3d42b88770")
+    def test_verify_networks_after_au(self):
+        """Check if the previously added networks are intact.
+
+           Steps:
+               Number of networs should be the same and match each network.
+
+        """
+        self.check_networks_after_autoupdate(self.wifi_config_list)
+
+    @test_tracker_info(uuid="b8e47a4f-62fe-4a0e-b999-27ae1ebf4d19")
+    def test_connection_to_new_networks(self):
+        """Check if we can connect to new networks after Auto-update.
+
+           Steps:
+               1. Connect to a PSK network.
+               2. Connect to an open network.
+               3. Forget ntworks added in 1 & 2.
+               TODO: (@bmahadev) Add WEP network once it's ready.
+
+        """
+        wutils.connect_to_wifi_network((self.open_network[0]['5g'], self.dut))
+        wutils.connect_to_wifi_network((self.reference_networks[0]['2g'],
+                self.dut))
+        wutils.wifi_forget_network(self.dut,
+                self.reference_networks[0]['2g'][WifiEnums.SSID_KEY])
+        wutils.wifi_forget_network(self.dut,
+                self.open_network[0]['5g'][WifiEnums.SSID_KEY])
+
+    @test_tracker_info(uuid="1d8309e4-d5a2-4f48-ba3b-895a58c9bf3a")
+    def test_all_networks_connectable_after_au(self):
+        """Check if previously added networks are connectable.
+
+           Steps:
+               1. Connect to previously added PSK network using network id.
+               2. Connect to previously added open network using network id.
+               TODO: (@bmahadev) Add WEP network once it's ready.
+
+        """
+        for network in self.wifi_config_list:
+            if 'dummy' not in network[WifiEnums.SSID_KEY]:
+                if not wutils.connect_to_wifi_network_with_id(self.dut,
+                        network[WifiEnums.NETID_KEY],
+                        network[WifiEnums.SSID_KEY]):
+                    raise signals.TestFailure("Failed to connect to %s after \
+                            Auto-update" % network[WifiEnums.SSID_KEY])
+
+    @test_tracker_info(uuid="05671859-38b1-4dbf-930c-18048971d075")
+    def test_check_wifi_toggling_after_au(self):
+        """Check if WiFi can be toggled ON/OFF after auto-update."""
+        self.log.debug("Going from on to off.")
+        wutils.wifi_toggle_state(self.dut, False)
+        self.log.debug("Going from off to on.")
+        wutils.wifi_toggle_state(self.dut, True)
+
+    @test_tracker_info(uuid="440edf32-4b00-42b0-9811-9f2bc4a83efb")
+    def test_reset_wifi_after_au(self):
+        """"Check if WiFi can be reset after auto-update."""
+        wutils.reset_wifi(self.dut)
diff --git a/acts/tests/google/wifi/WifiPnoTest.py b/acts/tests/google/wifi/WifiPnoTest.py
index b8f85c0..1282929 100644
--- a/acts/tests/google/wifi/WifiPnoTest.py
+++ b/acts/tests/google/wifi/WifiPnoTest.py
@@ -144,7 +144,7 @@
     """ Tests Begin """
 
     @test_tracker_info(uuid="33d3cae4-5fa7-4e90-b9e2-5d3747bba64c")
-    def test_simple_pno_connection_2g_to_5g(self):
+    def test_simple_pno_connection_to_2g(self):
         """Test PNO triggered autoconnect to a network.
 
         Steps:
@@ -152,16 +152,13 @@
         2. Save 2 valid network configurations (a & b) in the device.
         3. Attenuate 5Ghz network and wait for a few seconds to trigger PNO.
         4. Check the device connected to 2Ghz network automatically.
-        5. Attenuate 2Ghz network and wait for a few seconds to trigger PNO.
-        6. Check the device connected to 5Ghz network automatically.
         """
         self.add_network_and_enable(self.pno_network_a)
         self.add_network_and_enable(self.pno_network_b)
         self.trigger_pno_and_assert_connect("a_on_b_off", self.pno_network_a)
-        self.trigger_pno_and_assert_connect("b_on_a_off", self.pno_network_b)
 
     @test_tracker_info(uuid="39b945a1-830f-4f11-9e6a-9e9641066a96")
-    def test_simple_pno_connection_5g_to_2g(self):
+    def test_simple_pno_connection_to_5g(self):
         """Test PNO triggered autoconnect to a network.
 
         Steps:
@@ -169,15 +166,11 @@
         2. Save 2 valid network configurations (a & b) in the device.
         3. Attenuate 2Ghz network and wait for a few seconds to trigger PNO.
         4. Check the device connected to 5Ghz network automatically.
-        5. Attenuate 5Ghz network and wait for a few seconds to trigger PNO.
-        6. Check the device connected to 2Ghz network automatically.
 
         """
         self.add_network_and_enable(self.pno_network_a)
         self.add_network_and_enable(self.pno_network_b)
         self.trigger_pno_and_assert_connect("b_on_a_off", self.pno_network_b)
-        self.trigger_pno_and_assert_connect("a_on_b_off", self.pno_network_a)
-
 
     @test_tracker_info(uuid="844b15be-ff45-4b09-a11b-0b2b4bb13b22")
     def test_pno_connection_with_multiple_saved_networks(self):
@@ -195,7 +188,8 @@
         self.add_and_enable_dummy_networks(16)
         self.add_network_and_enable(self.pno_network_a)
         self.add_network_and_enable(self.pno_network_b)
+        # Force single scan so that both networks become preferred before PNO.
+        wutils.start_wifi_connection_scan(self.dut)
         self.trigger_pno_and_assert_connect("a_on_b_off", self.pno_network_a)
-        self.trigger_pno_and_assert_connect("b_on_a_off", self.pno_network_b)
 
     """ Tests End """
diff --git a/acts/tests/google/wifi/WifiSoftApTest.py b/acts/tests/google/wifi/WifiSoftApTest.py
index dc39cee..ed8a080 100644
--- a/acts/tests/google/wifi/WifiSoftApTest.py
+++ b/acts/tests/google/wifi/WifiSoftApTest.py
@@ -24,9 +24,10 @@
 from acts.test_decorators import test_tracker_info
 from acts.test_utils.tel import tel_defines
 from acts.test_utils.tel import tel_test_utils as tel_utils
+from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_2G
+from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G
 from acts.test_utils.wifi import wifi_test_utils as wutils
 
-
 class WifiSoftApTest(base_test.BaseTestClass):
 
     def setup_class(self):
@@ -46,6 +47,9 @@
         utils.require_sl4a((self.dut, self.dut_client))
         utils.sync_device_time(self.dut)
         utils.sync_device_time(self.dut_client)
+        # Set country code explicitly to "US".
+        self.dut.adb.shell("halutil -country %s" %
+            wutils.WifiEnums.CountryCode.US)
 
         # Enable verbose logging on the duts
         self.dut.droid.wifiEnableVerboseLogging(1)
@@ -140,6 +144,33 @@
             asserts.assert_true(self.dut.droid.telephonyIsDataEnabled(),
                                 "Failed to enable cell data for softap dut.")
 
+    def validate_full_tether_startup(self, band=None):
+        """Test full startup of wifi tethering
+
+        1. Report current state.
+        2. Switch to AP mode.
+        3. verify SoftAP active.
+        4. Shutdown wifi tethering.
+        5. verify back to previous mode.
+        """
+        initial_wifi_state = self.dut.droid.wifiCheckState()
+        initial_cell_state = tel_utils.is_sim_ready(self.log, self.dut)
+        self.dut.log.info("current state: %s", initial_wifi_state)
+        self.dut.log.info("is sim ready? %s", initial_cell_state)
+        if initial_cell_state:
+            self.check_cell_data_and_enable()
+        config = self.create_softap_config()
+        wutils.start_wifi_tethering(self.dut,
+                                    config[wutils.WifiEnums.SSID_KEY],
+                                    config[wutils.WifiEnums.PWD_KEY], band)
+        self.confirm_softap_in_scan_results(config[wutils.WifiEnums.SSID_KEY])
+        wutils.stop_wifi_tethering(self.dut)
+        asserts.assert_false(self.dut.droid.wifiIsApEnabled(),
+                             "SoftAp is still reported as running")
+        if initial_wifi_state:
+            self.verify_return_to_wifi_enabled()
+        elif self.dut.droid.wifiCheckState():
+            asserts.fail("Wifi was disabled before softap and now it is enabled")
 
     """ Tests Begin """
 
@@ -163,7 +194,7 @@
 
     @test_tracker_info(uuid="09c19c35-c708-48a5-939b-ac2bbb403d54")
     def test_full_tether_startup(self):
-        """Test full startup of wifi tethering
+        """Test full startup of wifi tethering in default band.
 
         1. Report current state.
         2. Switch to AP mode.
@@ -171,24 +202,31 @@
         4. Shutdown wifi tethering.
         5. verify back to previous mode.
         """
-        initial_wifi_state = self.dut.droid.wifiCheckState()
-        initial_cell_state = tel_utils.is_sim_ready(self.log, self.dut)
-        self.dut.log.info("current state: %s", initial_wifi_state)
-        self.dut.log.info("is sim ready? %s", initial_cell_state)
-        if initial_cell_state:
-            self.check_cell_data_and_enable()
-        config = self.create_softap_config()
-        wutils.start_wifi_tethering(self.dut,
-                                    config[wutils.WifiEnums.SSID_KEY],
-                                    config[wutils.WifiEnums.PWD_KEY])
-        self.confirm_softap_in_scan_results(config[wutils.WifiEnums.SSID_KEY])
-        wutils.stop_wifi_tethering(self.dut)
-        asserts.assert_false(self.dut.droid.wifiIsApEnabled(),
-                             "SoftAp is still reported as running")
-        if initial_wifi_state:
-            self.verify_return_to_wifi_enabled()
-        elif self.dut.droid.wifiCheckState():
-            asserts.fail("Wifi was disabled before softap and now it is enabled")
+        self.validate_full_tether_startup()
+
+    @test_tracker_info(uuid="6437727d-7db1-4f69-963e-f26a7797e47f")
+    def test_full_tether_startup_2G(self):
+        """Test full startup of wifi tethering in 2G band.
+
+        1. Report current state.
+        2. Switch to AP mode.
+        3. verify SoftAP active.
+        4. Shutdown wifi tethering.
+        5. verify back to previous mode.
+        """
+        self.validate_full_tether_startup(WIFI_CONFIG_APBAND_2G)
+
+    @test_tracker_info(uuid="970272fa-1302-429b-b261-51efb4dad779")
+    def test_full_tether_startup_5G(self):
+        """Test full startup of wifi tethering in 5G band.
+
+        1. Report current state.
+        2. Switch to AP mode.
+        3. verify SoftAP active.
+        4. Shutdown wifi tethering.
+        5. verify back to previous mode.
+        """
+        self.validate_full_tether_startup(WIFI_CONFIG_APBAND_5G)
 
     """ Tests End """
 
diff --git a/acts/tests/google/wifi/WifiTeleCoexTest.py b/acts/tests/google/wifi/WifiTeleCoexTest.py
index f5d4c7f..3d30640 100644
--- a/acts/tests/google/wifi/WifiTeleCoexTest.py
+++ b/acts/tests/google/wifi/WifiTeleCoexTest.py
@@ -127,9 +127,11 @@
 
         self.log.debug("Toggling wifi ON")
         wifi_utils.wifi_toggle_state(self.dut, True)
+        # Sleep for 1s before getting new WiFi state.
+        time.sleep(1)
         if not self.dut.droid.wifiGetisWifiEnabled():
             raise signals.TestFailure("WiFi did not turn on after turning ON"
-                                      "Airplane mode")
+                                      " Airplane mode")
         asserts.assert_true(
             acts.utils.force_airplane_mode(self.dut, False),
             "Can not turn on airplane mode on: %s" % self.dut.serial)
@@ -159,6 +161,8 @@
             3. Make a short sequence voice call between Phone A and B.
 
         """
+        # Sleep for 5s before getting new WiFi state.
+        time.sleep(5)
         wifi_info = self.dut.droid.wifiGetConnectionInfo()
         if wifi_info[WifiEnums.SSID_KEY] != self.wifi_network_ssid:
             raise signals.TestFailure("Phone failed to connect to %s network on"