Remove duplicate code in Nsa5gVoiceTest.
1. Move _test_call_setup_in_active_data_transfer,
_test_call_setup_in_active_youtube_video,
_call_epdg_to_epdg_wfc from TelLiveVoiceTest to tel_data_utils
2. Remove _test_call_setup_in_active_data_transfer_5g_nsa,
_test_call_setup_in_active_youtube_video_5g_nsa,
_test_call_epdg_to_epdg_wfc_5g_nsa from Nsa5gVoiceTest
3. Update Nsa5gVoiceTest, TelLiveVoiceTest accordingly.
Test: yes, Chunghwa telecom
Bug: 179409496
Change-Id: I3e08f212bcd964403abf7c28b5eed0275b777d85
diff --git a/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py b/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py
index b6785cf..92dfcb7 100644
--- a/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py
+++ b/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py
@@ -45,6 +45,7 @@
from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING
from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_BETWEEN_REG_AND_CALL
from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_BETWEEN_STATE_CHECK
+from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL_FOR_IMS
from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
from acts_contrib.test_utils.tel.tel_test_utils import check_is_wifi_connected
from acts_contrib.test_utils.tel.tel_test_utils import ensure_network_generation
@@ -80,10 +81,18 @@
from acts_contrib.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G
from acts_contrib.test_utils.tel.tel_test_utils import wifi_reset
from acts_contrib.test_utils.tel.tel_test_utils import wifi_toggle_state
+from acts_contrib.test_utils.tel.tel_test_utils import active_file_download_task
+from acts_contrib.test_utils.tel.tel_test_utils import run_multithread_func
+from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_default_state
from acts_contrib.test_utils.tel.tel_5g_utils import is_current_network_5g_nsa
from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_5g
from acts_contrib.test_utils.tel.tel_5g_utils import provision_device_for_5g
+from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices
from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_general
+from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_iwlan
+from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_short_seq
+from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_iwlan
+from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan
def wifi_tethering_cleanup(log, provider, client_list):
@@ -1323,3 +1332,256 @@
log.error("Failed to get user-plane traffic, aborting!")
return False
return True
+
+
+def test_call_setup_in_active_data_transfer(
+ log,
+ ads,
+ nw_gen=None,
+ call_direction=DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=False):
+ """Test call can be established during active data connection.
+
+ Turn off airplane mode, disable WiFi, enable Cellular Data.
+ Make sure phone in <nw_gen>.
+ Starting downloading file from Internet.
+ Initiate a voice call. Verify call can be established.
+ Hangup Voice Call, verify file is downloaded successfully.
+ Note: file download will be suspended when call is initiated if voice
+ is using voice channel and voice channel and data channel are
+ on different RATs.
+ Args:
+ log: log object.
+ ads: list of android objects, this list should have two ad.
+ nw_gen: network generation.
+ call_direction: MO(DIRECTION_MOBILE_ORIGINATED) or MT(DIRECTION_MOBILE_TERMINATED) call.
+ allow_data_transfer_interruption: if allow to interrupt data transfer.
+
+ Returns:
+ True if success.
+ False if failed.
+ """
+
+ def _call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
+ caller_verifier, callee_verifier,
+ wait_time_in_call):
+ # wait time for active data transfer
+ time.sleep(5)
+ return call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
+ caller_verifier, callee_verifier,
+ wait_time_in_call)
+
+ if nw_gen == GEN_5G:
+ if not provision_device_for_5g(log, ads[0]):
+ ads[0].log.error("Phone not attached on 5G NSA before call.")
+ return False
+ elif nw_gen:
+ if not ensure_network_generation(log, ads[0], nw_gen,
+ MAX_WAIT_TIME_NW_SELECTION,
+ NETWORK_SERVICE_DATA):
+ ads[0].log.error("Device failed to reselect in %s.",
+ MAX_WAIT_TIME_NW_SELECTION)
+ return False
+
+ ads[0].droid.telephonyToggleDataConnection(True)
+ if not wait_for_cell_data_connection(log, ads[0], True):
+ ads[0].log.error("Data connection is not on cell")
+ return False
+ else:
+ ads[0].log.debug("Skipping network generation since it is None")
+
+ if not verify_internet_connection(log, ads[0]):
+ ads[0].log.error("Internet connection is not available")
+ return False
+
+ if call_direction == DIRECTION_MOBILE_ORIGINATED:
+ ad_caller = ads[0]
+ ad_callee = ads[1]
+ else:
+ ad_caller = ads[1]
+ ad_callee = ads[0]
+ ad_download = ads[0]
+
+ start_youtube_video(ad_download)
+ call_task = (_call_setup_teardown, (log, ad_caller, ad_callee,
+ ad_caller, None, None, 30))
+ download_task = active_file_download_task(log, ad_download)
+ results = run_multithread_func(log, [download_task, call_task])
+ if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1):
+ ad_download.log.info("After call hangup, audio is back to music")
+ else:
+ ad_download.log.warning(
+ "After call hang up, audio is not back to music")
+ ad_download.force_stop_apk("com.google.android.youtube")
+ if not results[1]:
+ log.error("Call setup failed in active data transfer.")
+ if results[0]:
+ ad_download.log.info("Data transfer succeeded.")
+ return True
+ elif not allow_data_transfer_interruption:
+ ad_download.log.error(
+ "Data transfer failed with parallel phone call.")
+ return False
+ else:
+ ad_download.log.info("Retry data connection after call hung up")
+ if not verify_internet_connection(log, ad_download):
+ ad_download.log.error("Internet connection is not available")
+ return False
+ if nw_gen == GEN_5G and not is_current_network_5g_nsa(ads[0]):
+ ads[0].log.error("Phone not attached on 5G NSA after call.")
+ return False
+ return True
+
+
+def test_call_setup_in_active_youtube_video(
+ log,
+ ads,
+ nw_gen=None,
+ call_direction=DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=False):
+ """Test call can be established during active data connection.
+
+ Turn off airplane mode, disable WiFi, enable Cellular Data.
+ Make sure phone in <nw_gen>.
+ Starting playing youtube video.
+ Initiate a voice call. Verify call can be established.
+ Args:
+ log: log object.
+ ads: list of android objects, this list should have two ad.
+ nw_gen: network generation.
+ call_direction: MO(DIRECTION_MOBILE_ORIGINATED) or MT(DIRECTION_MOBILE_TERMINATED) call.
+ allow_data_transfer_interruption: if allow to interrupt data transfer.
+
+ Returns:
+ True if success.
+ False if failed.
+ """
+ if nw_gen == GEN_5G:
+ if not provision_device_for_5g(log, ads[0]):
+ ads[0].log.error("Phone not attached on 5G NSA before call.")
+ return False
+ elif nw_gen:
+ if not ensure_network_generation(log, ads[0], nw_gen,
+ MAX_WAIT_TIME_NW_SELECTION,
+ NETWORK_SERVICE_DATA):
+ ads[0].log.error("Device failed to reselect in %s.",
+ MAX_WAIT_TIME_NW_SELECTION)
+ return False
+ else:
+ ensure_phones_default_state(log, ads)
+ ads[0].droid.telephonyToggleDataConnection(True)
+ if not wait_for_cell_data_connection(log, ads[0], True):
+ ads[0].log.error("Data connection is not on cell")
+ return False
+
+ if not verify_internet_connection(log, ads[0]):
+ ads[0].log.error("Internet connection is not available")
+ return False
+
+ if call_direction == DIRECTION_MOBILE_ORIGINATED:
+ ad_caller = ads[0]
+ ad_callee = ads[1]
+ else:
+ ad_caller = ads[1]
+ ad_callee = ads[0]
+ ad_download = ads[0]
+
+ if not start_youtube_video(ad_download):
+ ad_download.log.warning("Fail to bring up youtube video")
+
+ if not call_setup_teardown(log, ad_caller, ad_callee, ad_caller,
+ None, None, 30):
+ ad_download.log.error("Call setup failed in active youtube video")
+ result = False
+ else:
+ ad_download.log.info("Call setup succeed in active youtube video")
+ result = True
+
+ if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1):
+ ad_download.log.info("After call hangup, audio is back to music")
+ else:
+ ad_download.log.warning(
+ "After call hang up, audio is not back to music")
+ ad_download.force_stop_apk("com.google.android.youtube")
+ if nw_gen == GEN_5G and not is_current_network_5g_nsa(ads[0]):
+ ads[0].log.error("Phone not attached on 5G NSA after call.")
+ result = False
+ return result
+
+
+def call_epdg_to_epdg_wfc(log,
+ ads,
+ apm_mode,
+ wfc_mode,
+ wifi_ssid,
+ wifi_pwd,
+ nw_gen=None):
+ """ Test epdg<->epdg call functionality.
+
+ Make Sure PhoneA is set to make epdg call.
+ Make Sure PhoneB is set to make epdg call.
+ Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
+ Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
+
+ Args:
+ log: log object.
+ ads: list of android objects, this list should have two ad.
+ apm_mode: phones' airplane mode.
+ if True, phones are in airplane mode during test.
+ if False, phones are not in airplane mode during test.
+ wfc_mode: phones' wfc mode.
+ Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED,
+ WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED.
+ wifi_ssid: WiFi ssid to connect during test.
+ wifi_pwd: WiFi password.
+ nw_gen: network generation.
+
+ Returns:
+ True if pass; False if fail.
+ """
+ DEFAULT_PING_DURATION = 120
+
+ if nw_gen == GEN_5G:
+ # Turn off apm first before setting network preferred mode to 5G NSA.
+ log.info("Turn off APM mode before starting testing.")
+ tasks = [(toggle_airplane_mode, (log, ads[0], False)),
+ (toggle_airplane_mode, (log, ads[1], False))]
+ if not multithread_func(log, tasks):
+ log.error("Failed to turn off airplane mode")
+ return False
+ if not provision_both_devices_for_5g(log, ads):
+ log.error("Phone not attached on 5G NSA before epdg call.")
+ return False
+
+ tasks = [(phone_setup_iwlan, (log, ads[0], apm_mode, wfc_mode,
+ wifi_ssid, wifi_pwd)),
+ (phone_setup_iwlan, (log, ads[1], apm_mode, wfc_mode,
+ wifi_ssid, wifi_pwd))]
+ if not multithread_func(log, tasks):
+ log.error("Phone Failed to Set Up Properly.")
+ return False
+
+ ad_ping = ads[0]
+
+ call_task = (two_phone_call_short_seq,
+ (log, ads[0], phone_idle_iwlan,
+ is_phone_in_call_iwlan, ads[1], phone_idle_iwlan,
+ is_phone_in_call_iwlan, None, WAIT_TIME_IN_CALL_FOR_IMS))
+ ping_task = (adb_shell_ping, (ad_ping, DEFAULT_PING_DURATION))
+
+ results = run_multithread_func(log, [ping_task, call_task])
+
+ time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
+
+ if nw_gen == GEN_5G and not verify_5g_attach_for_both_devices(log, ads):
+ log.error("Phone not attached on 5G NSA after epdg call.")
+ return False
+
+ if not results[1]:
+ log.error("Call setup failed in active ICMP transfer.")
+ if results[0]:
+ log.info("ICMP transfer succeeded with parallel phone call.")
+ else:
+ log.error("ICMP transfer failed with parallel phone call.")
+ return all(results)
+
diff --git a/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py b/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py
index bbe950e..a1e7a64 100755
--- a/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py
+++ b/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py
@@ -23,9 +23,6 @@
from acts.utils import adb_shell_ping
from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL_FOR_IMS
-from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL
-from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_ACTIVE
-from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_HOLDING
from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED
from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED
from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING
@@ -35,24 +32,13 @@
from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
from acts_contrib.test_utils.tel.tel_test_utils import hangup_call
from acts_contrib.test_utils.tel.tel_test_utils import multithread_func
-from acts_contrib.test_utils.tel.tel_test_utils import num_active_calls
-from acts_contrib.test_utils.tel.tel_test_utils import verify_incall_state
-from acts_contrib.test_utils.tel.tel_test_utils import verify_internet_connection
-from acts_contrib.test_utils.tel.tel_test_utils import start_youtube_video
-from acts_contrib.test_utils.tel.tel_test_utils import wait_for_cell_data_connection
-from acts_contrib.test_utils.tel.tel_test_utils import active_file_download_task
-from acts_contrib.test_utils.tel.tel_test_utils import run_multithread_func
-from acts_contrib.test_utils.tel.tel_test_utils import wait_for_state
from acts_contrib.test_utils.tel.tel_test_utils import is_phone_in_call_active
-from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode
from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_volte
-from acts_contrib.test_utils.tel.tel_voice_utils import hold_unhold_test
from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_call_hold_unhold_test
from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte
from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_short_seq
from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_3g
from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_3g
-from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_iwlan
from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan
from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_iwlan
from acts_contrib.test_utils.tel.tel_5g_utils import set_preferred_mode_for_5g
@@ -61,6 +47,9 @@
from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices
from acts_contrib.test_utils.tel.tel_5g_utils import is_current_network_5g_nsa
from acts_contrib.test_utils.tel.tel_data_utils import wifi_cell_switching
+from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_data_transfer
+from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_youtube_video
+from acts_contrib.test_utils.tel.tel_data_utils import call_epdg_to_epdg_wfc
class Nsa5gVoiceTest(TelephonyBaseTest):
@@ -75,244 +64,6 @@
def teardown_test(self):
ensure_phones_idle(self.log, self.android_devices)
-
- def _test_call_setup_in_active_data_transfer_5g_nsa(
- self,
- new_gen=None,
- call_direction=DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=False):
- """Test call can be established during active data connection in 5G NSA.
-
- Turn off airplane mode, disable WiFi, enable Cellular Data.
- Make sure phone in 5G NSA.
- Starting downloading file from Internet.
- Initiate a voice call. Verify call can be established.
- Hangup Voice Call, verify file is downloaded successfully.
- Note: file download will be suspended when call is initiated if voice
- is using voice channel and voice channel and data channel are
- on different RATs.
-
- Returns:
- True if success.
- False if failed.
- """
- ads = self.android_devices
-
- def _call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
- caller_verifier, callee_verifier,
- wait_time_in_call):
- #wait time for active data transfer
- time.sleep(5)
- return call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
- caller_verifier, callee_verifier,
- wait_time_in_call)
-
- # Mode Pref
- set_preferred_mode_for_5g(ads[0])
-
- # Attach nsa5g
- if not is_current_network_5g_nsa(ads[0]):
- ads[0].log.error("Phone not attached on 5G NSA before call.")
- return False
-
- if new_gen:
- ads[0].droid.telephonyToggleDataConnection(True)
- if not wait_for_cell_data_connection(self.log, ads[0], True):
- ads[0].log.error("Data connection is not on cell")
- return False
-
- if not verify_internet_connection(self.log, ads[0]):
- ads[0].log.error("Internet connection is not available")
- return False
-
- if call_direction == DIRECTION_MOBILE_ORIGINATED:
- ad_caller = ads[0]
- ad_callee = ads[1]
- else:
- ad_caller = ads[1]
- ad_callee = ads[0]
- ad_download = ads[0]
-
- start_youtube_video(ad_download)
- call_task = (_call_setup_teardown, (self.log, ad_caller, ad_callee,
- ad_caller, None, None, 30))
- download_task = active_file_download_task(self.log, ad_download, file_name="10MB")
- results = run_multithread_func(self.log, [download_task, call_task])
- if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1):
- ad_download.log.info("After call hangup, audio is back to music")
- else:
- ad_download.log.warning(
- "After call hang up, audio is not back to music")
- ad_download.force_stop_apk("com.google.android.youtube")
- if not results[1]:
- self.log.error("Call setup failed in active data transfer.")
- return False
- if results[0]:
- ad_download.log.info("Data transfer succeeded.")
- elif not allow_data_transfer_interruption:
- ad_download.log.error(
- "Data transfer failed with parallel phone call.")
- return False
- else:
- ad_download.log.info("Retry data connection after call hung up")
- if not verify_internet_connection(self.log, ad_download):
- ad_download.log.error("Internet connection is not available")
- return False
- if not is_current_network_5g_nsa(ads[0]):
- ads[0].log.error("Phone not attached on 5G NSA after call.")
- return False
- return True
-
- def _test_call_setup_in_active_youtube_video_5g_nsa(
- self,
- new_gen=None,
- call_direction=DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=False):
- """Test call can be established during active data connection on 5G NSA.
-
- Setup phoneA on 5G NSA.
- Make sure phoneA on 5G NSA
- Starting playing youtube video.
- Initiate a voice call. Verify call can be established.
- Make sure phoneA on 5G NSA
-
- Returns:
- True if success.
- False if failed.
- """
- ads = self.android_devices
- # Mode Pref
- set_preferred_mode_for_5g(ads[0])
-
- # Attach 5g
- if not is_current_network_5g_nsa(ads[0]):
- ads[0].log.error("Phone not attached on 5G NSA before call.")
- return False
-
- if new_gen:
- ads[0].droid.telephonyToggleDataConnection(True)
- if not wait_for_cell_data_connection(self.log, ads[0], True):
- ads[0].log.error("Data connection is not on cell")
- return False
-
- if not verify_internet_connection(self.log, ads[0]):
- ads[0].log.error("Internet connection is not available")
- return False
-
- if call_direction == DIRECTION_MOBILE_ORIGINATED:
- ad_caller = ads[0]
- ad_callee = ads[1]
- else:
- ad_caller = ads[1]
- ad_callee = ads[0]
- ad_download = ads[0]
-
- if not start_youtube_video(ad_download):
- ad_download.log.warning("Fail to bring up youtube video")
-
- if not call_setup_teardown(self.log, ad_caller, ad_callee, ad_caller,
- None, None, 30):
- ad_download.log.error("Call setup failed in active youtube video")
- result = False
- else:
- ad_download.log.info("Call setup succeed in active youtube video")
- result = True
-
- if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1):
- ad_download.log.info("After call hangup, audio is back to music")
- else:
- ad_download.log.warning(
- "After call hang up, audio is not back to music")
- ad_download.force_stop_apk("com.google.android.youtube")
- if not is_current_network_5g_nsa(ads[0]):
- ads[0].log.error("Phone not attached on 5G NSA after call.")
- result = False
- return result
-
- def _test_call_epdg_to_epdg_wfc_5g_nsa(self,
- ads,
- apm_mode,
- wfc_mode,
- wifi_ssid,
- wifi_pwd):
- """ Test epdg<->epdg call functionality on 5G NSA.
-
- Set PhoneA/PhoneB on 5G NSA
- Make sure PhoneA/PhoneB on 5G NSA before testing
- Make Sure PhoneA is set to make epdg call.
- Make Sure PhoneB is set to make epdg call.
- Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
- Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
- Make sure PhoneA/PhoneB on 5G NSA after testing
-
- Args:
- ads: list of android objects, this list should have two ad.
- apm_mode: phones' airplane mode.
- if True, phones are in airplane mode during test.
- if False, phones are not in airplane mode during test.
- wfc_mode: phones' wfc mode.
- Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED,
- WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED.
- wifi_ssid: WiFi ssid to connect during test.
- wifi_pwd: WiFi password.
-
- Returns:
- True if pass; False if fail.
- """
- DEFAULT_PING_DURATION = 120 # in seconds
-
- # if apm_mode is true, turn off apm first before setting network
- # preferred mode to 5G NSA.
- if apm_mode:
- # Turn off airplane mode
- self.log.info("Turn off APM mode before starting testing.")
- tasks = [(toggle_airplane_mode, (self.log, ads[0], False)),
- (toggle_airplane_mode, (self.log, ads[1], False))]
- if not multithread_func(self.log, tasks):
- self.log.error("Failed to turn off airplane mode")
- return False
-
- if not provision_both_devices_for_5g(self.log, ads):
- return False
-
- if not verify_5g_attach_for_both_devices(self.log, ads):
- self.log.error("Phone not attached on 5G NSA before epdg call.")
- return False
-
- tasks = [(phone_setup_iwlan, (self.log, ads[0], apm_mode, wfc_mode,
- wifi_ssid, wifi_pwd)),
- (phone_setup_iwlan, (self.log, ads[1], apm_mode, wfc_mode,
- wifi_ssid, wifi_pwd))]
- if not multithread_func(self.log, tasks):
- self.log.error("Phone Failed to Set Up Properly.")
- return False
-
- time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
-
- ad_ping = ads[0]
-
- call_task = (two_phone_call_short_seq,
- (self.log, ads[0], phone_idle_iwlan,
- is_phone_in_call_iwlan, ads[1], phone_idle_iwlan,
- is_phone_in_call_iwlan, None, WAIT_TIME_IN_CALL_FOR_IMS))
- ping_task = (adb_shell_ping, (ad_ping, DEFAULT_PING_DURATION))
-
- results = run_multithread_func(self.log, [ping_task, call_task])
-
- time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
-
- if not verify_5g_attach_for_both_devices(self.log, ads):
- self.log.error("Phone not attached on 5G NSA after epdg call.")
- return False
-
- if not results[1]:
- self.log.error("Call setup failed in active ICMP transfer.")
- if results[0]:
- self.log.info("ICMP transfer succeeded with parallel phone call.")
- else:
- self.log.error("ICMP transfer failed with parallel phone call.")
- return all(results)
-
""" Tests Begin """
@test_tracker_info(uuid="1bef3da1-4608-4b0e-8b78-f3f7be0115d5")
@@ -487,9 +238,10 @@
if not phone_setup_volte(self.log, ads[0]):
ads[0].log.error("failed to setup volte")
return False
- return self._test_call_setup_in_active_data_transfer_5g_nsa(
- GEN_5G,
- DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ ads,
+ GEN_5G,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="aaa98e51-0bde-472a-abc3-5dc180f56a08")
@@ -514,9 +266,10 @@
if not phone_setup_volte(self.log, ads[0]):
ads[0].log.error("failed to setup volte")
return False
- return self._test_call_setup_in_active_data_transfer_5g_nsa(
- GEN_5G,
- DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ ads,
+ GEN_5G,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="3a607dee-7e92-4567-8ca0-05099590b773")
@@ -596,9 +349,13 @@
Returns:
True if pass; False if fail.
"""
- return self._test_call_epdg_to_epdg_wfc_5g_nsa(
- self.android_devices, False, WFC_MODE_WIFI_PREFERRED,
- self.wifi_network_ssid, self.wifi_network_pass)
+ return call_epdg_to_epdg_wfc(self.log,
+ self.android_devices,
+ False,
+ WFC_MODE_WIFI_PREFERRED,
+ self.wifi_network_ssid,
+ self.wifi_network_pass,
+ GEN_5G)
@test_tracker_info(uuid="29fa7f44-8d6a-4948-8178-33c9a9aab334")
@@ -620,9 +377,10 @@
if not phone_setup_volte(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_youtube_video_5g_nsa(
- GEN_5G,
- DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_5G,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="4e138477-3536-48bd-ab8a-7fb7c228b3e6")
@TelephonyBaseTest.tel_test_wrap
@@ -643,9 +401,10 @@
if not phone_setup_volte(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_youtube_video_5g_nsa(
- GEN_5G,
- DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_5G,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="0d477f6f-3464-4b32-a5e5-0fd134f2753d")
diff --git a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py
index acd35e7..683254d 100644
--- a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py
+++ b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py
@@ -25,15 +25,14 @@
from acts_contrib.test_utils.tel.loggers.telephony_metric_logger import TelephonyMetricLogger
from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
from acts_contrib.test_utils.tel.tel_data_utils import wifi_cell_switching
+from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_data_transfer
+from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_youtube_video
+from acts_contrib.test_utils.tel.tel_data_utils import call_epdg_to_epdg_wfc
from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED
from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED
from acts_contrib.test_utils.tel.tel_defines import GEN_2G
from acts_contrib.test_utils.tel.tel_defines import GEN_4G
-from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_ACTIVE
-from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_HOLDING
from acts_contrib.test_utils.tel.tel_defines import GEN_3G
-from acts_contrib.test_utils.tel.tel_defines import MAX_WAIT_TIME_NW_SELECTION
-from acts_contrib.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA
from acts_contrib.test_utils.tel.tel_defines import PHONE_TYPE_CDMA
from acts_contrib.test_utils.tel.tel_defines import PHONE_TYPE_GSM
from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL
@@ -49,10 +48,7 @@
from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
from acts_contrib.test_utils.tel.tel_test_utils import \
call_voicemail_erase_all_pending_voicemail
-from acts_contrib.test_utils.tel.tel_test_utils import active_file_download_task
from acts.utils import adb_shell_ping
-from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_default_state
-from acts_contrib.test_utils.tel.tel_test_utils import ensure_network_generation
from acts_contrib.test_utils.tel.tel_test_utils import get_mobile_data_usage
from acts_contrib.test_utils.tel.tel_test_utils import hangup_call
from acts_contrib.test_utils.tel.tel_test_utils import initiate_call
@@ -63,12 +59,7 @@
from acts_contrib.test_utils.tel.tel_test_utils import remove_mobile_data_usage_limit
from acts_contrib.test_utils.tel.tel_test_utils import run_multithread_func
from acts_contrib.test_utils.tel.tel_test_utils import set_mobile_data_usage_limit
-from acts_contrib.test_utils.tel.tel_test_utils import verify_internet_connection
-from acts_contrib.test_utils.tel.tel_test_utils import verify_incall_state
-from acts_contrib.test_utils.tel.tel_test_utils import wait_for_cell_data_connection
from acts_contrib.test_utils.tel.tel_test_utils import wait_for_ringing_call
-from acts_contrib.test_utils.tel.tel_test_utils import wait_for_state
-from acts_contrib.test_utils.tel.tel_test_utils import start_youtube_video
from acts_contrib.test_utils.tel.tel_test_utils import set_wifi_to_default
from acts_contrib.test_utils.tel.tel_test_utils import STORY_LINE
from acts_contrib.test_utils.tel.tel_test_utils import wait_for_in_call_active
@@ -664,56 +655,6 @@
raise signals.TestFailure("Failed",
extras={"fail_reason": str(result.result_value)})
-
- def _call_epdg_to_epdg_wfc(self, ads, apm_mode, wfc_mode, wifi_ssid,
- wifi_pwd):
- """ Test epdg<->epdg call functionality.
-
- Make Sure PhoneA is set to make epdg call.
- Make Sure PhoneB is set to make epdg call.
- Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
- Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
-
- Args:
- ads: list of android objects, this list should have two ad.
- apm_mode: phones' airplane mode.
- if True, phones are in airplane mode during test.
- if False, phones are not in airplane mode during test.
- wfc_mode: phones' wfc mode.
- Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED,
- WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED.
- wifi_ssid: WiFi ssid to connect during test.
- wifi_pwd: WiFi password.
-
- Returns:
- True if pass; False if fail.
- """
- tasks = [(phone_setup_iwlan, (self.log, ads[0], apm_mode, wfc_mode,
- wifi_ssid, wifi_pwd)),
- (phone_setup_iwlan, (self.log, ads[1], apm_mode, wfc_mode,
- wifi_ssid, wifi_pwd))]
- if not multithread_func(self.log, tasks):
- self.log.error("Phone Failed to Set Up Properly.")
- return False
-
- ad_ping = ads[0]
-
- call_task = (two_phone_call_short_seq,
- (self.log, ads[0], phone_idle_iwlan,
- is_phone_in_call_iwlan, ads[1], phone_idle_iwlan,
- is_phone_in_call_iwlan, None, WAIT_TIME_IN_CALL_FOR_IMS))
- ping_task = (adb_shell_ping, (ad_ping, DEFAULT_PING_DURATION))
-
- results = run_multithread_func(self.log, [ping_task, call_task])
-
- if not results[1]:
- self.log.error("Call setup failed in active ICMP transfer.")
- if results[0]:
- self.log.info("ICMP transfer succeeded with parallel phone call.")
- else:
- self.log.error("ICMP transfer failed with parallel phone call.")
- return all(results)
-
@test_tracker_info(uuid="a4a043c0-f4ba-4405-9262-42c752cc4487")
@TelephonyBaseTest.tel_test_wrap
def test_call_epdg_to_epdg_wfc_wifi_only(self):
@@ -727,9 +668,12 @@
Returns:
True if pass; False if fail.
"""
- return self._call_epdg_to_epdg_wfc(
- self.android_devices, False, WFC_MODE_WIFI_ONLY,
- self.wifi_network_ssid, self.wifi_network_pass)
+ return call_epdg_to_epdg_wfc(self.log,
+ self.android_devices,
+ False,
+ WFC_MODE_WIFI_ONLY,
+ self.wifi_network_ssid,
+ self.wifi_network_pass)
@test_tracker_info(uuid="ae171d58-d4c1-43f7-aa93-4860b4b28d53")
@TelephonyBaseTest.tel_test_wrap
@@ -744,9 +688,12 @@
Returns:
True if pass; False if fail.
"""
- return self._call_epdg_to_epdg_wfc(
- self.android_devices, False, WFC_MODE_WIFI_PREFERRED,
- self.wifi_network_ssid, self.wifi_network_pass)
+ return call_epdg_to_epdg_wfc(self.log,
+ self.android_devices,
+ False,
+ WFC_MODE_WIFI_PREFERRED,
+ self.wifi_network_ssid,
+ self.wifi_network_pass)
@test_tracker_info(uuid="ece58857-fedc-49a9-bf10-b76bd78a51f2")
@TelephonyBaseTest.tel_test_wrap
@@ -795,9 +742,12 @@
Returns:
True if pass; False if fail.
"""
- return self._call_epdg_to_epdg_wfc(
- self.android_devices, True, WFC_MODE_WIFI_ONLY,
- self.wifi_network_ssid, self.wifi_network_pass)
+ return call_epdg_to_epdg_wfc(self.log,
+ self.android_devices,
+ True,
+ WFC_MODE_WIFI_ONLY,
+ self.wifi_network_ssid,
+ self.wifi_network_pass)
@test_tracker_info(uuid="7678e4ee-29c6-4319-93ab-d555501d1876")
@TelephonyBaseTest.tel_test_wrap
@@ -812,9 +762,12 @@
Returns:
True if pass; False if fail.
"""
- return self._call_epdg_to_epdg_wfc(
- self.android_devices, True, WFC_MODE_WIFI_PREFERRED,
- self.wifi_network_ssid, self.wifi_network_pass)
+ return call_epdg_to_epdg_wfc(self.log,
+ self.android_devices,
+ True,
+ WFC_MODE_WIFI_PREFERRED,
+ self.wifi_network_ssid,
+ self.wifi_network_pass)
@test_tracker_info(uuid="8f5c637e-683a-448d-9443-b2b39626ab19")
@TelephonyBaseTest.tel_test_wrap
@@ -829,9 +782,12 @@
Returns:
True if pass; False if fail.
"""
- return self._call_epdg_to_epdg_wfc(
- self.android_devices, True, WFC_MODE_CELLULAR_PREFERRED,
- self.wifi_network_ssid, self.wifi_network_pass)
+ return call_epdg_to_epdg_wfc(self.log,
+ self.android_devices,
+ True,
+ WFC_MODE_CELLULAR_PREFERRED,
+ self.wifi_network_ssid,
+ self.wifi_network_pass)
@test_tracker_info(uuid="0b51666e-c83c-40b5-ba0f-737e64bc82a2")
@TelephonyBaseTest.tel_test_wrap
@@ -3156,90 +3112,6 @@
return self._test_call_hangup_while_ringing(self.android_devices[1],
self.android_devices[0])
- def _test_call_setup_in_active_data_transfer(
- self,
- nw_gen=None,
- call_direction=DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=False):
- """Test call can be established during active data connection.
-
- Turn off airplane mode, disable WiFi, enable Cellular Data.
- Make sure phone in <nw_gen>.
- Starting downloading file from Internet.
- Initiate a voice call. Verify call can be established.
- Hangup Voice Call, verify file is downloaded successfully.
- Note: file download will be suspended when call is initiated if voice
- is using voice channel and voice channel and data channel are
- on different RATs.
-
- Returns:
- True if success.
- False if failed.
- """
- ads = self.android_devices
-
- def _call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
- caller_verifier, callee_verifier,
- wait_time_in_call):
- #wait time for active data transfer
- time.sleep(5)
- return call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
- caller_verifier, callee_verifier,
- wait_time_in_call)
-
- if nw_gen:
- if not ensure_network_generation(self.log, ads[0], nw_gen,
- MAX_WAIT_TIME_NW_SELECTION,
- NETWORK_SERVICE_DATA):
- ads[0].log.error("Device failed to reselect in %s.",
- MAX_WAIT_TIME_NW_SELECTION)
- return False
-
- ads[0].droid.telephonyToggleDataConnection(True)
- if not wait_for_cell_data_connection(self.log, ads[0], True):
- ads[0].log.error("Data connection is not on cell")
- return False
-
- if not verify_internet_connection(self.log, ads[0]):
- ads[0].log.error("Internet connection is not available")
- return False
-
- if call_direction == DIRECTION_MOBILE_ORIGINATED:
- ad_caller = ads[0]
- ad_callee = ads[1]
- else:
- ad_caller = ads[1]
- ad_callee = ads[0]
- ad_download = ads[0]
-
- start_youtube_video(ad_download)
- call_task = (_call_setup_teardown, (self.log, ad_caller, ad_callee,
- ad_caller, None, None, 30))
- download_task = active_file_download_task(self.log, ad_download)
- results = run_multithread_func(self.log, [download_task, call_task])
- if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1):
- ad_download.log.info("After call hangup, audio is back to music")
- else:
- ad_download.log.warning(
- "After call hang up, audio is not back to music")
- ad_download.force_stop_apk("com.google.android.youtube")
- if not results[1]:
- self.log.error("Call setup failed in active data transfer.")
- return False
- if results[0]:
- ad_download.log.info("Data transfer succeeded.")
- return True
- elif not allow_data_transfer_interruption:
- ad_download.log.error(
- "Data transfer failed with parallel phone call.")
- return False
- else:
- ad_download.log.info("Retry data connection after call hung up")
- if not verify_internet_connection(self.log, ad_download):
- ad_download.log.error("Internet connection is not available")
- return False
- else:
- return True
@test_tracker_info(uuid="aa40e7e1-e64a-480b-86e4-db2242449555")
@TelephonyBaseTest.tel_test_wrap
@@ -3259,8 +3131,10 @@
True if success.
False if failed.
"""
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="d750d66b-2091-4e8d-baa2-084b9d2bbff5")
@TelephonyBaseTest.tel_test_wrap
@@ -3280,8 +3154,10 @@
True if success.
False if failed.
"""
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="35703e83-b3e6-40af-aeaf-6b983d6205f4")
@TelephonyBaseTest.tel_test_wrap
@@ -3304,8 +3180,10 @@
if not phone_setup_volte(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_4G, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="a0f658d9-4212-44db-b3e8-7202f1eec04d")
@TelephonyBaseTest.tel_test_wrap
@@ -3328,8 +3206,10 @@
if not phone_setup_volte(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_4G, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="e0b264ec-fc29-411e-b018-684b7ff5a37e")
@TelephonyBaseTest.tel_test_wrap
@@ -3352,10 +3232,11 @@
if not phone_setup_csfb(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_4G,
- DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="98f04a27-74e1-474d-90d1-a4a45cdb6f5b")
@TelephonyBaseTest.tel_test_wrap
@@ -3378,10 +3259,11 @@
if not phone_setup_csfb(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_4G,
- DIRECTION_MOBILE_TERMINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_TERMINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="359b1ee1-36a6-427b-9d9e-4d77231fcb09")
@TelephonyBaseTest.tel_test_wrap
@@ -3404,10 +3286,11 @@
if not phone_setup_voice_3g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup 3G")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_3G,
- DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_3G,
+ DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="b172bbb4-2d6e-4d83-a381-ebfdf23bc30e")
@TelephonyBaseTest.tel_test_wrap
@@ -3430,10 +3313,11 @@
if not phone_setup_voice_3g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup 3G")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_3G,
- DIRECTION_MOBILE_TERMINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_3G,
+ DIRECTION_MOBILE_TERMINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="f5d9bfd0-0996-4c18-b11e-c6113dc201e2")
@TelephonyBaseTest.tel_test_wrap
@@ -3456,10 +3340,11 @@
if not phone_setup_voice_2g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup voice in 2G")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_2G,
- DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_2G,
+ DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="99cfd1be-b992-48bf-a50e-fc3eec8e5a67")
@TelephonyBaseTest.tel_test_wrap
@@ -3482,10 +3367,11 @@
if not phone_setup_voice_2g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup voice in 2G")
return False
- return self._test_call_setup_in_active_data_transfer(
- GEN_2G,
- DIRECTION_MOBILE_TERMINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ GEN_2G,
+ DIRECTION_MOBILE_TERMINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="12677cf2-40d3-4bb1-8afa-91ebcbd0f862")
@TelephonyBaseTest.tel_test_wrap
@@ -3508,8 +3394,10 @@
self.android_devices[0].log.error(
"Failed to setup IWLAN with NON-APM WIFI WFC on")
return False
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="84adcc19-43bb-4ea3-9284-7322ab139aac")
@TelephonyBaseTest.tel_test_wrap
@@ -3532,8 +3420,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM off and WIFI and WFC on")
return False
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="42566255-c33f-406c-abab-932a0aaa01a8")
@TelephonyBaseTest.tel_test_wrap
@@ -3556,8 +3446,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="fbf52f60-449b-46f2-9486-36d338a1b070")
@TelephonyBaseTest.tel_test_wrap
@@ -3580,8 +3472,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="d1bf0739-ffb7-4bf8-ab94-570619f812a8")
@TelephonyBaseTest.tel_test_wrap
@@ -3604,8 +3498,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI")
return False
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="76b2cdaf-b783-4c1a-b91b-207f82ffa816")
@TelephonyBaseTest.tel_test_wrap
@@ -3628,70 +3524,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_data_transfer(
- None, DIRECTION_MOBILE_TERMINATED)
-
- def _test_call_setup_in_active_youtube_video(
- self,
- nw_gen=None,
- call_direction=DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=False):
- """Test call can be established during active data connection.
-
- Turn off airplane mode, disable WiFi, enable Cellular Data.
- Make sure phone in <nw_gen>.
- Starting playing youtube video.
- Initiate a voice call. Verify call can be established.
-
- Returns:
- True if success.
- False if failed.
- """
- ads = self.android_devices
- if nw_gen:
- if not ensure_network_generation(self.log, ads[0], nw_gen,
- MAX_WAIT_TIME_NW_SELECTION,
- NETWORK_SERVICE_DATA):
- ads[0].log.error("Device failed to reselect in %s.",
- MAX_WAIT_TIME_NW_SELECTION)
- return False
- else:
- ensure_phones_default_state(self.log, self.android_devices)
- self.android_devices[0].droid.telephonyToggleDataConnection(True)
- if not wait_for_cell_data_connection(self.log, ads[0], True):
- ads[0].log.error("Data connection is not on cell")
- return False
-
- if not verify_internet_connection(self.log, ads[0]):
- ads[0].log.error("Internet connection is not available")
- return False
-
- if call_direction == DIRECTION_MOBILE_ORIGINATED:
- ad_caller = ads[0]
- ad_callee = ads[1]
- else:
- ad_caller = ads[1]
- ad_callee = ads[0]
- ad_download = ads[0]
-
- if not start_youtube_video(ad_download):
- ad_download.log.warning("Fail to bring up youtube video")
-
- if not call_setup_teardown(self.log, ad_caller, ad_callee, ad_caller,
- None, None, 30):
- ad_download.log.error("Call setup failed in active youtube video")
- result = False
- else:
- ad_download.log.info("Call setup succeed in active youtube video")
- result = True
-
- if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1):
- ad_download.log.info("After call hangup, audio is back to music")
- else:
- ad_download.log.warning(
- "After call hang up, audio is not back to music")
- ad_download.force_stop_apk("com.google.android.youtube")
- return result
+ return test_call_setup_in_active_data_transfer(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="1dc9f03f-1b6c-4c17-993b-3acafdc26ea3")
@TelephonyBaseTest.tel_test_wrap
@@ -3707,8 +3543,10 @@
True if success.
False if failed.
"""
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="32bc8fab-a0b9-4d47-8afb-940d1fdcde02")
@TelephonyBaseTest.tel_test_wrap
@@ -3724,8 +3562,10 @@
True if success.
False if failed.
"""
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="72204212-e0c8-4447-be3f-ae23b2a63a1c")
@TelephonyBaseTest.tel_test_wrap
@@ -3744,8 +3584,10 @@
if not phone_setup_volte(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_4G, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="84cd3ab9-a2b2-4ef9-b531-ee6201bec128")
@TelephonyBaseTest.tel_test_wrap
@@ -3764,8 +3606,10 @@
if not phone_setup_volte(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_4G, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="a8dca8d3-c44c-40a6-be56-931b4be5499b")
@TelephonyBaseTest.tel_test_wrap
@@ -3784,10 +3628,11 @@
if not phone_setup_csfb(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_4G,
- DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="d11f7263-f51d-4ea3-916a-0df4f52023ce")
@TelephonyBaseTest.tel_test_wrap
@@ -3806,10 +3651,11 @@
if not phone_setup_csfb(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup VoLTE")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_4G,
- DIRECTION_MOBILE_TERMINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_4G,
+ DIRECTION_MOBILE_TERMINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="676378b4-94b7-4ad7-8242-7ccd2bf1efba")
@TelephonyBaseTest.tel_test_wrap
@@ -3828,10 +3674,11 @@
if not phone_setup_voice_3g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup 3G")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_3G,
- DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_3G,
+ DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="6216fc6d-2aa2-4eb9-90e2-5791cb31c12e")
@TelephonyBaseTest.tel_test_wrap
@@ -3850,10 +3697,11 @@
if not phone_setup_voice_3g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup 3G")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_3G,
- DIRECTION_MOBILE_TERMINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_3G,
+ DIRECTION_MOBILE_TERMINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="58ec9783-6f8e-49f6-8dae-9dd33108b6f9")
@TelephonyBaseTest.tel_test_wrap
@@ -3872,10 +3720,11 @@
if not phone_setup_voice_2g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup voice in 2G")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_2G,
- DIRECTION_MOBILE_ORIGINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_2G,
+ DIRECTION_MOBILE_ORIGINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="e8ba7c0c-48a3-4fc6-aa34-a2e1c570521a")
@TelephonyBaseTest.tel_test_wrap
@@ -3894,10 +3743,11 @@
if not phone_setup_voice_2g(self.log, self.android_devices[0]):
self.android_devices[0].log.error("Failed to setup voice in 2G")
return False
- return self._test_call_setup_in_active_youtube_video(
- GEN_2G,
- DIRECTION_MOBILE_TERMINATED,
- allow_data_transfer_interruption=True)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ GEN_2G,
+ DIRECTION_MOBILE_TERMINATED,
+ allow_data_transfer_interruption=True)
@test_tracker_info(uuid="eb8971c1-b34a-430f-98df-0d4554c7ab12")
@TelephonyBaseTest.tel_test_wrap
@@ -3919,8 +3769,10 @@
self.android_devices[0].log.error(
"Failed to setup IWLAN with NON-APM WIFI WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="275a93d6-1f39-40c8-893f-ff77afd09e54")
@TelephonyBaseTest.tel_test_wrap
@@ -3942,8 +3794,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM off and WIFI and WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="ea087709-d4df-4223-b80c-1b33bacbd5a2")
@TelephonyBaseTest.tel_test_wrap
@@ -3965,8 +3819,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="44cc14e0-60c7-4fdb-ad26-31fdc4e52aaf")
@TelephonyBaseTest.tel_test_wrap
@@ -3988,8 +3844,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="e115e8a6-25bf-41fc-aeb8-8f4c922c50e4")
@TelephonyBaseTest.tel_test_wrap
@@ -4011,8 +3869,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="d754d3dd-0b02-4f13-bc65-fdafa254196b")
@TelephonyBaseTest.tel_test_wrap
@@ -4034,8 +3894,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="88822edf-4c4a-4bc4-9280-2f27ee9e28d5")
@TelephonyBaseTest.tel_test_wrap
@@ -4057,8 +3919,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_ORIGINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_ORIGINATED)
@test_tracker_info(uuid="c4b066b0-3cfd-4831-9c61-5d6b132648c4")
@TelephonyBaseTest.tel_test_wrap
@@ -4080,8 +3944,10 @@
self.android_devices[0].log.error(
"Failed to setup iwlan with APM, WIFI and WFC on")
return False
- return self._test_call_setup_in_active_youtube_video(
- None, DIRECTION_MOBILE_TERMINATED)
+ return test_call_setup_in_active_youtube_video(self.log,
+ self.android_devices,
+ None,
+ DIRECTION_MOBILE_TERMINATED)
@test_tracker_info(uuid="f367de12-1fd8-488d-816f-091deaacb791")
@TelephonyBaseTest.tel_test_wrap