Merge "Fix multicast test modulatedDTIM error"

Test: None
Bug: 65563975

Change-Id: I1a898b5097a640a27ed4c1ef7a7d0146fe9e2fad
(cherry picked from commit 3bb497c828fa0f59e36fc91be4bc72d478aa02f9)
diff --git a/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py b/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py
index 565305e..aa882d5 100644
--- a/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py
+++ b/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py
@@ -290,7 +290,7 @@
     return [plot, dt]
 
 
-def change_dtim(ad, gEnableModulatedDTIM, gMaxLIModulatedDTIM=6):
+def change_dtim(ad, gEnableModulatedDTIM, gMaxLIModulatedDTIM=10):
     """Function to change the DTIM setting in the phone.
 
     Args:
@@ -313,7 +313,8 @@
                 gEDTIM_old = line.strip('gEnableModulatedDTIM=').strip('\n')
             if 'gMaxLIModulatedDTIM=' in line:
                 gMDTIM_old = line.strip('gMaxLIModulatedDTIM=').strip('\n')
-    if int(gEDTIM_old) == gEnableModulatedDTIM:
+    if int(gEDTIM_old) == gEnableModulatedDTIM and int(
+            gMDTIM_old) == gMaxLIModulatedDTIM:
         ad.log.info('Current DTIM is already the desired value,'
                     'no need to reset it')
         return
diff --git a/acts/tests/google/power/PowerdtimTest.py b/acts/tests/google/power/PowerdtimTest.py
index 2403874..3f0f60b 100644
--- a/acts/tests/google/power/PowerdtimTest.py
+++ b/acts/tests/google/power/PowerdtimTest.py
@@ -29,10 +29,10 @@
 
         base_test.BaseTestClass.__init__(self, controllers)
         self.tests = ('test_2g_screenoff_dtimx1', 'test_2g_screenoff_dtimx2',
-                      'test_2g_screenoff_dtimx4', 'test_2g_screenoff_dtimx9',
+                      'test_2g_screenoff_dtimx4', 'test_2g_screenoff_dtimx5',
                       'test_2g_screenon_dtimx1', 'test_2g_screenon_dtimx4',
                       'test_5g_screenoff_dtimx1', 'test_5g_screenoff_dtimx2',
-                      'test_5g_screenoff_dtimx4', 'test_5g_screenoff_dtimx9',
+                      'test_5g_screenoff_dtimx4', 'test_5g_screenoff_dtimx5',
                       'test_5g_screenon_dtimx1', 'test_5g_screenon_dtimx4')
 
     def setup_class(self):
@@ -116,9 +116,9 @@
         self.dtim_test_func(4, 'OFF', network)
 
     @test_tracker_info(uuid='b37fa75f-6166-4247-b15c-adcda8c7038e')
-    def test_2g_screenoff_dtimx9(self):
+    def test_2g_screenoff_dtimx5(self):
         network = self.main_network[hc.BAND_2G]
-        self.dtim_test_func(9, 'OFF', network, dtim_max=10)
+        self.dtim_test_func(5, 'OFF', network, dtim_max=10)
 
     @test_tracker_info(uuid='384d3b0f-4335-4b00-8363-308ec27a150c')
     def test_2g_screenon_dtimx1(self):
@@ -154,9 +154,9 @@
         self.dtim_test_func(4, 'OFF', network)
 
     @test_tracker_info(uuid='75644df4-2cc8-4bbd-8985-0656a4f9d056')
-    def test_5g_screenoff_dtimx9(self):
+    def test_5g_screenoff_dtimx5(self):
         network = self.main_network[hc.BAND_5G]
-        self.dtim_test_func(9, 'OFF', network, dtim_max=10)
+        self.dtim_test_func(5, 'OFF', network, dtim_max=10)
 
     @test_tracker_info(uuid='327af44d-d9e7-49e0-9bda-accad6241dc7')
     def test_5g_screenon_dtimx1(self):
diff --git a/acts/tests/google/power/PowermulticastTest.py b/acts/tests/google/power/PowermulticastTest.py
index a2cfd09..bf8ad07 100644
--- a/acts/tests/google/power/PowermulticastTest.py
+++ b/acts/tests/google/power/PowermulticastTest.py
@@ -88,6 +88,7 @@
 
         """
         self.mon.usb('on')
+        self.pkt_sender.stop_sending(ignore_status=True)
         self.access_point.close()
 
     def set_connection(self, screen_status, network):
@@ -146,6 +147,9 @@
             self.dut, self.mon_info, self.current_test_name, self.bug_report)
         wputils.monsoon_data_plot(self.mon_info, file_path)
 
+        # Stop packet sending thread
+        self.pkt_sender.stop_sending()
+
         # Bring down the bridge interface
         self.access_point.bridge.teardown(self.brconfigs)