Disable data for idle test and add device info to artifact

Also fixes the result csv saving issue.

Bug: 238928480
Bug: 243853301
Test: manually test with locally built acts_tests.zip
Change-Id: I5ba24846be83d22d59510ff305921e9fa8c5880d
diff --git a/acts_tests/acts_contrib/test_utils/power/cellular/cellular_idle_power_test.py b/acts_tests/acts_contrib/test_utils/power/cellular/cellular_idle_power_test.py
index 72cb7ee..a834a82 100644
--- a/acts_tests/acts_contrib/test_utils/power/cellular/cellular_idle_power_test.py
+++ b/acts_tests/acts_contrib/test_utils/power/cellular/cellular_idle_power_test.py
@@ -35,6 +35,9 @@
             filter_results: when True the reported result is filtered to only
                 samples where average power was below a certain threshold.
         """
+        # disable data for idle test
+        self.dut.adb.shell('service call phone 39')
+        self.dut.adb.shell('svc data disable')
 
         idle_wait_time = self.simulation.rrc_sc_timer + 30
 
diff --git a/acts_tests/acts_contrib/test_utils/power/cellular/cellular_power_base_test.py b/acts_tests/acts_contrib/test_utils/power/cellular/cellular_power_base_test.py
index 5d3c913..7285a16 100644
--- a/acts_tests/acts_contrib/test_utils/power/cellular/cellular_power_base_test.py
+++ b/acts_tests/acts_contrib/test_utils/power/cellular/cellular_power_base_test.py
@@ -13,6 +13,7 @@
 #   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 json
 import os
 
 import acts_contrib.test_utils.power.PowerBaseTest as PBT
@@ -39,6 +40,21 @@
         """ Turn screen on before starting a test. """
 
         super().setup_test()
+        try:
+            # Save a json file for device info
+            path = os.path.join(self.log_path, 'device_info.json')
+
+            self.log.info('save the device info to {}'.format(path))
+            baseband = self.dut.adb.getprop('gsm.version.baseband')
+            self.dut.add_device_info('baseband', baseband)
+            with open(path, 'w') as f:
+                json.dump(
+                    self.dut.device_info,
+                    f,
+                    indent=2,
+                    sort_keys=True)
+        except Exception as e:
+            self.log.error('error in saving device_info: {}'.format(e))
 
         # Make the device go to sleep
         self.dut.droid.goToSleepNow()
@@ -98,8 +114,12 @@
 
         path = os.path.join(self.log_path, self.RESULTS_SUMMARY_FILENAME)
 
-        with open(path, 'w') as csvfile:
-            csvfile.write('test,avg_power')
+        # To avoid the test overwrite each other, open file with 'a' option
+        csvfile_exist = os.path.exists(path)
+
+        with open(path, 'a') as csvfile:
+            if not csvfile_exist:
+                csvfile.write('test,avg_power')
             for test_name, value in self.power_results.items():
                 csvfile.write('\n{},{}'.format(test_name, value))