Explicitly Enable/Disable VT Setting

-Added toggle_video_calling() function to for the the user
 video calling setting to the correct to the correct state

-Explicitly disable video as part of ensure_phone_idle()

-Explicitly enable video calling user setting when setting
 up video calling tests.

Bug: 31064564
Change-Id: Ieeb49345a5aea83cc3466891c1933f2b525476eb
diff --git a/acts/framework/acts/test_utils/tel/tel_test_utils.py b/acts/framework/acts/test_utils/tel/tel_test_utils.py
index 69189a9..2c0d880 100644
--- a/acts/framework/acts/test_utils/tel/tel_test_utils.py
+++ b/acts/framework/acts/test_utils/tel/tel_test_utils.py
@@ -1788,6 +1788,30 @@
 
     return True
 
+def toggle_video_calling(log, ad, new_state=None):
+    """Toggle enable/disable Video calling for default voice subscription.
+
+    Args:
+        ad: Android device object.
+        new_state: Video mode state to set to.
+            True for enable, False for disable.
+            If None, opposite of the current state.
+
+    Raises:
+        TelTestUtilsError if platform does not support Video calling.
+    """
+    if not ad.droid.imsIsVtEnabledByPlatform():
+        if new_state is not False:
+            raise TelTestUtilsError("VT not supported by platform.")
+        # if the user sets VT false and it's unavailable we just let it go
+        return False
+
+    current_state = ad.droid.imsIsVtEnabledByUser()
+    if new_state is None:
+        new_state = not current_state
+    if new_state != current_state:
+        ad.droid.imsSetVtSetting(new_state)
+    return True
 
 def _wait_for_droid_in_state(log, ad, max_time, state_check_func, *args,
                              **kwargs):
@@ -2975,6 +2999,8 @@
         ad.droid.telecomEndCall()
     set_wfc_mode(log, ad, WFC_MODE_DISABLED)
 
+    toggle_video_calling(log, ad, False)
+
     if not wait_for_not_network_rat(log,
                                     ad,
                                     RAT_FAMILY_WLAN,
diff --git a/acts/framework/acts/test_utils/tel/tel_video_utils.py b/acts/framework/acts/test_utils/tel/tel_video_utils.py
index 08a992b..2567741 100644
--- a/acts/framework/acts/test_utils/tel/tel_video_utils.py
+++ b/acts/framework/acts/test_utils/tel/tel_video_utils.py
@@ -59,6 +59,7 @@
 from acts.test_utils.tel.tel_test_utils import hangup_call
 from acts.test_utils.tel.tel_test_utils import set_wfc_mode
 from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode
+from acts.test_utils.tel.tel_test_utils import toggle_video_calling
 from acts.test_utils.tel.tel_test_utils import toggle_volte
 from acts.test_utils.tel.tel_test_utils import verify_incall_state
 from acts.test_utils.tel.tel_test_utils import wait_for_network_generation
@@ -106,6 +107,8 @@
         return False
     toggle_volte(log, ad, True)
 
+    toggle_video_calling(log, ad, True)
+
     if not ensure_network_generation(log,
                                      ad,
                                      GEN_4G,