Home | History | Annotate | Download | only in live
      1 #!/usr/bin/env python3.4
      2 #
      3 #   Copyright 2016 - Google
      4 #
      5 #   Licensed under the Apache License, Version 2.0 (the "License");
      6 #   you may not use this file except in compliance with the License.
      7 #   You may obtain a copy of the License at
      8 #
      9 #       http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 #   Unless required by applicable law or agreed to in writing, software
     12 #   distributed under the License is distributed on an "AS IS" BASIS,
     13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 #   See the License for the specific language governing permissions and
     15 #   limitations under the License.
     16 """
     17     Test Script for Telephony Pre Check In Sanity
     18 """
     19 
     20 import time
     21 import os
     22 from acts.test_decorators import test_tracker_info
     23 from acts.test_utils.tel.tel_subscription_utils import \
     24     get_subid_from_slot_index
     25 from acts.test_utils.tel.tel_subscription_utils import set_subid_for_data
     26 from acts.test_utils.tel.tel_subscription_utils import \
     27     set_subid_for_message
     28 from acts.test_utils.tel.tel_subscription_utils import \
     29     set_subid_for_outgoing_call
     30 from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
     31 from acts.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED
     32 from acts.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED
     33 from acts.test_utils.tel.tel_defines import GEN_2G
     34 from acts.test_utils.tel.tel_defines import GEN_3G
     35 from acts.test_utils.tel.tel_defines import GEN_4G
     36 from acts.test_utils.tel.tel_defines import CALL_STATE_ACTIVE
     37 from acts.test_utils.tel.tel_defines import CALL_STATE_HOLDING
     38 from acts.test_utils.tel.tel_defines import GEN_3G
     39 from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_NW_SELECTION
     40 from acts.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA
     41 from acts.test_utils.tel.tel_defines import PHONE_TYPE_CDMA
     42 from acts.test_utils.tel.tel_defines import PHONE_TYPE_GSM
     43 from acts.test_utils.tel.tel_defines import RAT_3G
     44 from acts.test_utils.tel.tel_defines import RAT_FAMILY_WLAN
     45 from acts.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING
     46 from acts.test_utils.tel.tel_defines import WAIT_TIME_CHANGE_DATA_SUB_ID
     47 from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL
     48 from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL_FOR_IMS
     49 from acts.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED
     50 from acts.test_utils.tel.tel_defines import WFC_MODE_DISABLED
     51 from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_ONLY
     52 from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED
     53 from acts.test_utils.tel.tel_subscription_utils import \
     54     get_incoming_voice_sub_id
     55 from acts.test_utils.tel.tel_subscription_utils import \
     56     get_outgoing_voice_sub_id
     57 from acts.test_utils.tel.tel_test_utils import call_setup_teardown
     58 from acts.test_utils.tel.tel_test_utils import \
     59     call_voicemail_erase_all_pending_voicemail
     60 from acts.test_utils.tel.tel_test_utils import \
     61     ensure_network_generation_for_subscription
     62 from acts.test_utils.tel.tel_test_utils import active_file_download_task
     63 from acts.utils import adb_shell_ping
     64 from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected
     65 from acts.test_utils.tel.tel_test_utils import ensure_network_generation
     66 from acts.test_utils.tel.tel_test_utils import get_phone_number
     67 from acts.test_utils.tel.tel_test_utils import hangup_call
     68 from acts.test_utils.tel.tel_test_utils import initiate_call
     69 from acts.test_utils.tel.tel_test_utils import is_droid_in_rat_family
     70 from acts.test_utils.tel.tel_test_utils import multithread_func
     71 from acts.test_utils.tel.tel_test_utils import num_active_calls
     72 from acts.test_utils.tel.tel_test_utils import phone_number_formatter
     73 from acts.test_utils.tel.tel_test_utils import run_multithread_func
     74 from acts.test_utils.tel.tel_test_utils import set_call_state_listen_level
     75 from acts.test_utils.tel.tel_test_utils import set_phone_number
     76 from acts.test_utils.tel.tel_test_utils import set_wfc_mode
     77 from acts.test_utils.tel.tel_test_utils import setup_sim
     78 from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode
     79 from acts.test_utils.tel.tel_test_utils import verify_http_connection
     80 from acts.test_utils.tel.tel_test_utils import verify_incall_state
     81 from acts.test_utils.tel.tel_test_utils import wait_for_cell_data_connection
     82 from acts.test_utils.tel.tel_test_utils import wait_for_ringing_call
     83 from acts.test_utils.tel.tel_test_utils import wait_for_not_network_rat
     84 from acts.test_utils.tel.tel_test_utils import wifi_toggle_state
     85 from acts.test_utils.tel.tel_test_utils import start_adb_tcpdump
     86 from acts.test_utils.tel.tel_test_utils import stop_adb_tcpdump
     87 from acts.test_utils.tel.tel_test_utils import set_wifi_to_default
     88 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_1x
     89 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_2g
     90 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_3g
     91 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb
     92 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan
     93 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_not_iwlan
     94 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_wcdma
     95 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_volte
     96 from acts.test_utils.tel.tel_voice_utils import phone_setup_csfb
     97 from acts.test_utils.tel.tel_voice_utils import phone_setup_iwlan
     98 from acts.test_utils.tel.tel_voice_utils import \
     99     phone_setup_iwlan_cellular_preferred
    100 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_2g
    101 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_3g
    102 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_general
    103 from acts.test_utils.tel.tel_voice_utils import phone_setup_volte
    104 from acts.test_utils.tel.tel_voice_utils import phone_idle_2g
    105 from acts.test_utils.tel.tel_voice_utils import phone_idle_3g
    106 from acts.test_utils.tel.tel_voice_utils import phone_idle_csfb
    107 from acts.test_utils.tel.tel_voice_utils import phone_idle_iwlan
    108 from acts.test_utils.tel.tel_voice_utils import phone_idle_volte
    109 from acts.test_utils.tel.tel_voice_utils import two_phone_call_leave_voice_mail
    110 from acts.test_utils.tel.tel_voice_utils import two_phone_call_long_seq
    111 from acts.test_utils.tel.tel_voice_utils import two_phone_call_short_seq
    112 
    113 DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION = 1 * 60 * 60  # default value 1 hour
    114 DEFAULT_PING_DURATION = 120  # in seconds
    115 
    116 
    117 class TelLiveVoiceTest(TelephonyBaseTest):
    118     def __init__(self, controllers):
    119         TelephonyBaseTest.__init__(self, controllers)
    120 
    121         self.stress_test_number = self.get_stress_test_number()
    122         self.wifi_network_ssid = self.user_params["wifi_network_ssid"]
    123         self.wifi_network_pass = self.user_params.get("wifi_network_pass")
    124         self.long_duration_call_total_duration = self.user_params.get(
    125             "long_duration_call_total_duration",
    126             DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION)
    127 
    128     """ Tests Begin """
    129 
    130     @TelephonyBaseTest.tel_test_wrap
    131     @test_tracker_info(uuid="8036004e-e42e-441f-b32d-96069be71ec2")
    132     def test_call_mo_voice_general(self):
    133         """ General voice to voice call.
    134 
    135         1. Make Sure PhoneA attached to voice network.
    136         2. Make Sure PhoneB attached to voice network.
    137         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    138         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    139 
    140         Returns:
    141             True if pass; False if fail.
    142         """
    143         ads = self.android_devices
    144 
    145         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
    146                  (phone_setup_voice_general, (self.log, ads[1]))]
    147         if not multithread_func(self.log, tasks):
    148             self.log.error("Phone Failed to Set Up Properly.")
    149             return False
    150 
    151         return two_phone_call_short_seq(self.log, ads[0], None, None, ads[1],
    152                                         None, None)
    153 
    154     @TelephonyBaseTest.tel_test_wrap
    155     @test_tracker_info(uuid="448e1597-c28f-4e1d-88fd-3158e6b7c630")
    156     def test_call_mt_voice_general(self):
    157         """ General voice to voice call.
    158 
    159         1. Make Sure PhoneA attached to voice network.
    160         2. Make Sure PhoneB attached to voice network.
    161         3. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
    162         4. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
    163 
    164         Returns:
    165             True if pass; False if fail.
    166         """
    167         ads = self.android_devices
    168 
    169         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
    170                  (phone_setup_voice_general, (self.log, ads[1]))]
    171         if not multithread_func(self.log, tasks):
    172             self.log.error("Phone Failed to Set Up Properly.")
    173             return False
    174 
    175         return two_phone_call_short_seq(self.log, ads[1], None, None, ads[0],
    176                                         None, None)
    177 
    178     @test_tracker_info(uuid="b2de097b-70e1-4242-b555-c1aa0a5acd8c")
    179     @TelephonyBaseTest.tel_test_wrap
    180     def test_call_volte_to_volte(self):
    181         """ VoLTE to VoLTE call test
    182 
    183         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    184         2. Make Sure PhoneB is in LTE mode (with VoLTE).
    185         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    186         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    187 
    188         Returns:
    189             True if pass; False if fail.
    190         """
    191         ads = self.android_devices
    192 
    193         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
    194                                                            (self.log, ads[1]))]
    195         if not multithread_func(self.log, tasks):
    196             self.log.error("Phone Failed to Set Up Properly.")
    197             return False
    198 
    199         return two_phone_call_short_seq(
    200             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    201             phone_idle_volte, is_phone_in_call_volte, None,
    202             WAIT_TIME_IN_CALL_FOR_IMS)
    203 
    204     @test_tracker_info(uuid="3c7f5a09-0177-4469-9994-cd5e7dd7c7fe")
    205     @TelephonyBaseTest.tel_test_wrap
    206     def test_call_volte_to_volte_7_digit_dialing(self):
    207         """ VoLTE to VoLTE call test, dial with 7 digit number
    208 
    209         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    210         2. Make Sure PhoneB is in LTE mode (with VoLTE).
    211         3. Call from PhoneA to PhoneB by 7-digit phone number, accept on PhoneB.
    212 
    213         Returns:
    214             True if pass; False if fail.
    215         """
    216         ads = self.android_devices
    217 
    218         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
    219                                                            (self.log, ads[1]))]
    220         if not multithread_func(self.log, tasks):
    221             self.log.error("Phone Failed to Set Up Properly.")
    222             return False
    223 
    224         callee_default_number = get_phone_number(self.log, ads[1])
    225         caller_dialing_number = phone_number_formatter(callee_default_number,
    226                                                        7)
    227         try:
    228             set_phone_number(self.log, ads[1], caller_dialing_number)
    229             return call_setup_teardown(
    230                 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte,
    231                 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS)
    232         except Exception as e:
    233             self.log.error("Exception happened: {}".format(e))
    234         finally:
    235             set_phone_number(self.log, ads[1], callee_default_number)
    236 
    237     @test_tracker_info(uuid="721ef935-a03c-4d0f-85b9-4753d857162f")
    238     @TelephonyBaseTest.tel_test_wrap
    239     def test_call_volte_to_volte_10_digit_dialing(self):
    240         """ VoLTE to VoLTE call test, dial with 10 digit number
    241 
    242         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    243         2. Make Sure PhoneB is in LTE mode (with VoLTE).
    244         3. Call from PhoneA to PhoneB by 10-digit phone number, accept on PhoneB.
    245 
    246         Returns:
    247             True if pass; False if fail.
    248         """
    249         ads = self.android_devices
    250 
    251         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
    252                                                            (self.log, ads[1]))]
    253         if not multithread_func(self.log, tasks):
    254             self.log.error("Phone Failed to Set Up Properly.")
    255             return False
    256 
    257         callee_default_number = get_phone_number(self.log, ads[1])
    258         caller_dialing_number = phone_number_formatter(callee_default_number,
    259                                                        10)
    260         try:
    261             set_phone_number(self.log, ads[1], caller_dialing_number)
    262             return call_setup_teardown(
    263                 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte,
    264                 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS)
    265         except Exception as e:
    266             self.log.error("Exception happened: {}".format(e))
    267         finally:
    268             set_phone_number(self.log, ads[1], callee_default_number)
    269 
    270     @test_tracker_info(uuid="4fd3aa62-2398-4cee-994e-7fc5cadbcbc1")
    271     @TelephonyBaseTest.tel_test_wrap
    272     def test_call_volte_to_volte_11_digit_dialing(self):
    273         """ VoLTE to VoLTE call test, dial with 11 digit number
    274 
    275         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    276         2. Make Sure PhoneB is in LTE mode (with VoLTE).
    277         3. Call from PhoneA to PhoneB by 11-digit phone number, accept on PhoneB.
    278 
    279         Returns:
    280             True if pass; False if fail.
    281         """
    282         ads = self.android_devices
    283 
    284         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
    285                                                            (self.log, ads[1]))]
    286         if not multithread_func(self.log, tasks):
    287             self.log.error("Phone Failed to Set Up Properly.")
    288             return False
    289 
    290         callee_default_number = get_phone_number(self.log, ads[1])
    291         caller_dialing_number = phone_number_formatter(callee_default_number,
    292                                                        11)
    293         try:
    294             set_phone_number(self.log, ads[1], caller_dialing_number)
    295             return call_setup_teardown(
    296                 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte,
    297                 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS)
    298         except Exception as e:
    299             self.log.error("Exception happened: {}".format(e))
    300         finally:
    301             set_phone_number(self.log, ads[1], callee_default_number)
    302 
    303     @test_tracker_info(uuid="969abdac-6a57-442a-9c40-48199bd8d556")
    304     @TelephonyBaseTest.tel_test_wrap
    305     def test_call_volte_to_volte_12_digit_dialing(self):
    306         """ VoLTE to VoLTE call test, dial with 12 digit number
    307 
    308         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    309         2. Make Sure PhoneB is in LTE mode (with VoLTE).
    310         3. Call from PhoneA to PhoneB by 12-digit phone number, accept on PhoneB.
    311 
    312         Returns:
    313             True if pass; False if fail.
    314         """
    315         ads = self.android_devices
    316 
    317         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
    318                                                            (self.log, ads[1]))]
    319         if not multithread_func(self.log, tasks):
    320             self.log.error("Phone Failed to Set Up Properly.")
    321             return False
    322 
    323         callee_default_number = get_phone_number(self.log, ads[1])
    324         caller_dialing_number = phone_number_formatter(callee_default_number,
    325                                                        12)
    326         try:
    327             set_phone_number(self.log, ads[1], caller_dialing_number)
    328             return call_setup_teardown(
    329                 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte,
    330                 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS)
    331         except Exception as e:
    332             self.log.error("Exception happened: {}".format(e))
    333         finally:
    334             set_phone_number(self.log, ads[1], callee_default_number)
    335 
    336     @test_tracker_info(uuid="6b13a03d-c9ff-43d7-9798-adbead7688a4")
    337     @TelephonyBaseTest.tel_test_wrap
    338     def test_call_volte_to_csfb_3g(self):
    339         """ VoLTE to CSFB 3G call test
    340 
    341         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    342         2. Make Sure PhoneB is in LTE mode (without VoLTE).
    343         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    344         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    345 
    346         Returns:
    347             True if pass; False if fail.
    348         """
    349         ads = self.android_devices
    350 
    351         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb,
    352                                                            (self.log, ads[1]))]
    353         if not multithread_func(self.log, tasks):
    354             self.log.error("Phone Failed to Set Up Properly.")
    355             return False
    356 
    357         return two_phone_call_short_seq(
    358             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    359             phone_idle_csfb, is_phone_in_call_csfb, None)
    360 
    361     @test_tracker_info(uuid="38096fdb-324a-4ce0-8836-8bbe713cffc2")
    362     @TelephonyBaseTest.tel_test_wrap
    363     def test_call_volte_to_csfb_for_tmo(self):
    364         """ VoLTE to CSFB 3G call test for TMobile
    365 
    366         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    367         2. Make Sure PhoneB is in LTE mode (without VoLTE, CSFB to WCDMA/GSM).
    368         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    369         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    370 
    371         Returns:
    372             True if pass; False if fail.
    373         """
    374         ads = self.android_devices
    375 
    376         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb,
    377                                                            (self.log, ads[1]))]
    378         if not multithread_func(self.log, tasks):
    379             self.log.error("Phone Failed to Set Up Properly.")
    380             return False
    381 
    382         return two_phone_call_short_seq(self.log, ads[0], phone_idle_volte,
    383                                         None, ads[1], phone_idle_csfb,
    384                                         is_phone_in_call_csfb, None)
    385 
    386     @test_tracker_info(uuid="82f9515d-a52b-4dec-93a5-997ffdbca76c")
    387     @TelephonyBaseTest.tel_test_wrap
    388     def test_call_volte_to_csfb_1x_long(self):
    389         """ VoLTE to CSFB 1x call test
    390 
    391         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    392         2. Make Sure PhoneB is in LTE mode (without VoLTE, CSFB to 1x).
    393         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    394         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    395         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
    396         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
    397 
    398         Returns:
    399             True if pass; False if fail.
    400         """
    401         ads = self.android_devices
    402         # Make Sure PhoneB is CDMA phone.
    403         if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA:
    404             self.log.error(
    405                 "PhoneB not cdma phone, can not csfb 1x. Stop test.")
    406             return False
    407 
    408         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb,
    409                                                            (self.log, ads[1]))]
    410         if not multithread_func(self.log, tasks):
    411             self.log.error("Phone Failed to Set Up Properly.")
    412             return False
    413 
    414         return two_phone_call_long_seq(
    415             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    416             phone_idle_csfb, is_phone_in_call_1x, None)
    417 
    418     @test_tracker_info(uuid="2e57fad6-5eaf-4e7d-8353-8aa6f4c52776")
    419     @TelephonyBaseTest.tel_test_wrap
    420     def test_call_volte_to_csfb_long(self):
    421         """ VoLTE to CSFB WCDMA call test
    422 
    423         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    424         2. Make Sure PhoneB is in LTE mode (without VoLTE, CSFB to WCDMA/GSM).
    425         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    426         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    427         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
    428         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
    429 
    430         Returns:
    431             True if pass; False if fail.
    432         """
    433         ads = self.android_devices
    434         # Make Sure PhoneB is GSM phone.
    435         if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM:
    436             self.log.error(
    437                 "PhoneB not gsm phone, can not csfb wcdma. Stop test.")
    438             return False
    439 
    440         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb,
    441                                                            (self.log, ads[1]))]
    442         if not multithread_func(self.log, tasks):
    443             self.log.error("Phone Failed to Set Up Properly.")
    444             return False
    445 
    446         return two_phone_call_long_seq(
    447             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    448             phone_idle_csfb, is_phone_in_call_csfb, None)
    449 
    450     @test_tracker_info(uuid="4bab759f-7610-4cec-893c-0a8aed95f70c")
    451     @TelephonyBaseTest.tel_test_wrap
    452     def test_call_volte_to_3g(self):
    453         """ VoLTE to 3G call test
    454 
    455         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    456         2. Make Sure PhoneB is in 3G mode.
    457         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    458         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    459 
    460         Returns:
    461             True if pass; False if fail.
    462         """
    463         ads = self.android_devices
    464 
    465         tasks = [(phone_setup_volte, (self.log, ads[0])),
    466                  (phone_setup_voice_3g, (self.log, ads[1]))]
    467         if not multithread_func(self.log, tasks):
    468             self.log.error("Phone Failed to Set Up Properly.")
    469             return False
    470 
    471         return two_phone_call_short_seq(
    472             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    473             phone_idle_3g, is_phone_in_call_3g, None)
    474 
    475     @test_tracker_info(uuid="b394cdc5-d88d-4659-8a26-0e58fde69974")
    476     @TelephonyBaseTest.tel_test_wrap
    477     def test_call_volte_to_3g_1x_long(self):
    478         """ VoLTE to 3G 1x call test
    479 
    480         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    481         2. Make Sure PhoneB is in 3G 1x mode.
    482         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    483         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    484         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
    485         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
    486 
    487         Returns:
    488             True if pass; False if fail.
    489         """
    490         ads = self.android_devices
    491         # Make Sure PhoneB is CDMA phone.
    492         if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA:
    493             self.log.error("PhoneB not cdma phone, can not 3g 1x. Stop test.")
    494             return False
    495 
    496         tasks = [(phone_setup_volte, (self.log, ads[0])),
    497                  (phone_setup_voice_3g, (self.log, ads[1]))]
    498         if not multithread_func(self.log, tasks):
    499             self.log.error("Phone Failed to Set Up Properly.")
    500             return False
    501 
    502         return two_phone_call_long_seq(
    503             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    504             phone_idle_3g, is_phone_in_call_1x, None)
    505 
    506     @test_tracker_info(uuid="b39a74a9-2a89-4c0b-ac4e-71ed9317bd75")
    507     @TelephonyBaseTest.tel_test_wrap
    508     def test_call_volte_to_3g_wcdma_long(self):
    509         """ VoLTE to 3G WCDMA call test
    510 
    511         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    512         2. Make Sure PhoneB is in 3G WCDMA mode.
    513         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    514         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    515         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
    516         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
    517 
    518         Returns:
    519             True if pass; False if fail.
    520         """
    521         ads = self.android_devices
    522         # Make Sure PhoneB is GSM phone.
    523         if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM:
    524             self.log.error(
    525                 "PhoneB not gsm phone, can not 3g wcdma. Stop test.")
    526             return False
    527 
    528         tasks = [(phone_setup_volte, (self.log, ads[0])),
    529                  (phone_setup_voice_3g, (self.log, ads[1]))]
    530         if not multithread_func(self.log, tasks):
    531             self.log.error("Phone Failed to Set Up Properly.")
    532             return False
    533 
    534         return two_phone_call_long_seq(
    535             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    536             phone_idle_3g, is_phone_in_call_wcdma, None)
    537 
    538     @test_tracker_info(uuid="573bbcf1-6cbd-4084-9cb7-e14fb6c9521e")
    539     @TelephonyBaseTest.tel_test_wrap
    540     def test_call_volte_to_2g(self):
    541         """ VoLTE to 2G call test
    542 
    543         1. Make Sure PhoneA is in LTE mode (with VoLTE).
    544         2. Make Sure PhoneB is in 2G mode.
    545         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    546         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    547 
    548         Returns:
    549             True if pass; False if fail.
    550         """
    551         ads = self.android_devices
    552 
    553         tasks = [(phone_setup_volte, (self.log, ads[0])),
    554                  (phone_setup_voice_2g, (self.log, ads[1]))]
    555         if not multithread_func(self.log, tasks):
    556             self.log.error("Phone Failed to Set Up Properly.")
    557             return False
    558 
    559         return two_phone_call_short_seq(
    560             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
    561             phone_idle_2g, is_phone_in_call_2g, None)
    562 
    563     def _call_epdg_to_epdg_wfc(self, ads, apm_mode, wfc_mode, wifi_ssid,
    564                                wifi_pwd):
    565         """ Test epdg<->epdg call functionality.
    566 
    567         Make Sure PhoneA is set to make epdg call.
    568         Make Sure PhoneB is set to make epdg call.
    569         Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    570         Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    571 
    572         Args:
    573             ads: list of android objects, this list should have two ad.
    574             apm_mode: phones' airplane mode.
    575                 if True, phones are in airplane mode during test.
    576                 if False, phones are not in airplane mode during test.
    577             wfc_mode: phones' wfc mode.
    578                 Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED,
    579                 WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED.
    580             wifi_ssid: WiFi ssid to connect during test.
    581             wifi_pwd: WiFi password.
    582 
    583         Returns:
    584             True if pass; False if fail.
    585         """
    586         try:
    587             (tcpdump_pid, tcpdump_file) = \
    588                                       start_adb_tcpdump(ads[0], self.test_name)
    589             tasks = [(phone_setup_iwlan, (self.log, ads[0], apm_mode, wfc_mode,
    590                                           wifi_ssid, wifi_pwd)),
    591                      (phone_setup_iwlan, (self.log, ads[1], apm_mode, wfc_mode,
    592                                           wifi_ssid, wifi_pwd))]
    593             if not multithread_func(self.log, tasks):
    594                 self.log.error("Phone Failed to Set Up Properly.")
    595                 return False
    596 
    597             ad_ping = ads[0]
    598 
    599             call_task = (two_phone_call_short_seq, (
    600                 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan,
    601                 ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None,
    602                 WAIT_TIME_IN_CALL_FOR_IMS))
    603             ping_task = (adb_shell_ping, (ad_ping, DEFAULT_PING_DURATION))
    604 
    605             results = run_multithread_func(self.log, [ping_task, call_task])
    606 
    607             if not results[1]:
    608                 self.log.error("Call setup failed in active ICMP transfer.")
    609                 return False
    610             if results[0]:
    611                 self.log.info(
    612                     "ICMP transfer succeeded with parallel phone call.")
    613                 return True
    614             else:
    615                 self.log.error(
    616                     "ICMP transfer failed with parallel phone call.")
    617                 return False
    618         finally:
    619             if tcpdump_pid is not None:
    620                 stop_adb_tcpdump(ads[0], tcpdump_pid, tcpdump_file)
    621 
    622     @test_tracker_info(uuid="a4a043c0-f4ba-4405-9262-42c752cc4487")
    623     @TelephonyBaseTest.tel_test_wrap
    624     def test_call_epdg_to_epdg_wfc_wifi_only(self):
    625         """ WiFi Only, WiFi calling to WiFi Calling test
    626 
    627         1. Setup PhoneA WFC mode: WIFI_ONLY.
    628         2. Setup PhoneB WFC mode: WIFI_ONLY.
    629         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    630         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    631 
    632         Returns:
    633             True if pass; False if fail.
    634         """
    635         return self._call_epdg_to_epdg_wfc(
    636             self.android_devices, False, WFC_MODE_WIFI_ONLY,
    637             self.wifi_network_ssid, self.wifi_network_pass)
    638 
    639     @test_tracker_info(uuid="ae171d58-d4c1-43f7-aa93-4860b4b28d53")
    640     @TelephonyBaseTest.tel_test_wrap
    641     def test_call_epdg_to_epdg_wfc_wifi_preferred(self):
    642         """ WiFi Preferred, WiFi calling to WiFi Calling test
    643 
    644         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
    645         2. Setup PhoneB WFC mode: WIFI_PREFERRED.
    646         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    647         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    648 
    649         Returns:
    650             True if pass; False if fail.
    651         """
    652         return self._call_epdg_to_epdg_wfc(
    653             self.android_devices, False, WFC_MODE_WIFI_PREFERRED,
    654             self.wifi_network_ssid, self.wifi_network_pass)
    655 
    656     @test_tracker_info(uuid="ece58857-fedc-49a9-bf10-b76bd78a51f2")
    657     @TelephonyBaseTest.tel_test_wrap
    658     def test_call_epdg_to_epdg_wfc_cellular_preferred(self):
    659         """ Cellular Preferred, WiFi calling to WiFi Calling test
    660 
    661         1. Setup PhoneA WFC mode: CELLULAR_PREFERRED.
    662         2. Setup PhoneB WFC mode: CELLULAR_PREFERRED.
    663         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    664         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    665 
    666         Returns:
    667             True if pass; False if fail.
    668         """
    669         ads = [self.android_devices[0], self.android_devices[1]]
    670         tasks = [(phone_setup_iwlan_cellular_preferred, (
    671             self.log, ads[0], self.wifi_network_ssid, self.wifi_network_pass)),
    672                  (phone_setup_iwlan_cellular_preferred,
    673                   (self.log, ads[1], self.wifi_network_ssid,
    674                    self.wifi_network_pass))]
    675         if not multithread_func(self.log, tasks):
    676             self.log.error("Phone Failed to Set Up Properly.")
    677             return False
    678 
    679         return two_phone_call_short_seq(
    680             self.log, ads[0], None, is_phone_in_call_not_iwlan, ads[1], None,
    681             is_phone_in_call_not_iwlan, None, WAIT_TIME_IN_CALL_FOR_IMS)
    682 
    683     @test_tracker_info(uuid="0d63c250-d9e7-490c-8c48-0a6afbad5f88")
    684     @TelephonyBaseTest.tel_test_wrap
    685     def test_call_epdg_to_epdg_apm_wfc_wifi_only(self):
    686         """ Airplane + WiFi Only, WiFi calling to WiFi Calling test
    687 
    688         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
    689         2. Setup PhoneB in airplane mode, WFC mode: WIFI_ONLY.
    690         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    691         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    692 
    693         Returns:
    694             True if pass; False if fail.
    695         """
    696         return self._call_epdg_to_epdg_wfc(
    697             self.android_devices, True, WFC_MODE_WIFI_ONLY,
    698             self.wifi_network_ssid, self.wifi_network_pass)
    699 
    700     @test_tracker_info(uuid="7678e4ee-29c6-4319-93ab-d555501d1876")
    701     @TelephonyBaseTest.tel_test_wrap
    702     def test_call_epdg_to_epdg_apm_wfc_wifi_preferred(self):
    703         """ Airplane + WiFi Preferred, WiFi calling to WiFi Calling test
    704 
    705         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
    706         2. Setup PhoneB in airplane mode, WFC mode: WIFI_PREFERRED.
    707         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    708         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    709 
    710         Returns:
    711             True if pass; False if fail.
    712         """
    713         return self._call_epdg_to_epdg_wfc(
    714             self.android_devices, True, WFC_MODE_WIFI_PREFERRED,
    715             self.wifi_network_ssid, self.wifi_network_pass)
    716 
    717     @test_tracker_info(uuid="8f5c637e-683a-448d-9443-b2b39626ab19")
    718     @TelephonyBaseTest.tel_test_wrap
    719     def test_call_epdg_to_epdg_apm_wfc_cellular_preferred(self):
    720         """ Airplane + Cellular Preferred, WiFi calling to WiFi Calling test
    721 
    722         1. Setup PhoneA in airplane mode, WFC mode: CELLULAR_PREFERRED.
    723         2. Setup PhoneB in airplane mode, WFC mode: CELLULAR_PREFERRED.
    724         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    725         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    726 
    727         Returns:
    728             True if pass; False if fail.
    729         """
    730         return self._call_epdg_to_epdg_wfc(
    731             self.android_devices, True, WFC_MODE_CELLULAR_PREFERRED,
    732             self.wifi_network_ssid, self.wifi_network_pass)
    733 
    734     @test_tracker_info(uuid="0b51666e-c83c-40b5-ba0f-737e64bc82a2")
    735     @TelephonyBaseTest.tel_test_wrap
    736     def test_call_epdg_to_volte_wfc_wifi_only(self):
    737         """ WiFi Only, WiFi calling to VoLTE test
    738 
    739         1. Setup PhoneA WFC mode: WIFI_ONLY.
    740         2. Make Sure PhoneB is in LTE mode (with VoLTE enabled).
    741         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    742         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    743 
    744         Returns:
    745             True if pass; False if fail.
    746         """
    747         ads = self.android_devices
    748 
    749         tasks = [(phone_setup_iwlan,
    750                   (self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
    751                    self.wifi_network_ssid, self.wifi_network_pass)),
    752                  (phone_setup_volte, (self.log, ads[1]))]
    753         if not multithread_func(self.log, tasks):
    754             self.log.error("Phone Failed to Set Up Properly.")
    755             return False
    756 
    757         return two_phone_call_short_seq(
    758             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    759             phone_idle_volte, is_phone_in_call_volte, None,
    760             WAIT_TIME_IN_CALL_FOR_IMS)
    761 
    762     @test_tracker_info(uuid="6e0630a9-63b2-4ea1-8ec9-6560f001905c")
    763     @TelephonyBaseTest.tel_test_wrap
    764     def test_call_epdg_to_volte_wfc_wifi_preferred(self):
    765         """ WiFi Preferred, WiFi calling to VoLTE test
    766 
    767         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
    768         2. Make Sure PhoneB is in LTE mode (with VoLTE enabled).
    769         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    770         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    771 
    772         Returns:
    773             True if pass; False if fail.
    774         """
    775         ads = self.android_devices
    776 
    777         tasks = [(phone_setup_iwlan,
    778                   (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
    779                    self.wifi_network_ssid, self.wifi_network_pass)),
    780                  (phone_setup_volte, (self.log, ads[1]))]
    781         if not multithread_func(self.log, tasks):
    782             self.log.error("Phone Failed to Set Up Properly.")
    783             return False
    784 
    785         return two_phone_call_short_seq(
    786             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    787             phone_idle_volte, is_phone_in_call_volte, None,
    788             WAIT_TIME_IN_CALL_FOR_IMS)
    789 
    790     @test_tracker_info(uuid="51077985-2229-491f-9a54-1ff53871758c")
    791     @TelephonyBaseTest.tel_test_wrap
    792     def test_call_epdg_to_volte_apm_wfc_wifi_only(self):
    793         """ Airplane + WiFi Only, WiFi calling to VoLTE test
    794 
    795         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
    796         2. Make Sure PhoneB is in LTE mode (with VoLTE enabled).
    797         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    798         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    799 
    800         Returns:
    801             True if pass; False if fail.
    802         """
    803         ads = self.android_devices
    804 
    805         tasks = [(phone_setup_iwlan,
    806                   (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
    807                    self.wifi_network_ssid, self.wifi_network_pass)),
    808                  (phone_setup_volte, (self.log, ads[1]))]
    809         if not multithread_func(self.log, tasks):
    810             self.log.error("Phone Failed to Set Up Properly.")
    811             return False
    812 
    813         return two_phone_call_short_seq(
    814             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    815             phone_idle_volte, is_phone_in_call_volte, None,
    816             WAIT_TIME_IN_CALL_FOR_IMS)
    817 
    818     @test_tracker_info(uuid="fff9edcd-1ace-4f2d-a09b-06f3eea56cca")
    819     @TelephonyBaseTest.tel_test_wrap
    820     def test_call_epdg_to_volte_apm_wfc_wifi_preferred(self):
    821         """ Airplane + WiFi Preferred, WiFi calling to VoLTE test
    822 
    823         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
    824         2. Make Sure PhoneB is in LTE mode (with VoLTE enabled).
    825         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    826         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    827 
    828         Returns:
    829             True if pass; False if fail.
    830         """
    831         ads = self.android_devices
    832 
    833         tasks = [(phone_setup_iwlan,
    834                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
    835                    self.wifi_network_ssid, self.wifi_network_pass)),
    836                  (phone_setup_volte, (self.log, ads[1]))]
    837         if not multithread_func(self.log, tasks):
    838             self.log.error("Phone Failed to Set Up Properly.")
    839             return False
    840 
    841         return two_phone_call_short_seq(
    842             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    843             phone_idle_volte, is_phone_in_call_volte, None,
    844             WAIT_TIME_IN_CALL_FOR_IMS)
    845 
    846     @test_tracker_info(uuid="8591554e-4e38-406c-97bf-8921d5329c47")
    847     @TelephonyBaseTest.tel_test_wrap
    848     def test_call_epdg_to_csfb_3g_wfc_wifi_only(self):
    849         """ WiFi Only, WiFi calling to CSFB 3G test
    850 
    851         1. Setup PhoneA WFC mode: WIFI_ONLY.
    852         2. Make Sure PhoneB is in LTE mode (with VoLTE disabled).
    853         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    854         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    855 
    856         Returns:
    857             True if pass; False if fail.
    858         """
    859         ads = self.android_devices
    860         # Turn OFF WiFi for Phone B
    861         set_wifi_to_default(self.log, ads[1])
    862         tasks = [(phone_setup_iwlan,
    863                   (self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
    864                    self.wifi_network_ssid, self.wifi_network_pass)),
    865                  (phone_setup_csfb, (self.log, ads[1]))]
    866         if not multithread_func(self.log, tasks):
    867             self.log.error("Phone Failed to Set Up Properly.")
    868             return False
    869 
    870         return two_phone_call_short_seq(
    871             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    872             phone_idle_csfb, is_phone_in_call_csfb, None)
    873 
    874     @test_tracker_info(uuid="9711888d-5b1e-4d05-86e9-98f94f46098b")
    875     @TelephonyBaseTest.tel_test_wrap
    876     def test_call_epdg_to_csfb_3g_wfc_wifi_preferred(self):
    877         """ WiFi Preferred, WiFi calling to CSFB 3G test
    878 
    879         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
    880         2. Make Sure PhoneB is in LTE mode (with VoLTE disabled).
    881         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    882         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    883 
    884         Returns:
    885             True if pass; False if fail.
    886         """
    887         ads = self.android_devices
    888         # Turn OFF WiFi for Phone B
    889         set_wifi_to_default(self.log, ads[1])
    890         tasks = [(phone_setup_iwlan,
    891                   (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
    892                    self.wifi_network_ssid, self.wifi_network_pass)),
    893                  (phone_setup_csfb, (self.log, ads[1]))]
    894         if not multithread_func(self.log, tasks):
    895             self.log.error("Phone Failed to Set Up Properly.")
    896             return False
    897 
    898         return two_phone_call_short_seq(
    899             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    900             phone_idle_csfb, is_phone_in_call_csfb, None)
    901 
    902     @test_tracker_info(uuid="902c96a4-858f-43ff-bd56-6d7d27004320")
    903     @TelephonyBaseTest.tel_test_wrap
    904     def test_call_epdg_to_csfb_3g_apm_wfc_wifi_only(self):
    905         """ Airplane + WiFi Only, WiFi calling to CSFB 3G test
    906 
    907         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
    908         2. Make Sure PhoneB is in LTE mode (with VoLTE disabled).
    909         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    910         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    911 
    912         Returns:
    913             True if pass; False if fail.
    914         """
    915         ads = self.android_devices
    916         # Turn OFF WiFi for Phone B
    917         set_wifi_to_default(self.log, ads[1])
    918         tasks = [(phone_setup_iwlan,
    919                   (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
    920                    self.wifi_network_ssid, self.wifi_network_pass)),
    921                  (phone_setup_csfb, (self.log, ads[1]))]
    922         if not multithread_func(self.log, tasks):
    923             self.log.error("Phone Failed to Set Up Properly.")
    924             return False
    925 
    926         return two_phone_call_short_seq(
    927             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    928             phone_idle_csfb, is_phone_in_call_csfb, None)
    929 
    930     @test_tracker_info(uuid="362a5396-ebda-4706-a73a-d805e5028fd7")
    931     @TelephonyBaseTest.tel_test_wrap
    932     def test_call_epdg_to_csfb_3g_apm_wfc_wifi_preferred(self):
    933         """ Airplane + WiFi Preferred, WiFi calling to CSFB 3G test
    934 
    935         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
    936         2. Make Sure PhoneB is in LTE mode (with VoLTE disabled).
    937         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    938         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    939 
    940         Returns:
    941             True if pass; False if fail.
    942         """
    943         ads = self.android_devices
    944         # Turn OFF WiFi for Phone B
    945         set_wifi_to_default(self.log, ads[1])
    946         tasks = [(phone_setup_iwlan,
    947                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
    948                    self.wifi_network_ssid, self.wifi_network_pass)),
    949                  (phone_setup_csfb, (self.log, ads[1]))]
    950         if not multithread_func(self.log, tasks):
    951             self.log.error("Phone Failed to Set Up Properly.")
    952             return False
    953 
    954         return two_phone_call_short_seq(
    955             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    956             phone_idle_csfb, is_phone_in_call_csfb, None)
    957 
    958     @test_tracker_info(uuid="647bb859-46bc-4e3e-b6ab-7944d3bbcc26")
    959     @TelephonyBaseTest.tel_test_wrap
    960     def test_call_epdg_to_3g_wfc_wifi_only(self):
    961         """ WiFi Only, WiFi calling to 3G test
    962 
    963         1. Setup PhoneA WFC mode: WIFI_ONLY.
    964         2. Make Sure PhoneB is in 3G mode.
    965         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    966         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    967 
    968         Returns:
    969             True if pass; False if fail.
    970         """
    971         ads = self.android_devices
    972         # Turn OFF WiFi for Phone B
    973         set_wifi_to_default(self.log, ads[1])
    974         tasks = [(phone_setup_iwlan,
    975                   (self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
    976                    self.wifi_network_ssid, self.wifi_network_pass)),
    977                  (phone_setup_voice_3g, (self.log, ads[1]))]
    978         if not multithread_func(self.log, tasks):
    979             self.log.error("Phone Failed to Set Up Properly.")
    980             return False
    981 
    982         return two_phone_call_short_seq(
    983             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
    984             phone_idle_3g, is_phone_in_call_3g, None)
    985 
    986     @test_tracker_info(uuid="3688ea1f-a52d-4a35-9df4-d5ed0985e49b")
    987     @TelephonyBaseTest.tel_test_wrap
    988     def test_call_epdg_to_3g_wfc_wifi_preferred(self):
    989         """ WiFi Preferred, WiFi calling to 3G test
    990 
    991         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
    992         2. Make Sure PhoneB is in 3G mode.
    993         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
    994         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
    995 
    996         Returns:
    997             True if pass; False if fail.
    998         """
    999         ads = self.android_devices
   1000         # Turn OFF WiFi for Phone B
   1001         set_wifi_to_default(self.log, ads[1])
   1002         tasks = [(phone_setup_iwlan,
   1003                   (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
   1004                    self.wifi_network_ssid, self.wifi_network_pass)),
   1005                  (phone_setup_voice_3g, (self.log, ads[1]))]
   1006         if not multithread_func(self.log, tasks):
   1007             self.log.error("Phone Failed to Set Up Properly.")
   1008             return False
   1009 
   1010         return two_phone_call_short_seq(
   1011             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
   1012             phone_idle_3g, is_phone_in_call_3g, None)
   1013 
   1014     @test_tracker_info(uuid="f4efc821-fbaf-4ec2-b89b-5a47354344f0")
   1015     @TelephonyBaseTest.tel_test_wrap
   1016     def test_call_epdg_to_3g_apm_wfc_wifi_only(self):
   1017         """ Airplane + WiFi Only, WiFi calling to 3G test
   1018 
   1019         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
   1020         2. Make Sure PhoneB is in 3G mode.
   1021         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1022         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1023 
   1024         Returns:
   1025             True if pass; False if fail.
   1026         """
   1027         ads = self.android_devices
   1028         # Turn OFF WiFi for Phone B
   1029         set_wifi_to_default(self.log, ads[1])
   1030         tasks = [(phone_setup_iwlan,
   1031                   (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
   1032                    self.wifi_network_ssid, self.wifi_network_pass)),
   1033                  (phone_setup_voice_3g, (self.log, ads[1]))]
   1034         if not multithread_func(self.log, tasks):
   1035             self.log.error("Phone Failed to Set Up Properly.")
   1036             return False
   1037 
   1038         return two_phone_call_short_seq(
   1039             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
   1040             phone_idle_3g, is_phone_in_call_3g, None)
   1041 
   1042     @test_tracker_info(uuid="2b1345b7-3b62-44bd-91ad-9c5a4925b0e1")
   1043     @TelephonyBaseTest.tel_test_wrap
   1044     def test_call_epdg_to_3g_apm_wfc_wifi_preferred(self):
   1045         """ Airplane + WiFi Preferred, WiFi calling to 3G test
   1046 
   1047         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
   1048         2. Make Sure PhoneB is in 3G mode.
   1049         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1050         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1051 
   1052         Returns:
   1053             True if pass; False if fail.
   1054         """
   1055         ads = self.android_devices
   1056         # Turn OFF WiFi for Phone B
   1057         set_wifi_to_default(self.log, ads[1])
   1058         tasks = [(phone_setup_iwlan,
   1059                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
   1060                    self.wifi_network_ssid, self.wifi_network_pass)),
   1061                  (phone_setup_voice_3g, (self.log, ads[1]))]
   1062         if not multithread_func(self.log, tasks):
   1063             self.log.error("Phone Failed to Set Up Properly.")
   1064             return False
   1065 
   1066         return two_phone_call_short_seq(
   1067             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
   1068             phone_idle_3g, is_phone_in_call_3g, None)
   1069 
   1070     @test_tracker_info(uuid="7b3fea22-114a-442e-aa12-dde3b6001681")
   1071     @TelephonyBaseTest.tel_test_wrap
   1072     def test_call_csfb_3g_to_csfb_3g(self):
   1073         """ CSFB 3G to CSFB 3G call test
   1074 
   1075         1. Make Sure PhoneA is in LTE mode, VoLTE disabled.
   1076         2. Make Sure PhoneB is in LTE mode, VoLTE disabled.
   1077         3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA.
   1078         4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB.
   1079 
   1080         Returns:
   1081             True if pass; False if fail.
   1082         """
   1083         ads = self.android_devices
   1084         # Turn OFF WiFi for Phone B
   1085         set_wifi_to_default(self.log, ads[1])
   1086         tasks = [(phone_setup_csfb, (self.log, ads[0])), (phone_setup_csfb,
   1087                                                           (self.log, ads[1]))]
   1088         if not multithread_func(self.log, tasks):
   1089             self.log.error("Phone Failed to Set Up Properly.")
   1090             return False
   1091 
   1092         return two_phone_call_short_seq(
   1093             self.log, ads[0], phone_idle_csfb, is_phone_in_call_csfb, ads[1],
   1094             phone_idle_csfb, is_phone_in_call_csfb, None)
   1095 
   1096     @test_tracker_info(uuid="91d751ea-40c8-4ffc-b9d3-03d0ad0902bd")
   1097     @TelephonyBaseTest.tel_test_wrap
   1098     def test_call_3g_to_3g(self):
   1099         """ 3G to 3G call test
   1100 
   1101         1. Make Sure PhoneA is in 3G mode.
   1102         2. Make Sure PhoneB is in 3G mode.
   1103         3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA.
   1104         4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB.
   1105 
   1106         Returns:
   1107             True if pass; False if fail.
   1108         """
   1109         ads = self.android_devices
   1110         # Turn OFF WiFi for Phone B
   1111         set_wifi_to_default(self.log, ads[1])
   1112         tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
   1113                  (phone_setup_voice_3g, (self.log, ads[1]))]
   1114         if not multithread_func(self.log, tasks):
   1115             self.log.error("Phone Failed to Set Up Properly.")
   1116             return False
   1117 
   1118         return two_phone_call_short_seq(
   1119             self.log, ads[0], phone_idle_3g, is_phone_in_call_3g, ads[1],
   1120             phone_idle_3g, is_phone_in_call_3g, None)
   1121 
   1122     @test_tracker_info(uuid="df57c481-010a-4d21-a5c1-5116917871b2")
   1123     @TelephonyBaseTest.tel_test_wrap
   1124     def test_call_volte_to_volte_long(self):
   1125         """ VoLTE to VoLTE call test
   1126 
   1127         1. Make Sure PhoneA is in LTE mode (with VoLTE).
   1128         2. Make Sure PhoneB is in LTE mode (with VoLTE).
   1129         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1130         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1131         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1132         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1133 
   1134         Returns:
   1135             True if pass; False if fail.
   1136         """
   1137         ads = self.android_devices
   1138 
   1139         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
   1140                                                            (self.log, ads[1]))]
   1141         if not multithread_func(self.log, tasks):
   1142             self.log.error("Phone Failed to Set Up Properly.")
   1143             return False
   1144 
   1145         return two_phone_call_long_seq(
   1146             self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
   1147             phone_idle_volte, is_phone_in_call_volte, None,
   1148             WAIT_TIME_IN_CALL_FOR_IMS)
   1149 
   1150     @test_tracker_info(uuid="b0712d8a-71cf-405f-910c-8592da082660")
   1151     @TelephonyBaseTest.tel_test_wrap
   1152     def test_call_epdg_to_epdg_long_wfc_wifi_only(self):
   1153         """ WiFi Only, WiFi calling to WiFi Calling test
   1154 
   1155         1. Setup PhoneA WFC mode: WIFI_ONLY.
   1156         2. Setup PhoneB WFC mode: WIFI_ONLY.
   1157         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1158         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1159         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1160         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1161 
   1162         Returns:
   1163             True if pass; False if fail.
   1164         """
   1165         ads = self.android_devices
   1166 
   1167         tasks = [(phone_setup_iwlan,
   1168                   (self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
   1169                    self.wifi_network_ssid, self.wifi_network_pass)),
   1170                  (phone_setup_iwlan,
   1171                   (self.log, ads[1], False, WFC_MODE_WIFI_ONLY,
   1172                    self.wifi_network_ssid, self.wifi_network_pass))]
   1173         if not multithread_func(self.log, tasks):
   1174             self.log.error("Phone Failed to Set Up Properly.")
   1175             return False
   1176 
   1177         return two_phone_call_long_seq(
   1178             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
   1179             phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1180             WAIT_TIME_IN_CALL_FOR_IMS)
   1181 
   1182     @test_tracker_info(uuid="7049de19-3abf-48df-868f-18d0af829393")
   1183     @TelephonyBaseTest.tel_test_wrap
   1184     def test_call_epdg_to_epdg_long_wfc_wifi_preferred(self):
   1185         """ WiFi Preferred, WiFi calling to WiFi Calling test
   1186 
   1187         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
   1188         2. Setup PhoneB WFC mode: WIFI_PREFERRED.
   1189         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1190         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1191         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1192         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1193 
   1194         Returns:
   1195             True if pass; False if fail.
   1196         """
   1197         ads = self.android_devices
   1198 
   1199         tasks = [(phone_setup_iwlan,
   1200                   (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
   1201                    self.wifi_network_ssid, self.wifi_network_pass)),
   1202                  (phone_setup_iwlan,
   1203                   (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED,
   1204                    self.wifi_network_ssid, self.wifi_network_pass))]
   1205         if not multithread_func(self.log, tasks):
   1206             self.log.error("Phone Failed to Set Up Properly.")
   1207             return False
   1208 
   1209         return two_phone_call_long_seq(
   1210             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
   1211             phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1212             WAIT_TIME_IN_CALL_FOR_IMS)
   1213 
   1214     @test_tracker_info(uuid="029af2a7-aba4-406b-9095-b32da57a7cdb")
   1215     @TelephonyBaseTest.tel_test_wrap
   1216     def test_call_epdg_to_epdg_long_apm_wfc_wifi_only(self):
   1217         """ Airplane + WiFi Only, WiFi calling to WiFi Calling test
   1218 
   1219         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
   1220         2. Setup PhoneB in airplane mode, WFC mode: WIFI_ONLY.
   1221         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1222         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1223         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1224         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1225 
   1226         Returns:
   1227             True if pass; False if fail.
   1228         """
   1229         ads = self.android_devices
   1230 
   1231         tasks = [(phone_setup_iwlan,
   1232                   (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
   1233                    self.wifi_network_ssid, self.wifi_network_pass)),
   1234                  (phone_setup_iwlan,
   1235                   (self.log, ads[1], True, WFC_MODE_WIFI_ONLY,
   1236                    self.wifi_network_ssid, self.wifi_network_pass))]
   1237         if not multithread_func(self.log, tasks):
   1238             self.log.error("Phone Failed to Set Up Properly.")
   1239             return False
   1240 
   1241         return two_phone_call_long_seq(
   1242             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
   1243             phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1244             WAIT_TIME_IN_CALL_FOR_IMS)
   1245 
   1246     @test_tracker_info(uuid="2b926e4a-f493-41fa-98af-20d25ec132bb")
   1247     @TelephonyBaseTest.tel_test_wrap
   1248     def test_call_epdg_to_epdg_long_apm_wfc_wifi_preferred(self):
   1249         """ Airplane + WiFi Preferred, WiFi calling to WiFi Calling test
   1250 
   1251         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
   1252         2. Setup PhoneB in airplane mode, WFC mode: WIFI_PREFERRED.
   1253         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1254         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1255         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1256         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1257 
   1258         Returns:
   1259             True if pass; False if fail.
   1260         """
   1261         ads = self.android_devices
   1262 
   1263         tasks = [(phone_setup_iwlan,
   1264                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
   1265                    self.wifi_network_ssid, self.wifi_network_pass)),
   1266                  (phone_setup_iwlan,
   1267                   (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED,
   1268                    self.wifi_network_ssid, self.wifi_network_pass))]
   1269         if not multithread_func(self.log, tasks):
   1270             self.log.error("Phone Failed to Set Up Properly.")
   1271             return False
   1272 
   1273         return two_phone_call_long_seq(
   1274             self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
   1275             phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1276             WAIT_TIME_IN_CALL_FOR_IMS)
   1277 
   1278     @test_tracker_info(uuid="30d5d573-043f-4d8b-98e0-e7f7bc9b8d6f")
   1279     @TelephonyBaseTest.tel_test_wrap
   1280     def test_call_csfb_3g_to_csfb_3g_long(self):
   1281         """ CSFB 3G to CSFB 3G call test
   1282 
   1283         1. Make Sure PhoneA is in LTE mode, VoLTE disabled.
   1284         2. Make Sure PhoneB is in LTE mode, VoLTE disabled.
   1285         3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA.
   1286         4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB.
   1287         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1288         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1289 
   1290         Returns:
   1291             True if pass; False if fail.
   1292         """
   1293         ads = self.android_devices
   1294         # Turn OFF WiFi for Phone B
   1295         set_wifi_to_default(self.log, ads[1])
   1296         tasks = [(phone_setup_csfb, (self.log, ads[0])), (phone_setup_csfb,
   1297                                                           (self.log, ads[1]))]
   1298         if not multithread_func(self.log, tasks):
   1299             self.log.error("Phone Failed to Set Up Properly.")
   1300             return False
   1301 
   1302         return two_phone_call_long_seq(
   1303             self.log, ads[0], phone_idle_csfb, is_phone_in_call_csfb, ads[1],
   1304             phone_idle_csfb, is_phone_in_call_csfb, None)
   1305 
   1306     @test_tracker_info(uuid="54768178-818f-4126-9e50-4f49e43a6fd3")
   1307     @TelephonyBaseTest.tel_test_wrap
   1308     def test_call_3g_to_3g_long(self):
   1309         """ 3G to 3G call test
   1310 
   1311         1. Make Sure PhoneA is in 3G mode.
   1312         2. Make Sure PhoneB is in 3G mode.
   1313         3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA.
   1314         4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB.
   1315         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1316         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1317 
   1318         Returns:
   1319             True if pass; False if fail.
   1320         """
   1321         ads = self.android_devices
   1322         # Turn OFF WiFi for Phone B
   1323         set_wifi_to_default(self.log, ads[1])
   1324         tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
   1325                  (phone_setup_voice_3g, (self.log, ads[1]))]
   1326         if not multithread_func(self.log, tasks):
   1327             self.log.error("Phone Failed to Set Up Properly.")
   1328             return False
   1329 
   1330         return two_phone_call_long_seq(
   1331             self.log, ads[0], phone_idle_3g, is_phone_in_call_3g, ads[1],
   1332             phone_idle_3g, is_phone_in_call_3g, None)
   1333 
   1334     @test_tracker_info(uuid="")
   1335     @TelephonyBaseTest.tel_test_wrap
   1336     def test_call_volte_to_volte_loop(self):
   1337         """ Stress test: VoLTE to VoLTE call test
   1338 
   1339         1. Make Sure PhoneA is in LTE mode (with VoLTE).
   1340         2. Make Sure PhoneB is in LTE mode (with VoLTE).
   1341         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1342         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1343         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1344         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1345         7. Repeat step 3~6.
   1346 
   1347         Returns:
   1348             True if pass; False if fail.
   1349         """
   1350 
   1351         # TODO: b/26338422 Make this a parameter
   1352         MINIMUM_SUCCESS_RATE = .95
   1353         ads = self.android_devices
   1354 
   1355         tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
   1356                                                            (self.log, ads[1]))]
   1357         if not multithread_func(self.log, tasks):
   1358             self.log.error("Phone Failed to Set Up Properly.")
   1359             return False
   1360 
   1361         success_count = 0
   1362         fail_count = 0
   1363 
   1364         for i in range(1, self.stress_test_number + 1):
   1365 
   1366             if two_phone_call_long_seq(
   1367                     self.log, ads[0], phone_idle_volte, is_phone_in_call_volte,
   1368                     ads[1], phone_idle_volte, is_phone_in_call_volte, None,
   1369                     WAIT_TIME_IN_CALL_FOR_IMS):
   1370                 success_count += 1
   1371                 result_str = "Succeeded"
   1372 
   1373             else:
   1374                 fail_count += 1
   1375                 result_str = "Failed"
   1376 
   1377             self.log.info("Iteration {} {}. Current: {} / {} passed.".format(
   1378                 i, result_str, success_count, self.stress_test_number))
   1379 
   1380         self.log.info("Final Count - Success: {}, Failure: {} - {}%".format(
   1381             success_count, fail_count,
   1382             str(100 * success_count / (success_count + fail_count))))
   1383         if success_count / (success_count + fail_count
   1384                             ) >= MINIMUM_SUCCESS_RATE:
   1385             return True
   1386         else:
   1387             return False
   1388 
   1389     @test_tracker_info(uuid="dfa2c1a7-0e9a-42f2-b3ba-7e196df87e1b")
   1390     @TelephonyBaseTest.tel_test_wrap
   1391     def test_call_epdg_to_epdg_loop_wfc_wifi_only(self):
   1392         """ Stress test: WiFi Only, WiFi calling to WiFi Calling test
   1393 
   1394         1. Setup PhoneA WFC mode: WIFI_ONLY.
   1395         2. Setup PhoneB WFC mode: WIFI_ONLY.
   1396         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1397         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1398         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1399         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1400         7. Repeat step 3~6.
   1401 
   1402         Returns:
   1403             True if pass; False if fail.
   1404         """
   1405 
   1406         # TODO: b/26338422 Make this a parameter
   1407         MINIMUM_SUCCESS_RATE = .95
   1408         ads = self.android_devices
   1409 
   1410         tasks = [(phone_setup_iwlan,
   1411                   (self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
   1412                    self.wifi_network_ssid, self.wifi_network_pass)),
   1413                  (phone_setup_iwlan,
   1414                   (self.log, ads[1], False, WFC_MODE_WIFI_ONLY,
   1415                    self.wifi_network_ssid, self.wifi_network_pass))]
   1416         if not multithread_func(self.log, tasks):
   1417             self.log.error("Phone Failed to Set Up Properly.")
   1418             return False
   1419 
   1420         success_count = 0
   1421         fail_count = 0
   1422 
   1423         for i in range(1, self.stress_test_number + 1):
   1424 
   1425             if two_phone_call_long_seq(
   1426                     self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan,
   1427                     ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1428                     WAIT_TIME_IN_CALL_FOR_IMS):
   1429                 success_count += 1
   1430                 result_str = "Succeeded"
   1431 
   1432             else:
   1433                 fail_count += 1
   1434                 result_str = "Failed"
   1435 
   1436             self.log.info("Iteration {} {}. Current: {} / {} passed.".format(
   1437                 i, result_str, success_count, self.stress_test_number))
   1438 
   1439         self.log.info("Final Count - Success: {}, Failure: {} - {}%".format(
   1440             success_count, fail_count,
   1441             str(100 * success_count / (success_count + fail_count))))
   1442         if success_count / (success_count + fail_count
   1443                             ) >= MINIMUM_SUCCESS_RATE:
   1444             return True
   1445         else:
   1446             return False
   1447 
   1448     @test_tracker_info(uuid="382f97ad-65d4-4ebb-a31b-aa243e01bce4")
   1449     @TelephonyBaseTest.tel_test_wrap
   1450     def test_call_epdg_to_epdg_loop_wfc_wifi_preferred(self):
   1451         """ Stress test: WiFi Preferred, WiFi Calling to WiFi Calling test
   1452 
   1453         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
   1454         2. Setup PhoneB WFC mode: WIFI_PREFERRED.
   1455         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1456         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1457         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1458         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1459         7. Repeat step 3~6.
   1460 
   1461         Returns:
   1462             True if pass; False if fail.
   1463         """
   1464 
   1465         # TODO: b/26338422 Make this a parameter
   1466         MINIMUM_SUCCESS_RATE = .95
   1467         ads = self.android_devices
   1468 
   1469         tasks = [(phone_setup_iwlan,
   1470                   (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
   1471                    self.wifi_network_ssid, self.wifi_network_pass)),
   1472                  (phone_setup_iwlan,
   1473                   (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED,
   1474                    self.wifi_network_ssid, self.wifi_network_pass))]
   1475         if not multithread_func(self.log, tasks):
   1476             self.log.error("Phone Failed to Set Up Properly.")
   1477             return False
   1478 
   1479         success_count = 0
   1480         fail_count = 0
   1481 
   1482         for i in range(1, self.stress_test_number + 1):
   1483 
   1484             if two_phone_call_long_seq(
   1485                     self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan,
   1486                     ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1487                     WAIT_TIME_IN_CALL_FOR_IMS):
   1488                 success_count += 1
   1489                 result_str = "Succeeded"
   1490 
   1491             else:
   1492                 fail_count += 1
   1493                 result_str = "Failed"
   1494 
   1495             self.log.info("Iteration {} {}. Current: {} / {} passed.".format(
   1496                 i, result_str, success_count, self.stress_test_number))
   1497 
   1498         self.log.info("Final Count - Success: {}, Failure: {} - {}%".format(
   1499             success_count, fail_count,
   1500             str(100 * success_count / (success_count + fail_count))))
   1501         if success_count / (success_count + fail_count
   1502                             ) >= MINIMUM_SUCCESS_RATE:
   1503             return True
   1504         else:
   1505             return False
   1506 
   1507     @test_tracker_info(uuid="c820e2ea-8a14-421c-b608-9074b716f7dd")
   1508     @TelephonyBaseTest.tel_test_wrap
   1509     def test_call_epdg_to_epdg_loop_apm_wfc_wifi_only(self):
   1510         """ Stress test: Airplane + WiFi Only, WiFi Calling to WiFi Calling test
   1511 
   1512         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
   1513         2. Setup PhoneB in airplane mode, WFC mode: WIFI_ONLY.
   1514         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1515         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1516         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1517         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1518         7. Repeat step 3~6.
   1519 
   1520         Returns:
   1521             True if pass; False if fail.
   1522         """
   1523 
   1524         # TODO: b/26338422 Make this a parameter
   1525         MINIMUM_SUCCESS_RATE = .95
   1526         ads = self.android_devices
   1527 
   1528         tasks = [(phone_setup_iwlan,
   1529                   (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
   1530                    self.wifi_network_ssid, self.wifi_network_pass)),
   1531                  (phone_setup_iwlan,
   1532                   (self.log, ads[1], True, WFC_MODE_WIFI_ONLY,
   1533                    self.wifi_network_ssid, self.wifi_network_pass))]
   1534         if not multithread_func(self.log, tasks):
   1535             self.log.error("Phone Failed to Set Up Properly.")
   1536             return False
   1537 
   1538         success_count = 0
   1539         fail_count = 0
   1540 
   1541         for i in range(1, self.stress_test_number + 1):
   1542 
   1543             if two_phone_call_long_seq(
   1544                     self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan,
   1545                     ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1546                     WAIT_TIME_IN_CALL_FOR_IMS):
   1547                 success_count += 1
   1548                 result_str = "Succeeded"
   1549 
   1550             else:
   1551                 fail_count += 1
   1552                 result_str = "Failed"
   1553 
   1554             self.log.info("Iteration {} {}. Current: {} / {} passed.".format(
   1555                 i, result_str, success_count, self.stress_test_number))
   1556 
   1557         self.log.info("Final Count - Success: {}, Failure: {} - {}%".format(
   1558             success_count, fail_count,
   1559             str(100 * success_count / (success_count + fail_count))))
   1560         if success_count / (success_count + fail_count
   1561                             ) >= MINIMUM_SUCCESS_RATE:
   1562             return True
   1563         else:
   1564             return False
   1565 
   1566     @test_tracker_info(uuid="3b8cb344-1551-4244-845d-b864501f2fb4")
   1567     @TelephonyBaseTest.tel_test_wrap
   1568     def test_call_epdg_to_epdg_loop_apm_wfc_wifi_preferred(self):
   1569         """ Stress test: Airplane + WiFi Preferred, WiFi Calling to WiFi Calling test
   1570 
   1571         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
   1572         2. Setup PhoneB in airplane mode, WFC mode: WIFI_PREFERRED.
   1573         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1574         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1575         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1576         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1577         7. Repeat step 3~6.
   1578 
   1579         Returns:
   1580             True if pass; False if fail.
   1581         """
   1582 
   1583         # TODO: b/26338422 Make this a parameter
   1584         MINIMUM_SUCCESS_RATE = .95
   1585         ads = self.android_devices
   1586 
   1587         tasks = [(phone_setup_iwlan,
   1588                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
   1589                    self.wifi_network_ssid, self.wifi_network_pass)),
   1590                  (phone_setup_iwlan,
   1591                   (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED,
   1592                    self.wifi_network_ssid, self.wifi_network_pass))]
   1593         if not multithread_func(self.log, tasks):
   1594             self.log.error("Phone Failed to Set Up Properly.")
   1595             return False
   1596 
   1597         success_count = 0
   1598         fail_count = 0
   1599 
   1600         for i in range(1, self.stress_test_number + 1):
   1601 
   1602             if two_phone_call_long_seq(
   1603                     self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan,
   1604                     ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None,
   1605                     WAIT_TIME_IN_CALL_FOR_IMS):
   1606                 success_count += 1
   1607                 result_str = "Succeeded"
   1608 
   1609             else:
   1610                 fail_count += 1
   1611                 result_str = "Failed"
   1612 
   1613             self.log.info("Iteration {} {}. Current: {} / {} passed.".format(
   1614                 i, result_str, success_count, self.stress_test_number))
   1615 
   1616         self.log.info("Final Count - Success: {}, Failure: {} - {}%".format(
   1617             success_count, fail_count,
   1618             str(100 * success_count / (success_count + fail_count))))
   1619         if success_count / (success_count + fail_count
   1620                             ) >= MINIMUM_SUCCESS_RATE:
   1621             return True
   1622         else:
   1623             return False
   1624 
   1625     @test_tracker_info(uuid="")
   1626     @TelephonyBaseTest.tel_test_wrap
   1627     def test_call_csfb_3g_to_csfb_3g_loop(self):
   1628         """ Stress test: CSFB 3G to CSFB 3G call test
   1629 
   1630         1. Make Sure PhoneA is in LTE mode, VoLTE disabled.
   1631         2. Make Sure PhoneB is in LTE mode, VoLTE disabled.
   1632         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1633         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1634         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1635         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1636         7. Repeat step 3~6.
   1637 
   1638         Returns:
   1639             True if pass; False if fail.
   1640         """
   1641 
   1642         # TODO: b/26338422 Make this a parameter
   1643         MINIMUM_SUCCESS_RATE = .95
   1644         ads = self.android_devices
   1645 
   1646         tasks = [(phone_setup_csfb, (self.log, ads[0])), (phone_setup_csfb,
   1647                                                           (self.log, ads[1]))]
   1648         if not multithread_func(self.log, tasks):
   1649             self.log.error("Phone Failed to Set Up Properly.")
   1650             return False
   1651 
   1652         success_count = 0
   1653         fail_count = 0
   1654 
   1655         for i in range(1, self.stress_test_number + 1):
   1656 
   1657             if two_phone_call_long_seq(
   1658                     self.log, ads[0], phone_idle_csfb, is_phone_in_call_csfb,
   1659                     ads[1], phone_idle_csfb, is_phone_in_call_csfb, None):
   1660                 success_count += 1
   1661                 result_str = "Succeeded"
   1662 
   1663             else:
   1664                 fail_count += 1
   1665                 result_str = "Failed"
   1666 
   1667             self.log.info("Iteration {} {}. Current: {} / {} passed.".format(
   1668                 i, result_str, success_count, self.stress_test_number))
   1669 
   1670         self.log.info("Final Count - Success: {}, Failure: {}".format(
   1671             success_count, fail_count))
   1672         if success_count / (success_count + fail_count
   1673                             ) >= MINIMUM_SUCCESS_RATE:
   1674             return True
   1675         else:
   1676             return False
   1677 
   1678     @test_tracker_info(uuid="")
   1679     @TelephonyBaseTest.tel_test_wrap
   1680     def test_call_3g_to_3g_loop(self):
   1681         """ Stress test: 3G to 3G call test
   1682 
   1683         1. Make Sure PhoneA is in 3G mode
   1684         2. Make Sure PhoneB is in 3G mode
   1685         3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   1686         4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   1687         5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   1688         6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   1689         7. Repeat step 3~6.
   1690 
   1691         Returns:
   1692             True if pass; False if fail.
   1693         """
   1694 
   1695         # TODO: b/26338422 Make this a parameter
   1696         MINIMUM_SUCCESS_RATE = .95
   1697         ads = self.android_devices
   1698 
   1699         tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
   1700                  (phone_setup_voice_3g, (self.log, ads[1]))]
   1701         if not multithread_func(self.log, tasks):
   1702             self.log.error("Phone Failed to Set Up Properly.")
   1703             return False
   1704 
   1705         success_count = 0
   1706         fail_count = 0
   1707 
   1708         for i in range(1, self.stress_test_number + 1):
   1709 
   1710             if two_phone_call_long_seq(
   1711                     self.log, ads[0], phone_idle_3g, is_phone_in_call_3g,
   1712                     ads[1], phone_idle_3g, is_phone_in_call_3g, None):
   1713                 success_count += 1
   1714                 result_str = "Succeeded"
   1715 
   1716             else:
   1717                 fail_count += 1
   1718                 result_str = "Failed"
   1719 
   1720             self.log.info("Iteration {} {}. Current: {} / {} passed.".format(
   1721                 i, result_str, success_count, self.stress_test_number))
   1722 
   1723         self.log.info("Final Count - Success: {}, Failure: {}".format(
   1724             success_count, fail_count))
   1725         if success_count / (success_count + fail_count
   1726                             ) >= MINIMUM_SUCCESS_RATE:
   1727             return True
   1728         else:
   1729             return False
   1730 
   1731     def _hold_unhold_test(self, ads):
   1732         """ Test hold/unhold functionality.
   1733 
   1734         PhoneA is in call with PhoneB. The call on PhoneA is active.
   1735         Get call list on PhoneA.
   1736         Hold call_id on PhoneA.
   1737         Check call_id state.
   1738         Unhold call_id on PhoneA.
   1739         Check call_id state.
   1740 
   1741         Args:
   1742             ads: List of android objects.
   1743                 This list should contain 2 android objects.
   1744                 ads[0] is the ad to do hold/unhold operation.
   1745 
   1746         Returns:
   1747             True if pass; False if fail.
   1748         """
   1749         call_list = ads[0].droid.telecomCallGetCallIds()
   1750         self.log.info("Calls in PhoneA{}".format(call_list))
   1751         if num_active_calls(self.log, ads[0]) != 1:
   1752             return False
   1753         call_id = call_list[0]
   1754 
   1755         if ads[0].droid.telecomCallGetCallState(call_id) != CALL_STATE_ACTIVE:
   1756             self.log.error(
   1757                 "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
   1758                     call_id, ads[0].droid.telecomCallGetCallState(call_id)))
   1759             return False
   1760         # TODO: b/26296375 add voice check.
   1761 
   1762         self.log.info("Hold call_id {} on PhoneA".format(call_id))
   1763         ads[0].droid.telecomCallHold(call_id)
   1764         time.sleep(WAIT_TIME_IN_CALL)
   1765         if ads[0].droid.telecomCallGetCallState(call_id) != CALL_STATE_HOLDING:
   1766             self.log.error(
   1767                 "Call_id:{}, state:{}, expected: STATE_HOLDING".format(
   1768                     call_id, ads[0].droid.telecomCallGetCallState(call_id)))
   1769             return False
   1770         # TODO: b/26296375 add voice check.
   1771 
   1772         self.log.info("Unhold call_id {} on PhoneA".format(call_id))
   1773         ads[0].droid.telecomCallUnhold(call_id)
   1774         time.sleep(WAIT_TIME_IN_CALL)
   1775         if ads[0].droid.telecomCallGetCallState(call_id) != CALL_STATE_ACTIVE:
   1776             self.log.error(
   1777                 "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
   1778                     call_id, ads[0].droid.telecomCallGetCallState(call_id)))
   1779             return False
   1780         # TODO: b/26296375 add voice check.
   1781 
   1782         if not verify_incall_state(self.log, [ads[0], ads[1]], True):
   1783             self.log.error("Caller/Callee dropped call.")
   1784             return False
   1785 
   1786         return True
   1787 
   1788     @test_tracker_info(uuid="4043c68a-c5d4-4e1d-9010-ef65b205cab1")
   1789     @TelephonyBaseTest.tel_test_wrap
   1790     def test_call_epdg_mo_hold_unhold_wfc_wifi_only(self):
   1791         """ WiFi Only, WiFi calling MO call hold/unhold test
   1792 
   1793         1. Setup PhoneA WFC mode: WIFI_ONLY.
   1794         2. Make sure PhoneB can make/receive voice call.
   1795         3. Call from PhoneA to PhoneB, accept on PhoneB.
   1796         4. Hold and unhold on PhoneA.
   1797 
   1798         Returns:
   1799             True if pass; False if fail.
   1800         """
   1801         ads = self.android_devices
   1802 
   1803         tasks = [(phone_setup_iwlan,
   1804                   (self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
   1805                    self.wifi_network_ssid, self.wifi_network_pass)),
   1806                  (phone_setup_voice_general, (self.log, ads[1]))]
   1807         if not multithread_func(self.log, tasks):
   1808             self.log.error("Phone Failed to Set Up Properly.")
   1809             return False
   1810 
   1811         ads[0].droid.telecomCallClearCallList()
   1812         if num_active_calls(self.log, ads[0]) != 0:
   1813             self.log.error("Phone {} Call List is not empty."
   1814                            .format(ads[0].serial))
   1815             return False
   1816 
   1817         self.log.info("Begin MO Call Hold/Unhold Test.")
   1818         if not call_setup_teardown(
   1819                 self.log,
   1820                 ads[0],
   1821                 ads[1],
   1822                 ad_hangup=None,
   1823                 verify_caller_func=is_phone_in_call_iwlan,
   1824                 verify_callee_func=None):
   1825             return False
   1826 
   1827         if not self._hold_unhold_test(ads):
   1828             self.log.error("Hold/Unhold test fail.")
   1829             return False
   1830 
   1831         return True
   1832 
   1833     @test_tracker_info(uuid="0667535e-dcad-49f0-9b4b-fa45d6c75f5b")
   1834     @TelephonyBaseTest.tel_test_wrap
   1835     def test_call_epdg_mo_hold_unhold_wfc_wifi_preferred(self):
   1836         """ WiFi Preferred, WiFi calling MO call hold/unhold test
   1837 
   1838         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
   1839         2. Make sure PhoneB can make/receive voice call.
   1840         3. Call from PhoneA to PhoneB, accept on PhoneB.
   1841         4. Hold and unhold on PhoneA.
   1842 
   1843         Returns:
   1844             True if pass; False if fail.
   1845         """
   1846         ads = self.android_devices
   1847 
   1848         tasks = [(phone_setup_iwlan,
   1849                   (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
   1850                    self.wifi_network_ssid, self.wifi_network_pass)),
   1851                  (phone_setup_voice_general, (self.log, ads[1]))]
   1852         if not multithread_func(self.log, tasks):
   1853             self.log.error("Phone Failed to Set Up Properly.")
   1854             return False
   1855 
   1856         ads[0].droid.telecomCallClearCallList()
   1857         if num_active_calls(self.log, ads[0]) != 0:
   1858             self.log.error("Phone {} Call List is not empty."
   1859                            .format(ads[0].serial))
   1860             return False
   1861 
   1862         self.log.info("Begin MO Call Hold/Unhold Test.")
   1863         if not call_setup_teardown(
   1864                 self.log,
   1865                 ads[0],
   1866                 ads[1],
   1867                 ad_hangup=None,
   1868                 verify_caller_func=is_phone_in_call_iwlan,
   1869                 verify_callee_func=None):
   1870             return False
   1871 
   1872         if not self._hold_unhold_test(ads):
   1873             self.log.error("Hold/Unhold test fail.")
   1874             return False
   1875 
   1876         return True
   1877 
   1878     @test_tracker_info(uuid="cf318b4c-c920-4e80-b73f-2f092c03a144")
   1879     @TelephonyBaseTest.tel_test_wrap
   1880     def test_call_epdg_mo_hold_unhold_apm_wfc_wifi_only(self):
   1881         """ Airplane + WiFi Only, WiFi calling MO call hold/unhold test
   1882 
   1883         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
   1884         2. Make sure PhoneB can make/receive voice call.
   1885         3. Call from PhoneA to PhoneB, accept on PhoneB.
   1886         4. Hold and unhold on PhoneA.
   1887 
   1888         Returns:
   1889             True if pass; False if fail.
   1890         """
   1891         ads = self.android_devices
   1892 
   1893         tasks = [(phone_setup_iwlan,
   1894                   (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
   1895                    self.wifi_network_ssid, self.wifi_network_pass)),
   1896                  (phone_setup_voice_general, (self.log, ads[1]))]
   1897         if not multithread_func(self.log, tasks):
   1898             self.log.error("Phone Failed to Set Up Properly.")
   1899             return False
   1900 
   1901         ads[0].droid.telecomCallClearCallList()
   1902         if num_active_calls(self.log, ads[0]) != 0:
   1903             self.log.error("Phone {} Call List is not empty."
   1904                            .format(ads[0].serial))
   1905             return False
   1906 
   1907         self.log.info("Begin MO Call Hold/Unhold Test.")
   1908         if not call_setup_teardown(
   1909                 self.log,
   1910                 ads[0],
   1911                 ads[1],
   1912                 ad_hangup=None,
   1913                 verify_caller_func=is_phone_in_call_iwlan,
   1914                 verify_callee_func=None):
   1915             return False
   1916 
   1917         if not self._hold_unhold_test(ads):
   1918             self.log.error("Hold/Unhold test fail.")
   1919             return False
   1920 
   1921         return True
   1922 
   1923     @test_tracker_info(uuid="ace36801-1e7b-4f06-aa0b-17affc8df069")
   1924     @TelephonyBaseTest.tel_test_wrap
   1925     def test_call_epdg_mo_hold_unhold_apm_wfc_wifi_preferred(self):
   1926         """ Airplane + WiFi Preferred, WiFi calling MO call hold/unhold test
   1927 
   1928         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
   1929         2. Make sure PhoneB can make/receive voice call.
   1930         3. Call from PhoneA to PhoneB, accept on PhoneB.
   1931         4. Hold and unhold on PhoneA.
   1932 
   1933         Returns:
   1934             True if pass; False if fail.
   1935         """
   1936         ads = self.android_devices
   1937 
   1938         tasks = [(phone_setup_iwlan,
   1939                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
   1940                    self.wifi_network_ssid, self.wifi_network_pass)),
   1941                  (phone_setup_voice_general, (self.log, ads[1]))]
   1942         if not multithread_func(self.log, tasks):
   1943             self.log.error("Phone Failed to Set Up Properly.")
   1944             return False
   1945 
   1946         ads[0].droid.telecomCallClearCallList()
   1947         if num_active_calls(self.log, ads[0]) != 0:
   1948             self.log.error("Phone {} Call List is not empty."
   1949                            .format(ads[0].serial))
   1950             return False
   1951 
   1952         self.log.info("Begin MO Call Hold/Unhold Test.")
   1953         if not call_setup_teardown(
   1954                 self.log,
   1955                 ads[0],
   1956                 ads[1],
   1957                 ad_hangup=None,
   1958                 verify_caller_func=is_phone_in_call_iwlan,
   1959                 verify_callee_func=None):
   1960             return False
   1961 
   1962         if not self._hold_unhold_test(ads):
   1963             self.log.error("Hold/Unhold test fail.")
   1964             return False
   1965 
   1966         return True
   1967 
   1968     @test_tracker_info(uuid="2ad32874-0d39-4475-8ae3-d6dccda675f5")
   1969     @TelephonyBaseTest.tel_test_wrap
   1970     def test_call_epdg_mt_hold_unhold_wfc_wifi_only(self):
   1971         """ WiFi Only, WiFi calling MT call hold/unhold test
   1972 
   1973         1. Setup PhoneA WFC mode: WIFI_ONLY.
   1974         2. Make sure PhoneB can make/receive voice call.
   1975         3. Call from PhoneB to PhoneA, accept on PhoneA.
   1976         4. Hold and unhold on PhoneA.
   1977 
   1978         Returns:
   1979             True if pass; False if fail.
   1980         """
   1981         ads = self.android_devices
   1982 
   1983         tasks = [(phone_setup_iwlan,
   1984                   (self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
   1985                    self.wifi_network_ssid, self.wifi_network_pass)),
   1986                  (phone_setup_voice_general, (self.log, ads[1]))]
   1987         if not multithread_func(self.log, tasks):
   1988             self.log.error("Phone Failed to Set Up Properly.")
   1989             return False
   1990 
   1991         ads[0].droid.telecomCallClearCallList()
   1992         if num_active_calls(self.log, ads[0]) != 0:
   1993             self.log.error("Phone {} Call List is not empty."
   1994                            .format(ads[0].serial))
   1995             return False
   1996 
   1997         self.log.info("Begin MT Call Hold/Unhold Test.")
   1998         if not call_setup_teardown(
   1999                 self.log,
   2000                 ads[1],
   2001                 ads[0],
   2002                 ad_hangup=None,
   2003                 verify_caller_func=None,
   2004                 verify_callee_func=is_phone_in_call_iwlan):
   2005             return False
   2006 
   2007         if not self._hold_unhold_test(ads):
   2008             self.log.error("Hold/Unhold test fail.")
   2009             return False
   2010 
   2011         return True
   2012 
   2013     @test_tracker_info(uuid="3efd5d59-30ee-45f5-8966-56ce8fadf9a1")
   2014     @TelephonyBaseTest.tel_test_wrap
   2015     def test_call_epdg_mt_hold_unhold_wfc_wifi_preferred(self):
   2016         """ WiFi Preferred, WiFi calling MT call hold/unhold test
   2017 
   2018         1. Setup PhoneA WFC mode: WIFI_PREFERRED.
   2019         2. Make sure PhoneB can make/receive voice call.
   2020         3. Call from PhoneB to PhoneA, accept on PhoneA.
   2021         4. Hold and unhold on PhoneA.
   2022 
   2023         Returns:
   2024             True if pass; False if fail.
   2025         """
   2026         ads = self.android_devices
   2027 
   2028         tasks = [(phone_setup_iwlan,
   2029                   (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
   2030                    self.wifi_network_ssid, self.wifi_network_pass)),
   2031                  (phone_setup_voice_general, (self.log, ads[1]))]
   2032         if not multithread_func(self.log, tasks):
   2033             self.log.error("Phone Failed to Set Up Properly.")
   2034             return False
   2035 
   2036         ads[0].droid.telecomCallClearCallList()
   2037         if num_active_calls(self.log, ads[0]) != 0:
   2038             self.log.error("Phone {} Call List is not empty."
   2039                            .format(ads[0].serial))
   2040             return False
   2041 
   2042         self.log.info("Begin MT Call Hold/Unhold Test.")
   2043         if not call_setup_teardown(
   2044                 self.log,
   2045                 ads[1],
   2046                 ads[0],
   2047                 ad_hangup=None,
   2048                 verify_caller_func=None,
   2049                 verify_callee_func=is_phone_in_call_iwlan):
   2050             return False
   2051 
   2052         if not self._hold_unhold_test(ads):
   2053             self.log.error("Hold/Unhold test fail.")
   2054             return False
   2055 
   2056         return True
   2057 
   2058     @test_tracker_info(uuid="35ed0f89-7435-4d3b-9ebc-c5cdc3f7e32b")
   2059     @TelephonyBaseTest.tel_test_wrap
   2060     def test_call_epdg_mt_hold_unhold_apm_wfc_wifi_only(self):
   2061         """ Airplane + WiFi Only, WiFi calling MT call hold/unhold test
   2062 
   2063         1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
   2064         2. Make sure PhoneB can make/receive voice call.
   2065         3. Call from PhoneB to PhoneA, accept on PhoneA.
   2066         4. Hold and unhold on PhoneA.
   2067 
   2068         Returns:
   2069             True if pass; False if fail.
   2070         """
   2071         ads = self.android_devices
   2072 
   2073         tasks = [(phone_setup_iwlan,
   2074                   (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
   2075                    self.wifi_network_ssid, self.wifi_network_pass)),
   2076                  (phone_setup_voice_general, (self.log, ads[1]))]
   2077         if not multithread_func(self.log, tasks):
   2078             self.log.error("Phone Failed to Set Up Properly.")
   2079             return False
   2080 
   2081         ads[0].droid.telecomCallClearCallList()
   2082         if num_active_calls(self.log, ads[0]) != 0:
   2083             self.log.error("Phone {} Call List is not empty."
   2084                            .format(ads[0].serial))
   2085             return False
   2086 
   2087         self.log.info("Begin MT Call Hold/Unhold Test.")
   2088         if not call_setup_teardown(
   2089                 self.log,
   2090                 ads[1],
   2091                 ads[0],
   2092                 ad_hangup=None,
   2093                 verify_caller_func=None,
   2094                 verify_callee_func=is_phone_in_call_iwlan):
   2095             return False
   2096 
   2097         if not self._hold_unhold_test(ads):
   2098             self.log.error("Hold/Unhold test fail.")
   2099             return False
   2100 
   2101         return True
   2102 
   2103     @test_tracker_info("37ad003b-6426-42f7-b528-ec7c1842fd18")
   2104     @TelephonyBaseTest.tel_test_wrap
   2105     def test_call_epdg_mt_hold_unhold_apm_wfc_wifi_preferred(self):
   2106         """ Airplane + WiFi Preferred, WiFi calling MT call hold/unhold test
   2107 
   2108         1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
   2109         2. Make sure PhoneB can make/receive voice call.
   2110         3. Call from PhoneB to PhoneA, accept on PhoneA.
   2111         4. Hold and unhold on PhoneA.
   2112 
   2113         Returns:
   2114             True if pass; False if fail.
   2115         """
   2116         ads = self.android_devices
   2117 
   2118         tasks = [(phone_setup_iwlan,
   2119                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
   2120                    self.wifi_network_ssid, self.wifi_network_pass)),
   2121                  (phone_setup_voice_general, (self.log, ads[1]))]
   2122         if not multithread_func(self.log, tasks):
   2123             self.log.error("Phone Failed to Set Up Properly.")
   2124             return False
   2125 
   2126         ads[0].droid.telecomCallClearCallList()
   2127         if num_active_calls(self.log, ads[0]) != 0:
   2128             self.log.error("Phone {} Call List is not empty."
   2129                            .format(ads[0].serial))
   2130             return False
   2131 
   2132         self.log.info("Begin MT Call Hold/Unhold Test.")
   2133         if not call_setup_teardown(
   2134                 self.log,
   2135                 ads[1],
   2136                 ads[0],
   2137                 ad_hangup=None,
   2138                 verify_caller_func=None,
   2139                 verify_callee_func=is_phone_in_call_iwlan):
   2140             return False
   2141 
   2142         if not self._hold_unhold_test(ads):
   2143             self.log.error("Hold/Unhold test fail.")
   2144             return False
   2145 
   2146         return True
   2147 
   2148     @test_tracker_info(uuid="fa37cd37-c30a-4caa-80b4-52507995ec77")
   2149     @TelephonyBaseTest.tel_test_wrap
   2150     def test_call_volte_mo_hold_unhold(self):
   2151         """ VoLTE MO call hold/unhold test
   2152 
   2153         1. Make Sure PhoneA is in LTE mode (with VoLTE).
   2154         2. Make Sure PhoneB is able to make/receive call.
   2155         3. Call from PhoneA to PhoneB, accept on PhoneB.
   2156         4. Hold and unhold on PhoneA.
   2157 
   2158         Returns:
   2159             True if pass; False if fail.
   2160         """
   2161         ads = self.android_devices
   2162 
   2163         tasks = [(phone_setup_volte, (self.log, ads[0])),
   2164                  (phone_setup_voice_general, (self.log, ads[1]))]
   2165         if not multithread_func(self.log, tasks):
   2166             self.log.error("Phone Failed to Set Up Properly.")
   2167             return False
   2168 
   2169         ads[0].droid.telecomCallClearCallList()
   2170         if num_active_calls(self.log, ads[0]) != 0:
   2171             self.log.error("Phone {} Call List is not empty."
   2172                            .format(ads[0].serial))
   2173             return False
   2174 
   2175         self.log.info("Begin MO Call Hold/Unhold Test.")
   2176         if not call_setup_teardown(
   2177                 self.log,
   2178                 ads[0],
   2179                 ads[1],
   2180                 ad_hangup=None,
   2181                 verify_caller_func=is_phone_in_call_volte,
   2182                 verify_callee_func=None):
   2183             return False
   2184 
   2185         if not self._hold_unhold_test(ads):
   2186             self.log.error("Hold/Unhold test fail.")
   2187             return False
   2188 
   2189         return True
   2190 
   2191     @test_tracker_info(uuid="28a9acb3-83e8-4dd1-82bf-173da8bd2eca")
   2192     @TelephonyBaseTest.tel_test_wrap
   2193     def test_call_volte_mt_hold_unhold(self):
   2194         """ VoLTE MT call hold/unhold test
   2195 
   2196         1. Make Sure PhoneA is in LTE mode (with VoLTE).
   2197         2. Make Sure PhoneB is able to make/receive call.
   2198         3. Call from PhoneB to PhoneA, accept on PhoneA.
   2199         4. Hold and unhold on PhoneA.
   2200 
   2201         Returns:
   2202             True if pass; False if fail.
   2203         """
   2204         ads = self.android_devices
   2205 
   2206         tasks = [(phone_setup_volte, (self.log, ads[0])),
   2207                  (phone_setup_voice_general, (self.log, ads[1]))]
   2208         if not multithread_func(self.log, tasks):
   2209             self.log.error("Phone Failed to Set Up Properly.")
   2210             return False
   2211 
   2212         ads[0].droid.telecomCallClearCallList()
   2213         if num_active_calls(self.log, ads[0]) != 0:
   2214             self.log.error("Phone {} Call List is not empty."
   2215                            .format(ads[0].serial))
   2216             return False
   2217 
   2218         self.log.info("Begin MT Call Hold/Unhold Test.")
   2219         if not call_setup_teardown(
   2220                 self.log,
   2221                 ads[1],
   2222                 ads[0],
   2223                 ad_hangup=None,
   2224                 verify_caller_func=None,
   2225                 verify_callee_func=is_phone_in_call_volte):
   2226             return False
   2227 
   2228         if not self._hold_unhold_test(ads):
   2229             self.log.error("Hold/Unhold test fail.")
   2230             return False
   2231 
   2232         return True
   2233 
   2234     @test_tracker_info(uuid="ffe724ae-4223-4c15-9fed-9aba17de9a63")
   2235     @TelephonyBaseTest.tel_test_wrap
   2236     def test_call_wcdma_mo_hold_unhold(self):
   2237         """ MO WCDMA hold/unhold test
   2238 
   2239         1. Make Sure PhoneA is in 3G WCDMA mode.
   2240         2. Make Sure PhoneB is able to make/receive call.
   2241         3. Call from PhoneA to PhoneB, accept on PhoneB.
   2242         4. Hold and unhold on PhoneA.
   2243 
   2244         Returns:
   2245             True if pass; False if fail.
   2246         """
   2247         ads = self.android_devices
   2248         # make sure PhoneA is GSM phone before proceed.
   2249         if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
   2250             self.log.error("Not GSM phone, abort this wcdma hold/unhold test.")
   2251             return False
   2252 
   2253         tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
   2254                  (phone_setup_voice_general, (self.log, ads[1]))]
   2255         if not multithread_func(self.log, tasks):
   2256             self.log.error("Phone Failed to Set Up Properly.")
   2257             return False
   2258 
   2259         ads[0].droid.telecomCallClearCallList()
   2260         if num_active_calls(self.log, ads[0]) != 0:
   2261             self.log.error("Phone {} Call List is not empty."
   2262                            .format(ads[0].serial))
   2263             return False
   2264 
   2265         self.log.info("Begin MO Call Hold/Unhold Test.")
   2266         if not call_setup_teardown(
   2267                 self.log,
   2268                 ads[0],
   2269                 ads[1],
   2270                 ad_hangup=None,
   2271                 verify_caller_func=is_phone_in_call_3g,
   2272                 verify_callee_func=None):
   2273             return False
   2274 
   2275         if not self._hold_unhold_test(ads):
   2276             self.log.error("Hold/Unhold test fail.")
   2277             return False
   2278 
   2279         return True
   2280 
   2281     @test_tracker_info(uuid="23805165-01ce-4351-83d3-73c9fb3bda76")
   2282     @TelephonyBaseTest.tel_test_wrap
   2283     def test_call_wcdma_mt_hold_unhold(self):
   2284         """ MT WCDMA hold/unhold test
   2285 
   2286         1. Make Sure PhoneA is in 3G WCDMA mode.
   2287         2. Make Sure PhoneB is able to make/receive call.
   2288         3. Call from PhoneB to PhoneA, accept on PhoneA.
   2289         4. Hold and unhold on PhoneA.
   2290 
   2291         Returns:
   2292             True if pass; False if fail.
   2293         """
   2294         ads = self.android_devices
   2295         # make sure PhoneA is GSM phone before proceed.
   2296         if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
   2297             self.log.error("Not GSM phone, abort this wcdma hold/unhold test.")
   2298             return False
   2299 
   2300         tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
   2301                  (phone_setup_voice_general, (self.log, ads[1]))]
   2302         if not multithread_func(self.log, tasks):
   2303             self.log.error("Phone Failed to Set Up Properly.")
   2304             return False
   2305 
   2306         ads[0].droid.telecomCallClearCallList()
   2307         if num_active_calls(self.log, ads[0]) != 0:
   2308             self.log.error("Phone {} Call List is not empty."
   2309                            .format(ads[0].serial))
   2310             return False
   2311 
   2312         self.log.info("Begin MT Call Hold/Unhold Test.")
   2313         if not call_setup_teardown(
   2314                 self.log,
   2315                 ads[1],
   2316                 ads[0],
   2317                 ad_hangup=None,
   2318                 verify_caller_func=None,
   2319                 verify_callee_func=is_phone_in_call_3g):
   2320             return False
   2321 
   2322         if not self._hold_unhold_test(ads):
   2323             self.log.error("Hold/Unhold test fail.")
   2324             return False
   2325 
   2326         return True
   2327 
   2328     @test_tracker_info(uuid="08c846c7-1978-4ece-8f2c-731129947699")
   2329     @TelephonyBaseTest.tel_test_wrap
   2330     def test_call_csfb_mo_hold_unhold(self):
   2331         """ MO CSFB WCDMA/GSM hold/unhold test
   2332 
   2333         1. Make Sure PhoneA is in LTE mode (VoLTE disabled).
   2334         2. Make Sure PhoneB is able to make/receive call.
   2335         3. Call from PhoneA to PhoneB, accept on PhoneB.
   2336         4. Hold and unhold on PhoneA.
   2337 
   2338         Returns:
   2339             True if pass; False if fail.
   2340         """
   2341         ads = self.android_devices
   2342         # make sure PhoneA is GSM phone before proceed.
   2343         if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
   2344             self.log.error("Not GSM phone, abort this wcdma hold/unhold test.")
   2345             return False
   2346 
   2347         tasks = [(phone_setup_csfb, (self.log, ads[0])),
   2348                  (phone_setup_voice_general, (self.log, ads[1]))]
   2349         if not multithread_func(self.log, tasks):
   2350             self.log.error("Phone Failed to Set Up Properly.")
   2351             return False
   2352 
   2353         ads[0].droid.telecomCallClearCallList()
   2354         if num_active_calls(self.log, ads[0]) != 0:
   2355             self.log.error("Phone {} Call List is not empty."
   2356                            .format(ads[0].serial))
   2357             return False
   2358 
   2359         self.log.info("Begin MO Call Hold/Unhold Test.")
   2360         if not call_setup_teardown(
   2361                 self.log,
   2362                 ads[0],
   2363                 ads[1],
   2364                 ad_hangup=None,
   2365                 verify_caller_func=is_phone_in_call_csfb,
   2366                 verify_callee_func=None):
   2367             return False
   2368 
   2369         if not self._hold_unhold_test(ads):
   2370             self.log.error("Hold/Unhold test fail.")
   2371             return False
   2372 
   2373         return True
   2374 
   2375     @test_tracker_info(uuid="a6405fe6-c732-4ae6-bbae-e912a124f4a2")
   2376     @TelephonyBaseTest.tel_test_wrap
   2377     def test_call_csfb_mt_hold_unhold(self):
   2378         """ MT CSFB WCDMA/GSM hold/unhold test
   2379 
   2380         1. Make Sure PhoneA is in LTE mode (VoLTE disabled).
   2381         2. Make Sure PhoneB is able to make/receive call.
   2382         3. Call from PhoneB to PhoneA, accept on PhoneA.
   2383         4. Hold and unhold on PhoneA.
   2384 
   2385         Returns:
   2386             True if pass; False if fail.
   2387         """
   2388         ads = self.android_devices
   2389         # make sure PhoneA is GSM phone before proceed.
   2390         if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
   2391             self.log.error("Not GSM phone, abort this wcdma hold/unhold test.")
   2392             return False
   2393 
   2394         tasks = [(phone_setup_csfb, (self.log, ads[0])),
   2395                  (phone_setup_voice_general, (self.log, ads[1]))]
   2396         if not multithread_func(self.log, tasks):
   2397             self.log.error("Phone Failed to Set Up Properly.")
   2398             return False
   2399 
   2400         ads[0].droid.telecomCallClearCallList()
   2401         if num_active_calls(self.log, ads[0]) != 0:
   2402             self.log.error("Phone {} Call List is not empty."
   2403                            .format(ads[0].serial))
   2404             return False
   2405 
   2406         self.log.info("Begin MT Call Hold/Unhold Test.")
   2407         if not call_setup_teardown(
   2408                 self.log,
   2409                 ads[1],
   2410                 ads[0],
   2411                 ad_hangup=None,
   2412                 verify_caller_func=None,
   2413                 verify_callee_func=is_phone_in_call_csfb):
   2414             return False
   2415 
   2416         if not self._hold_unhold_test(ads):
   2417             self.log.error("Hold/Unhold test fail.")
   2418             return False
   2419 
   2420         return True
   2421 
   2422     @test_tracker_info(uuid="5edc5034-90ef-4113-926f-05407ed60a87")
   2423     @TelephonyBaseTest.tel_test_wrap
   2424     def test_erase_all_pending_voicemail(self):
   2425         """Script for TMO/ATT/SPT phone to erase all pending voice mail.
   2426         This script only works if phone have already set up voice mail options,
   2427         and phone should disable password protection for voice mail.
   2428 
   2429         1. If phone don't have pending voice message, return True.
   2430         2. Dial voice mail number.
   2431             For TMO, the number is '123'.
   2432             For ATT, the number is phone's number.
   2433             For SPT, the number is phone's number.
   2434         3. Use DTMF to delete all pending voice messages.
   2435         4. Check telephonyGetVoiceMailCount result. it should be 0.
   2436 
   2437         Returns:
   2438             False if error happens. True is succeed.
   2439         """
   2440         ads = self.android_devices
   2441 
   2442         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
   2443                  (phone_setup_voice_general, (self.log, ads[1]))]
   2444         if not multithread_func(self.log, tasks):
   2445             self.log.error("Phone Failed to Set Up Properly.")
   2446             return False
   2447 
   2448         return call_voicemail_erase_all_pending_voicemail(
   2449             self.log, self.android_devices[1])
   2450 
   2451     @test_tracker_info(uuid="c81156a2-089b-4b10-ba80-7afea61d06c6")
   2452     @TelephonyBaseTest.tel_test_wrap
   2453     def test_voicemail_indicator_volte(self):
   2454         """Test Voice Mail notification in LTE (VoLTE enabled).
   2455         This script currently only works for TMO now.
   2456 
   2457         1. Make sure DUT (ads[1]) in VoLTE mode. Both PhoneB (ads[0]) and DUT idle.
   2458         2. Make call from PhoneB to DUT, reject on DUT.
   2459         3. On PhoneB, leave a voice mail to DUT.
   2460         4. Verify DUT receive voice mail notification.
   2461 
   2462         Returns:
   2463             True if pass; False if fail.
   2464         """
   2465         ads = self.android_devices
   2466 
   2467         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
   2468                  (phone_setup_volte, (self.log, ads[1]))]
   2469         if not multithread_func(self.log, tasks):
   2470             self.log.error("Phone Failed to Set Up Properly.")
   2471             return False
   2472         if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]):
   2473             self.log.error("Failed to clear voice mail.")
   2474             return False
   2475 
   2476         return two_phone_call_leave_voice_mail(self.log, ads[0], None, None,
   2477                                                ads[1], phone_idle_volte)
   2478 
   2479     @test_tracker_info(uuid="529e12cb-3178-4d2c-b155-d5cfb1eac0c9")
   2480     @TelephonyBaseTest.tel_test_wrap
   2481     def test_voicemail_indicator_lte(self):
   2482         """Test Voice Mail notification in LTE (VoLTE disabled).
   2483         This script currently only works for TMO/ATT/SPT now.
   2484 
   2485         1. Make sure DUT (ads[1]) in LTE (No VoLTE) mode. Both PhoneB (ads[0]) and DUT idle.
   2486         2. Make call from PhoneB to DUT, reject on DUT.
   2487         3. On PhoneB, leave a voice mail to DUT.
   2488         4. Verify DUT receive voice mail notification.
   2489 
   2490         Returns:
   2491             True if pass; False if fail.
   2492         """
   2493         ads = self.android_devices
   2494 
   2495         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
   2496                  (phone_setup_csfb, (self.log, ads[1]))]
   2497         if not multithread_func(self.log, tasks):
   2498             self.log.error("Phone Failed to Set Up Properly.")
   2499             return False
   2500         if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]):
   2501             self.log.error("Failed to clear voice mail.")
   2502             return False
   2503 
   2504         return two_phone_call_leave_voice_mail(self.log, ads[0], None, None,
   2505                                                ads[1], phone_idle_csfb)
   2506 
   2507     @test_tracker_info(uuid="60cef7dd-f990-4913-af9a-75e9336fc80a")
   2508     @TelephonyBaseTest.tel_test_wrap
   2509     def test_voicemail_indicator_3g(self):
   2510         """Test Voice Mail notification in 3G
   2511         This script currently only works for TMO/ATT/SPT now.
   2512 
   2513         1. Make sure DUT (ads[1]) in 3G mode. Both PhoneB (ads[0]) and DUT idle.
   2514         2. Make call from PhoneB to DUT, reject on DUT.
   2515         3. On PhoneB, leave a voice mail to DUT.
   2516         4. Verify DUT receive voice mail notification.
   2517 
   2518         Returns:
   2519             True if pass; False if fail.
   2520         """
   2521         ads = self.android_devices
   2522 
   2523         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
   2524                  (phone_setup_voice_3g, (self.log, ads[1]))]
   2525         if not multithread_func(self.log, tasks):
   2526             self.log.error("Phone Failed to Set Up Properly.")
   2527             return False
   2528         if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]):
   2529             self.log.error("Failed to clear voice mail.")
   2530             return False
   2531 
   2532         return two_phone_call_leave_voice_mail(self.log, ads[0], None, None,
   2533                                                ads[1], phone_idle_3g)
   2534 
   2535     @test_tracker_info(uuid="e4c83cfa-db60-4258-ab69-15f7de3614b0")
   2536     @TelephonyBaseTest.tel_test_wrap
   2537     def test_voicemail_indicator_2g(self):
   2538         """Test Voice Mail notification in 2G
   2539         This script currently only works for TMO/ATT/SPT now.
   2540 
   2541         1. Make sure DUT (ads[0]) in 2G mode. Both PhoneB (ads[1]) and DUT idle.
   2542         2. Make call from PhoneB to DUT, reject on DUT.
   2543         3. On PhoneB, leave a voice mail to DUT.
   2544         4. Verify DUT receive voice mail notification.
   2545 
   2546         Returns:
   2547             True if pass; False if fail.
   2548         """
   2549         ads = self.android_devices
   2550 
   2551         tasks = [(phone_setup_voice_general, (self.log, ads[1])),
   2552                  (phone_setup_voice_2g, (self.log, ads[0]))]
   2553         if not multithread_func(self.log, tasks):
   2554             self.log.error("Phone Failed to Set Up Properly.")
   2555             return False
   2556         if not call_voicemail_erase_all_pending_voicemail(self.log, ads[0]):
   2557             self.log.error("Failed to clear voice mail.")
   2558             return False
   2559 
   2560         return two_phone_call_leave_voice_mail(self.log, ads[1], None, None,
   2561                                                ads[0], phone_idle_2g)
   2562 
   2563     @test_tracker_info(uuid="f0cb02fb-a028-43da-9c87-5b21b2f8549b")
   2564     @TelephonyBaseTest.tel_test_wrap
   2565     def test_voicemail_indicator_iwlan(self):
   2566         """Test Voice Mail notification in WiFI Calling
   2567         This script currently only works for TMO now.
   2568 
   2569         1. Make sure DUT (ads[1]) in WFC mode. Both PhoneB (ads[0]) and DUT idle.
   2570         2. Make call from PhoneB to DUT, reject on DUT.
   2571         3. On PhoneB, leave a voice mail to DUT.
   2572         4. Verify DUT receive voice mail notification.
   2573 
   2574         Returns:
   2575             True if pass; False if fail.
   2576         """
   2577         ads = self.android_devices
   2578 
   2579         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
   2580                  (phone_setup_iwlan,
   2581                   (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED,
   2582                    self.wifi_network_ssid, self.wifi_network_pass))]
   2583         if not multithread_func(self.log, tasks):
   2584             self.log.error("Phone Failed to Set Up Properly.")
   2585             return False
   2586         if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]):
   2587             self.log.error("Failed to clear voice mail.")
   2588             return False
   2589 
   2590         return two_phone_call_leave_voice_mail(self.log, ads[0], None, None,
   2591                                                ads[1], phone_idle_iwlan)
   2592 
   2593     @test_tracker_info(uuid="9bd0550e-abfd-436b-912f-571810f973d7")
   2594     @TelephonyBaseTest.tel_test_wrap
   2595     def test_voicemail_indicator_apm_iwlan(self):
   2596         """Test Voice Mail notification in WiFI Calling
   2597         This script currently only works for TMO now.
   2598 
   2599         1. Make sure DUT (ads[1]) in APM WFC mode. Both PhoneB (ads[0]) and DUT idle.
   2600         2. Make call from PhoneB to DUT, reject on DUT.
   2601         3. On PhoneB, leave a voice mail to DUT.
   2602         4. Verify DUT receive voice mail notification.
   2603 
   2604         Returns:
   2605             True if pass; False if fail.
   2606         """
   2607         ads = self.android_devices
   2608 
   2609         tasks = [(phone_setup_voice_general, (self.log, ads[0])),
   2610                  (phone_setup_iwlan,
   2611                   (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED,
   2612                    self.wifi_network_ssid, self.wifi_network_pass))]
   2613         if not multithread_func(self.log, tasks):
   2614             self.log.error("Phone Failed to Set Up Properly.")
   2615             return False
   2616         if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]):
   2617             self.log.error("Failed to clear voice mail.")
   2618             return False
   2619 
   2620         return two_phone_call_leave_voice_mail(self.log, ads[0], None, None,
   2621                                                ads[1], phone_idle_iwlan)
   2622 
   2623     @test_tracker_info(uuid="6bd5cf0f-522e-4e4a-99bf-92ae46261d8c")
   2624     @TelephonyBaseTest.tel_test_wrap
   2625     def test_call_2g_to_2g(self):
   2626         """ Test 2g<->2g call functionality.
   2627 
   2628         Make Sure PhoneA is in 2g mode.
   2629         Make Sure PhoneB is in 2g mode.
   2630         Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   2631         Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   2632 
   2633         Returns:
   2634             True if pass; False if fail.
   2635         """
   2636         ads = self.android_devices
   2637 
   2638         tasks = [(phone_setup_voice_2g, (self.log, ads[0])),
   2639                  (phone_setup_voice_2g, (self.log, ads[1]))]
   2640         if not multithread_func(self.log, tasks):
   2641             self.log.error("Phone Failed to Set Up Properly.")
   2642             return False
   2643 
   2644         return two_phone_call_short_seq(
   2645             self.log, ads[0], phone_idle_2g, is_phone_in_call_2g, ads[1],
   2646             phone_idle_2g, is_phone_in_call_2g, None)
   2647 
   2648     @test_tracker_info(uuid="6e24e64f-aa0e-4101-89ed-4cc30c738c7e")
   2649     @TelephonyBaseTest.tel_test_wrap
   2650     def test_call_2g_to_2g_long(self):
   2651         """ Test 2g<->2g call functionality.
   2652 
   2653         Make Sure PhoneA is in 2g mode.
   2654         Make Sure PhoneB is in 2g mode.
   2655         Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
   2656         Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
   2657         Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
   2658         Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
   2659 
   2660         Returns:
   2661             True if pass; False if fail.
   2662         """
   2663         ads = self.android_devices
   2664 
   2665         tasks = [(phone_setup_voice_2g, (self.log, ads[0])),
   2666                  (phone_setup_voice_2g, (self.log, ads[1]))]
   2667         if not multithread_func(self.log, tasks):
   2668             self.log.error("Phone Failed to Set Up Properly.")
   2669             return False
   2670 
   2671         return two_phone_call_long_seq(
   2672             self.log, ads[0], phone_idle_2g, is_phone_in_call_2g, ads[1],
   2673             phone_idle_2g, is_phone_in_call_2g, None)
   2674 
   2675     @test_tracker_info(uuid="d109df55-ac2f-493f-9324-9be1d3d7d6d3")
   2676     @TelephonyBaseTest.tel_test_wrap
   2677     def test_call_gsm_mo_hold_unhold(self):
   2678         """ Test GSM call hold/unhold functionality.
   2679 
   2680         Make Sure PhoneA is in 2g mode (GSM).
   2681         Make Sure PhoneB is able to make/receive call.
   2682         Call from PhoneA to PhoneB, accept on PhoneB, hold and unhold on PhoneA.
   2683 
   2684         Returns:
   2685             True if pass; False if fail.
   2686         """
   2687         ads = self.android_devices
   2688         # make sure PhoneA is GSM phone before proceed.
   2689         if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
   2690             self.log.error("Not GSM phone, abort this wcdma hold/unhold test.")
   2691             return False
   2692 
   2693         tasks = [(phone_setup_voice_2g, (self.log, ads[0])),
   2694                  (phone_setup_voice_general, (self.log, ads[1]))]
   2695         if not multithread_func(self.log, tasks):
   2696             self.log.error("Phone Failed to Set Up Properly.")
   2697             return False
   2698 
   2699         ads[0].droid.telecomCallClearCallList()
   2700         if num_active_calls(self.log, ads[0]) != 0:
   2701             self.log.error("Phone {} Call List is not empty."
   2702                            .format(ads[0].serial))
   2703             return False
   2704 
   2705         self.log.info("Begin MO Call Hold/Unhold Test.")
   2706         if not call_setup_teardown(
   2707                 self.log,
   2708                 ads[0],
   2709                 ads[1],
   2710                 ad_hangup=None,
   2711                 verify_caller_func=is_phone_in_call_2g,
   2712                 verify_callee_func=None):
   2713             return False
   2714 
   2715         if not self._hold_unhold_test(ads):
   2716             self.log.error("Hold/Unhold test fail.")
   2717             return False
   2718 
   2719         return True
   2720 
   2721     @test_tracker_info(uuid="a8279cda-73b3-470a-8ca7-a331ef99270b")
   2722     @TelephonyBaseTest.tel_test_wrap
   2723     def test_call_gsm_mt_hold_unhold(self):
   2724         """ Test GSM call hold/unhold functionality.
   2725 
   2726         Make Sure PhoneA is in 2g mode (GSM).
   2727         Make Sure PhoneB is able to make/receive call.
   2728         Call from PhoneB to PhoneA, accept on PhoneA, hold and unhold on PhoneA.
   2729 
   2730         Returns:
   2731             True if pass; False if fail.
   2732         """
   2733         ads = self.android_devices
   2734         # make sure PhoneA is GSM phone before proceed.
   2735         if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
   2736             self.log.error("Not GSM phone, abort this wcdma hold/unhold test.")
   2737             return False
   2738 
   2739         tasks = [(phone_setup_voice_2g, (self.log, ads[0])),
   2740                  (phone_setup_voice_general, (self.log, ads[1]))]
   2741         if not multithread_func(self.log, tasks):
   2742             self.log.error("Phone Failed to Set Up Properly.")
   2743             return False
   2744 
   2745         ads[0].droid.telecomCallClearCallList()
   2746         if num_active_calls(self.log, ads[0]) != 0:
   2747             self.log.error("Phone {} Call List is not empty."
   2748                            .format(ads[0].serial))
   2749             return False
   2750 
   2751         self.log.info("Begin MT Call Hold/Unhold Test.")
   2752         if not call_setup_teardown(
   2753                 self.log,
   2754                 ads[1],
   2755                 ads[0],
   2756                 ad_hangup=None,
   2757                 verify_caller_func=None,
   2758                 verify_callee_func=is_phone_in_call_2g):
   2759             return False
   2760 
   2761         if not self._hold_unhold_test(ads):
   2762             self.log.error("Hold/Unhold test fail.")
   2763             return False
   2764 
   2765         return True
   2766 
   2767     def _test_call_long_duration(self, dut_incall_check_func, total_duration):
   2768         ads = self.android_devices
   2769         self.log.info("Long Duration Call Test. Total duration = {}".format(
   2770             total_duration))
   2771         return call_setup_teardown(
   2772             self.log,
   2773             ads[0],
   2774             ads[1],
   2775             ads[0],
   2776             verify_caller_func=dut_incall_check_func,
   2777             wait_time_in_call=total_duration)
   2778 
   2779     @test_tracker_info(uuid="d0008b51-25ed-414a-9b82-3ffb139a6e0d")
   2780     @TelephonyBaseTest.tel_test_wrap
   2781     def test_call_long_duration_volte(self):
   2782         """ Test call drop rate for VoLTE long duration call.
   2783 
   2784         Steps:
   2785         1. Setup VoLTE for DUT.
   2786         2. Make VoLTE call from DUT to PhoneB.
   2787         3. For <total_duration> time, check if DUT drop call or not.
   2788 
   2789         Expected Results:
   2790         DUT should not drop call.
   2791 
   2792         Returns:
   2793         False if DUT call dropped during test.
   2794         Otherwise True.
   2795         """
   2796         ads = self.android_devices
   2797 
   2798         tasks = [(phone_setup_volte, (self.log, ads[0])),
   2799                  (phone_setup_voice_general, (self.log, ads[1]))]
   2800         if not multithread_func(self.log, tasks):
   2801             self.log.error("Phone Failed to Set Up Properly.")
   2802             return False
   2803 
   2804         return self._test_call_long_duration(
   2805             is_phone_in_call_volte, self.long_duration_call_total_duration)
   2806 
   2807     @test_tracker_info(uuid="d4c1aec0-df05-403f-954c-496faf18605a")
   2808     @TelephonyBaseTest.tel_test_wrap
   2809     def test_call_long_duration_wfc(self):
   2810         """ Test call drop rate for WiFi Calling long duration call.
   2811 
   2812         Steps:
   2813         1. Setup WFC for DUT.
   2814         2. Make WFC call from DUT to PhoneB.
   2815         3. For <total_duration> time, check if DUT drop call or not.
   2816 
   2817         Expected Results:
   2818         DUT should not drop call.
   2819 
   2820         Returns:
   2821         False if DUT call dropped during test.
   2822         Otherwise True.
   2823         """
   2824         ads = self.android_devices
   2825 
   2826         tasks = [(phone_setup_iwlan,
   2827                   (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
   2828                    self.wifi_network_ssid, self.wifi_network_pass)),
   2829                  (phone_setup_voice_general, (self.log, ads[1]))]
   2830         if not multithread_func(self.log, tasks):
   2831             self.log.error("Phone Failed to Set Up Properly.")
   2832             return False
   2833 
   2834         return self._test_call_long_duration(
   2835             is_phone_in_call_iwlan, self.long_duration_call_total_duration)
   2836 
   2837     @test_tracker_info(uuid="bc44f3ca-2616-4024-b959-3a5a85503dfd")
   2838     @TelephonyBaseTest.tel_test_wrap
   2839     def test_call_long_duration_3g(self):
   2840         """ Test call drop rate for 3G long duration call.
   2841 
   2842         Steps:
   2843         1. Setup 3G for DUT.
   2844         2. Make CS call from DUT to PhoneB.
   2845         3. For <total_duration> time, check if DUT drop call or not.
   2846 
   2847         Expected Results:
   2848         DUT should not drop call.
   2849 
   2850         Returns:
   2851         False if DUT call dropped during test.
   2852         Otherwise True.
   2853         """
   2854         ads = self.android_devices
   2855 
   2856         tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
   2857                  (phone_setup_voice_general, (self.log, ads[1]))]
   2858         if not multithread_func(self.log, tasks):
   2859             self.log.error("Phone Failed to Set Up Properly.")
   2860             return False
   2861 
   2862         return self._test_call_long_duration(
   2863             is_phone_in_call_3g, self.long_duration_call_total_duration)
   2864 
   2865     def _test_call_hangup_while_ringing(self, ad_caller, ad_callee):
   2866         """ Call a phone and verify ringing, then hangup from the originator
   2867 
   2868         1. Setup PhoneA and PhoneB to ensure voice service.
   2869         2. Call from PhoneA to PhoneB and wait for ringing.
   2870         3. End the call on PhoneA.
   2871 
   2872         Returns:
   2873             True if pass; False if fail.
   2874         """
   2875 
   2876         caller_number = ad_caller.cfg['subscription'][
   2877             get_outgoing_voice_sub_id(ad_caller)]['phone_num']
   2878         callee_number = ad_callee.cfg['subscription'][
   2879             get_incoming_voice_sub_id(ad_callee)]['phone_num']
   2880 
   2881         tasks = [(phone_setup_voice_general, (self.log, ad_caller)),
   2882                  (phone_setup_voice_general, (self.log, ad_callee))]
   2883         if not multithread_func(self.log, tasks):
   2884             self.log.error("Phone Failed to Set Up Properly.")
   2885             return False
   2886 
   2887         ad_caller.droid.telecomCallClearCallList()
   2888         if num_active_calls(self.log, ad_caller) != 0:
   2889             self.log.error(
   2890                 "Phone {} has ongoing calls.".format(ad_caller.serial))
   2891             return False
   2892 
   2893         if not initiate_call(self.log, ad_caller, callee_number):
   2894             self.log.error(
   2895                 "Phone was {} unable to initate a call".format(ads[0].serial))
   2896             return False
   2897 
   2898         if not wait_for_ringing_call(self.log, ad_callee, caller_number):
   2899             self.log.error("Phone {} never rang.".format(ad_callee.serial))
   2900             return False
   2901 
   2902         if not hangup_call(self.log, ad_caller):
   2903             self.log.error("Unable to hang up the call")
   2904             return False
   2905 
   2906         return True
   2907 
   2908     @test_tracker_info(uuid="ef4fb42d-9040-46f2-9626-d0a2e1dd854f")
   2909     @TelephonyBaseTest.tel_test_wrap
   2910     def test_call_mo_hangup_while_ringing(self):
   2911         """ Call a phone and verify ringing, then hangup from the originator
   2912 
   2913         1. Setup PhoneA and PhoneB to ensure voice service.
   2914         2. Call from PhoneA to PhoneB and wait for ringing.
   2915         3. End the call on PhoneA.
   2916 
   2917         Returns:
   2918             True if pass; False if fail.
   2919         """
   2920 
   2921         return self._test_call_hangup_while_ringing(self.android_devices[0],
   2922                                                     self.android_devices[1])
   2923 
   2924     @test_tracker_info(uuid="f514ac72-d551-4e21-b5af-bd87b6cdf34a")
   2925     @TelephonyBaseTest.tel_test_wrap
   2926     def test_call_mt_hangup_while_ringing(self):
   2927         """ Call a phone and verify ringing, then hangup from the originator
   2928 
   2929         1. Setup PhoneA and PhoneB to ensure voice service.
   2930         2. Call from PhoneB to PhoneA and wait for ringing.
   2931         3. End the call on PhoneB.
   2932 
   2933         Returns:
   2934             True if pass; False if fail.
   2935         """
   2936 
   2937         return self._test_call_hangup_while_ringing(self.android_devices[1],
   2938                                                     self.android_devices[0])
   2939 
   2940     def _test_call_setup_in_active_data_transfer(
   2941             self,
   2942             nw_gen=None,
   2943             call_direction=DIRECTION_MOBILE_ORIGINATED,
   2944             allow_data_transfer_interruption=False):
   2945         """Test call can be established during active data connection.
   2946 
   2947         Turn off airplane mode, disable WiFi, enable Cellular Data.
   2948         Make sure phone in <nw_gen>.
   2949         Starting downloading file from Internet.
   2950         Initiate a voice call. Verify call can be established.
   2951         Hangup Voice Call, verify file is downloaded successfully.
   2952         Note: file download will be suspended when call is initiated if voice
   2953               is using voice channel and voice channel and data channel are
   2954               on different RATs.
   2955 
   2956         Returns:
   2957             True if success.
   2958             False if failed.
   2959         """
   2960 
   2961         def _call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
   2962                                  caller_verifier, callee_verifier,
   2963                                  wait_time_in_call):
   2964             #wait time for active data transfer
   2965             time.sleep(10)
   2966             return call_setup_teardown(log, ad_caller, ad_callee, ad_hangup,
   2967                                        caller_verifier, callee_verifier,
   2968                                        wait_time_in_call)
   2969 
   2970         if nw_gen:
   2971             if not ensure_network_generation(
   2972                     self.log, self.android_devices[0], nw_gen,
   2973                     MAX_WAIT_TIME_NW_SELECTION, NETWORK_SERVICE_DATA):
   2974                 self.log.error("Device failed to reselect in %s.",
   2975                                MAX_WAIT_TIME_NW_SELECTION)
   2976                 return False
   2977 
   2978             #toggle_airplane_mode(self.log, self.android_devices[0], False)
   2979             #wifi_toggle_state(self.log, self.android_devices[0], False)
   2980 
   2981             self.android_devices[0].droid.telephonyToggleDataConnection(True)
   2982             if not wait_for_cell_data_connection(
   2983                     self.log, self.android_devices[0], True):
   2984                 self.log.error("Data connection is not on cell")
   2985                 return False
   2986 
   2987         if not verify_http_connection(self.log, self.android_devices[0]):
   2988             self.log.error("HTTP connection is not available")
   2989             return False
   2990 
   2991         if call_direction == DIRECTION_MOBILE_ORIGINATED:
   2992             ad_caller = self.android_devices[0]
   2993             ad_callee = self.android_devices[1]
   2994         else:
   2995             ad_caller = self.android_devices[1]
   2996             ad_callee = self.android_devices[0]
   2997         ad_download = self.android_devices[0]
   2998 
   2999         call_task = (_call_setup_teardown, (self.log, ad_caller, ad_callee,
   3000                                             ad_caller, None, None, 60))
   3001         download_task = active_file_download_task(self.log, ad_download)
   3002         results = run_multithread_func(self.log, [download_task, call_task])
   3003         if not results[1]:
   3004             self.log.error("Call setup failed in active data transfer.")
   3005             return False
   3006         if results[0]:
   3007             self.log.info("Data transfer succeeded.")
   3008             return True
   3009         elif not allow_data_transfer_interruption:
   3010             self.log.error("Data transfer failed with parallel phone call.")
   3011             return False
   3012         ad_download.log.info("Retry data transfer after call hung up")
   3013         return download_task[0](*download_task[1])
   3014 
   3015     @test_tracker_info(uuid="aa40e7e1-e64a-480b-86e4-db2242449555")
   3016     @TelephonyBaseTest.tel_test_wrap
   3017     def test_call_mo_voice_general_in_active_data_transfer(self):
   3018         """Test call can be established during active data connection.
   3019 
   3020         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3021         Make sure phone in <nw_gen>.
   3022         Starting downloading file from Internet.
   3023         Initiate a MO voice call. Verify call can be established.
   3024         Hangup Voice Call, verify file is downloaded successfully.
   3025         Note: file download will be suspended when call is initiated if voice
   3026               is using voice channel and voice channel and data channel are
   3027               on different RATs.
   3028 
   3029         Returns:
   3030             True if success.
   3031             False if failed.
   3032         """
   3033         return self._test_call_setup_in_active_data_transfer(
   3034             None, DIRECTION_MOBILE_ORIGINATED)
   3035 
   3036     @test_tracker_info(uuid="d750d66b-2091-4e8d-baa2-084b9d2bbff5")
   3037     @TelephonyBaseTest.tel_test_wrap
   3038     def test_call_mt_voice_general_in_active_data_transfer(self):
   3039         """Test call can be established during active data connection.
   3040 
   3041         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3042         Make sure phone in <nw_gen>.
   3043         Starting downloading file from Internet.
   3044         Initiate a MT voice call. Verify call can be established.
   3045         Hangup Voice Call, verify file is downloaded successfully.
   3046         Note: file download will be suspended when call is initiated if voice
   3047               is using voice channel and voice channel and data channel are
   3048               on different RATs.
   3049 
   3050         Returns:
   3051             True if success.
   3052             False if failed.
   3053         """
   3054         return self._test_call_setup_in_active_data_transfer(
   3055             None, DIRECTION_MOBILE_TERMINATED)
   3056 
   3057     @test_tracker_info(uuid="35703e83-b3e6-40af-aeaf-6b983d6205f4")
   3058     @TelephonyBaseTest.tel_test_wrap
   3059     def test_call_mo_voice_volte_in_active_data_transfer(self):
   3060         """Test call can be established during active data connection.
   3061 
   3062         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3063         Make sure phone in <nw_gen>.
   3064         Starting downloading file from Internet.
   3065         Initiate a MO voice call. Verify call can be established.
   3066         Hangup Voice Call, verify file is downloaded successfully.
   3067         Note: file download will be suspended when call is initiated if voice
   3068               is using voice channel and voice channel and data channel are
   3069               on different RATs.
   3070 
   3071         Returns:
   3072             True if success.
   3073             False if failed.
   3074         """
   3075         if not phone_setup_volte(self.log, self.android_devices[0]):
   3076             self.android_devices[0].log.error("Failed to setup VoLTE")
   3077             return False
   3078         return self._test_call_setup_in_active_data_transfer(
   3079             GEN_4G, DIRECTION_MOBILE_ORIGINATED)
   3080 
   3081     @test_tracker_info(uuid="a0f658d9-4212-44db-b3e8-7202f1eec04d")
   3082     @TelephonyBaseTest.tel_test_wrap
   3083     def test_call_mt_voice_volte_in_active_data_transfer(self):
   3084         """Test call can be established during active data connection.
   3085 
   3086         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3087         Make sure phone in <nw_gen>.
   3088         Starting downloading file from Internet.
   3089         Initiate a MT voice call. Verify call can be established.
   3090         Hangup Voice Call, verify file is downloaded successfully.
   3091         Note: file download will be suspended when call is initiated if voice
   3092               is using voice channel and voice channel and data channel are
   3093               on different RATs.
   3094 
   3095         Returns:
   3096             True if success.
   3097             False if failed.
   3098         """
   3099         if not phone_setup_volte(self.log, self.android_devices[0]):
   3100             self.android_devices[0].log.error("Failed to setup VoLTE")
   3101             return False
   3102         return self._test_call_setup_in_active_data_transfer(
   3103             GEN_4G, DIRECTION_MOBILE_TERMINATED)
   3104 
   3105     @test_tracker_info(uuid="e0b264ec-fc29-411e-b018-684b7ff5a37e")
   3106     @TelephonyBaseTest.tel_test_wrap
   3107     def test_call_mo_voice_csfb_in_active_data_transfer(self):
   3108         """Test call can be established during active data connection.
   3109 
   3110         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3111         Make sure phone in <nw_gen>.
   3112         Starting downloading file from Internet.
   3113         Initiate a MO voice call. Verify call can be established.
   3114         Hangup Voice Call, verify file is downloaded successfully.
   3115         Note: file download will be suspended when call is initiated if voice
   3116               is using voice channel and voice channel and data channel are
   3117               on different RATs.
   3118 
   3119         Returns:
   3120             True if success.
   3121             False if failed.
   3122         """
   3123         if not phone_setup_csfb(self.log, self.android_devices[0]):
   3124             self.android_devices[0].log.error("Failed to setup VoLTE")
   3125             return False
   3126         return self._test_call_setup_in_active_data_transfer(
   3127             GEN_4G,
   3128             DIRECTION_MOBILE_ORIGINATED,
   3129             allow_data_transfer_interruption=True)
   3130 
   3131     @test_tracker_info(uuid="98f04a27-74e1-474d-90d1-a4a45cdb6f5b")
   3132     @TelephonyBaseTest.tel_test_wrap
   3133     def test_call_mt_voice_csfb_in_active_data_transfer(self):
   3134         """Test call can be established during active data connection.
   3135 
   3136         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3137         Make sure phone in <nw_gen>.
   3138         Starting downloading file from Internet.
   3139         Initiate a MT voice call. Verify call can be established.
   3140         Hangup Voice Call, verify file is downloaded successfully.
   3141         Note: file download will be suspended when call is initiated if voice
   3142               is using voice channel and voice channel and data channel are
   3143               on different RATs.
   3144 
   3145         Returns:
   3146             True if success.
   3147             False if failed.
   3148         """
   3149         if not phone_setup_csfb(self.log, self.android_devices[0]):
   3150             self.android_devices[0].log.error("Failed to setup VoLTE")
   3151             return False
   3152         return self._test_call_setup_in_active_data_transfer(
   3153             GEN_4G,
   3154             DIRECTION_MOBILE_TERMINATED,
   3155             allow_data_transfer_interruption=True)
   3156 
   3157     @test_tracker_info(uuid="359b1ee1-36a6-427b-9d9e-4d77231fcb09")
   3158     @TelephonyBaseTest.tel_test_wrap
   3159     def test_call_mo_voice_3g_in_active_data_transfer(self):
   3160         """Test call can be established during active data connection.
   3161 
   3162         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3163         Make sure phone in <nw_gen>.
   3164         Starting downloading file from Internet.
   3165         Initiate a MO voice call. Verify call can be established.
   3166         Hangup Voice Call, verify file is downloaded successfully.
   3167         Note: file download will be suspended when call is initiated if voice
   3168               is using voice channel and voice channel and data channel are
   3169               on different RATs.
   3170 
   3171         Returns:
   3172             True if success.
   3173             False if failed.
   3174         """
   3175         if not phone_setup_voice_3g(self.log, self.android_devices[0]):
   3176             self.android_devices[0].log.error("Failed to setup 3G")
   3177             return False
   3178         return self._test_call_setup_in_active_data_transfer(
   3179             GEN_3G,
   3180             DIRECTION_MOBILE_ORIGINATED,
   3181             allow_data_transfer_interruption=True)
   3182 
   3183     @test_tracker_info(uuid="b172bbb4-2d6e-4d83-a381-ebfdf23bc30e")
   3184     @TelephonyBaseTest.tel_test_wrap
   3185     def test_call_mt_voice_3g_in_active_data_transfer(self):
   3186         """Test call can be established during active data connection.
   3187 
   3188         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3189         Make sure phone in <nw_gen>.
   3190         Starting downloading file from Internet.
   3191         Initiate a MT voice call. Verify call can be established.
   3192         Hangup Voice Call, verify file is downloaded successfully.
   3193         Note: file download will be suspended when call is initiated if voice
   3194               is using voice channel and voice channel and data channel are
   3195               on different RATs.
   3196 
   3197         Returns:
   3198             True if success.
   3199             False if failed.
   3200         """
   3201         if not phone_setup_voice_3g(self.log, self.android_devices[0]):
   3202             self.android_devices[0].log.error("Failed to setup 3G")
   3203             return False
   3204         return self._test_call_setup_in_active_data_transfer(
   3205             GEN_3G,
   3206             DIRECTION_MOBILE_TERMINATED,
   3207             allow_data_transfer_interruption=True)
   3208 
   3209     @test_tracker_info(uuid="f5d9bfd0-0996-4c18-b11e-c6113dc201e2")
   3210     @TelephonyBaseTest.tel_test_wrap
   3211     def test_call_mo_voice_2g_in_active_data_transfer(self):
   3212         """Test call can be established during active data connection.
   3213 
   3214         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3215         Make sure phone in <nw_gen>.
   3216         Starting downloading file from Internet.
   3217         Initiate a MO voice call. Verify call can be established.
   3218         Hangup Voice Call, verify file is downloaded successfully.
   3219         Note: file download will be suspended when call is initiated if voice
   3220               is using voice channel and voice channel and data channel are
   3221               on different RATs.
   3222 
   3223         Returns:
   3224             True if success.
   3225             False if failed.
   3226         """
   3227         if not phone_setup_voice_2g(self.log, self.android_devices[0]):
   3228             self.android_devices[0].log.error("Failed to setup voice in 2G")
   3229             return False
   3230         return self._test_call_setup_in_active_data_transfer(
   3231             GEN_2G,
   3232             DIRECTION_MOBILE_ORIGINATED,
   3233             allow_data_transfer_interruption=True)
   3234 
   3235     @test_tracker_info(uuid="99cfd1be-b992-48bf-a50e-fc3eec8e5a67")
   3236     @TelephonyBaseTest.tel_test_wrap
   3237     def test_call_mt_voice_2g_in_active_data_transfer(self):
   3238         """Test call can be established during active data connection.
   3239 
   3240         Turn off airplane mode, disable WiFi, enable Cellular Data.
   3241         Make sure phone in <nw_gen>.
   3242         Starting downloading file from Internet.
   3243         Initiate a MT voice call. Verify call can be established.
   3244         Hangup Voice Call, verify file is downloaded successfully.
   3245         Note: file download will be suspended when call is initiated if voice
   3246               is using voice channel and voice channel and data channel are
   3247               on different RATs.
   3248 
   3249         Returns:
   3250             True if success.
   3251             False if failed.
   3252         """
   3253         if not phone_setup_voice_2g(self.log, self.android_devices[0]):
   3254             self.android_devices[0].log.error("Failed to setup voice in 2G")
   3255             return False
   3256         return self._test_call_setup_in_active_data_transfer(
   3257             GEN_2G,
   3258             DIRECTION_MOBILE_TERMINATED,
   3259             allow_data_transfer_interruption=True)
   3260 
   3261     @test_tracker_info(uuid="12677cf2-40d3-4bb1-8afa-91ebcbd0f862")
   3262     @TelephonyBaseTest.tel_test_wrap
   3263     def test_call_mo_voice_wifi_wfc_in_active_data_transfer(self):
   3264         """Test call can be established during active data connection.
   3265 
   3266         Turn off airplane mode, turn on wfc and wifi.
   3267         Starting downloading file from Internet.
   3268         Initiate a MO voice call. Verify call can be established.
   3269         Hangup Voice Call, verify file is downloaded successfully.
   3270 
   3271         Returns:
   3272             True if success.
   3273             False if failed.
   3274         """
   3275         if not phone_setup_iwlan(self.log, self.android_devices[0], False,
   3276                                  WFC_MODE_WIFI_PREFERRED,
   3277                                  self.wifi_network_ssid,
   3278                                  self.wifi_network_pass):
   3279             self.android_devices[0].log.error(
   3280                 "Failed to setup IWLAN with NON-APM WIFI WFC on")
   3281             return False
   3282         return self._test_call_setup_in_active_data_transfer(
   3283             None, DIRECTION_MOBILE_ORIGINATED)
   3284 
   3285     @test_tracker_info(uuid="84adcc19-43bb-4ea3-9284-7322ab139aac")
   3286     @TelephonyBaseTest.tel_test_wrap
   3287     def test_call_mt_voice_wifi_wfc_in_active_data_transfer(self):
   3288         """Test call can be established during active data connection.
   3289 
   3290         Turn off airplane mode, turn on wfc and wifi.
   3291         Starting downloading file from Internet.
   3292         Initiate a MT voice call. Verify call can be established.
   3293         Hangup Voice Call, verify file is downloaded successfully.
   3294 
   3295         Returns:
   3296             True if success.
   3297             False if failed.
   3298         """
   3299         if not phone_setup_iwlan(self.log, self.android_devices[0], False,
   3300                                  WFC_MODE_WIFI_PREFERRED,
   3301                                  self.wifi_network_ssid,
   3302                                  self.wifi_network_pass):
   3303             self.android_devices[0].log.error(
   3304                 "Failed to setup iwlan with APM off and WIFI and WFC on")
   3305             return False
   3306         return self._test_call_setup_in_active_data_transfer(
   3307             None, DIRECTION_MOBILE_TERMINATED)
   3308 
   3309     @test_tracker_info(uuid="42566255-c33f-406c-abab-932a0aaa01a8")
   3310     @TelephonyBaseTest.tel_test_wrap
   3311     def test_call_mo_voice_apm_wifi_wfc_in_active_data_transfer(self):
   3312         """Test call can be established during active data connection.
   3313 
   3314         Turn on wifi-calling, airplane mode and wifi.
   3315         Starting downloading file from Internet.
   3316         Initiate a MO voice call. Verify call can be established.
   3317         Hangup Voice Call, verify file is downloaded successfully.
   3318 
   3319         Returns:
   3320             True if success.
   3321             False if failed.
   3322         """
   3323         if not phone_setup_iwlan(self.log, self.android_devices[0], True,
   3324                                  WFC_MODE_WIFI_PREFERRED,
   3325                                  self.wifi_network_ssid,
   3326                                  self.wifi_network_pass):
   3327             self.android_devices[0].log.error(
   3328                 "Failed to setup iwlan with APM, WIFI and WFC on")
   3329             return False
   3330         return self._test_call_setup_in_active_data_transfer(
   3331             None, DIRECTION_MOBILE_ORIGINATED)
   3332 
   3333     @test_tracker_info(uuid="fbf52f60-449b-46f2-9486-36d338a1b070")
   3334     @TelephonyBaseTest.tel_test_wrap
   3335     def test_call_mt_voice_apm_wifi_wfc_in_active_data_transfer(self):
   3336         """Test call can be established during active data connection.
   3337 
   3338         Turn on wifi-calling, airplane mode and wifi.
   3339         Starting downloading file from Internet.
   3340         Initiate a MT voice call. Verify call can be established.
   3341         Hangup Voice Call, verify file is downloaded successfully.
   3342 
   3343         Returns:
   3344             True if success.
   3345             False if failed.
   3346         """
   3347         if not phone_setup_iwlan(self.log, self.android_devices[0], True,
   3348                                  WFC_MODE_WIFI_PREFERRED,
   3349                                  self.wifi_network_ssid,
   3350                                  self.wifi_network_pass):
   3351             self.android_devices[0].log.error(
   3352                 "Failed to setup iwlan with APM, WIFI and WFC on")
   3353             return False
   3354         return self._test_call_setup_in_active_data_transfer(
   3355             None, DIRECTION_MOBILE_TERMINATED)
   3356 
   3357 
   3358 """ Tests End """
   3359