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 from acts.utils import load_config 22 from acts.test_utils.tel.tel_subscription_utils import \ 23 get_subid_from_slot_index 24 from acts.test_utils.tel.tel_subscription_utils import set_subid_for_data 25 from acts.test_utils.tel.tel_subscription_utils import \ 26 set_subid_for_message 27 from acts.test_utils.tel.tel_subscription_utils import \ 28 set_subid_for_outgoing_call 29 from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 30 from acts.test_utils.tel.tel_defines import CALL_STATE_ACTIVE 31 from acts.test_utils.tel.tel_defines import CALL_STATE_HOLDING 32 from acts.test_utils.tel.tel_defines import GEN_3G 33 from acts.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA 34 from acts.test_utils.tel.tel_defines import PHONE_TYPE_CDMA 35 from acts.test_utils.tel.tel_defines import PHONE_TYPE_GSM 36 from acts.test_utils.tel.tel_defines import RAT_3G 37 from acts.test_utils.tel.tel_defines import RAT_FAMILY_WLAN 38 from acts.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING 39 from acts.test_utils.tel.tel_defines import WAIT_TIME_CHANGE_DATA_SUB_ID 40 from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL 41 from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL_FOR_IMS 42 from acts.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED 43 from acts.test_utils.tel.tel_defines import WFC_MODE_DISABLED 44 from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_ONLY 45 from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED 46 from acts.test_utils.tel.tel_test_utils import call_setup_teardown 47 from acts.test_utils.tel.tel_test_utils import \ 48 call_voicemail_erase_all_pending_voicemail 49 from acts.test_utils.tel.tel_test_utils import \ 50 ensure_network_generation_for_subscription 51 from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected 52 from acts.test_utils.tel.tel_test_utils import get_phone_number 53 from acts.test_utils.tel.tel_test_utils import hangup_call 54 from acts.test_utils.tel.tel_test_utils import is_droid_in_rat_family 55 from acts.test_utils.tel.tel_test_utils import multithread_func 56 from acts.test_utils.tel.tel_test_utils import num_active_calls 57 from acts.test_utils.tel.tel_test_utils import phone_number_formatter 58 from acts.test_utils.tel.tel_test_utils import set_call_state_listen_level 59 from acts.test_utils.tel.tel_test_utils import set_phone_number 60 from acts.test_utils.tel.tel_test_utils import set_wfc_mode 61 from acts.test_utils.tel.tel_test_utils import setup_sim 62 from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode 63 from acts.test_utils.tel.tel_test_utils import verify_incall_state 64 from acts.test_utils.tel.tel_test_utils import wait_for_not_network_rat 65 from acts.test_utils.tel.tel_test_utils import WifiUtils 66 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_1x 67 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_2g 68 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_3g 69 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb 70 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan 71 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_not_iwlan 72 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_wcdma 73 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_volte 74 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_3g 75 from acts.test_utils.tel.tel_voice_utils import phone_setup_csfb 76 from acts.test_utils.tel.tel_voice_utils import phone_setup_iwlan 77 from acts.test_utils.tel.tel_voice_utils import \ 78 phone_setup_iwlan_cellular_preferred 79 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_2g 80 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_3g 81 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_general 82 from acts.test_utils.tel.tel_voice_utils import phone_setup_volte 83 from acts.test_utils.tel.tel_voice_utils import phone_idle_2g 84 from acts.test_utils.tel.tel_voice_utils import phone_idle_3g 85 from acts.test_utils.tel.tel_voice_utils import phone_idle_csfb 86 from acts.test_utils.tel.tel_voice_utils import phone_idle_iwlan 87 from acts.test_utils.tel.tel_voice_utils import phone_idle_volte 88 from acts.test_utils.tel.tel_voice_utils import two_phone_call_leave_voice_mail 89 from acts.test_utils.tel.tel_voice_utils import two_phone_call_long_seq 90 from acts.test_utils.tel.tel_voice_utils import two_phone_call_short_seq 91 92 DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION = 1 * 60 * 60 # default value 1 hour 93 94 class TelLiveVoiceTest(TelephonyBaseTest): 95 def __init__(self, controllers): 96 TelephonyBaseTest.__init__(self, controllers) 97 self.tests = ( 98 "test_call_volte_to_volte", 99 "test_call_volte_to_csfb_3g", 100 "test_call_volte_to_csfb_for_tmo", 101 "test_call_volte_to_csfb_1x_long", 102 "test_call_volte_to_csfb_long", 103 "test_call_volte_to_3g", 104 "test_call_volte_to_3g_1x_long", 105 "test_call_volte_to_3g_wcdma_long", 106 "test_call_volte_to_2g", 107 "test_call_csfb_3g_to_csfb_3g", 108 "test_call_3g_to_3g", 109 "test_call_volte_to_volte_long", 110 "test_call_csfb_3g_to_csfb_3g_long", 111 "test_call_3g_to_3g_long", 112 "test_call_volte_mo_hold_unhold", 113 "test_call_volte_mt_hold_unhold", 114 "test_call_wcdma_mo_hold_unhold", 115 "test_call_wcdma_mt_hold_unhold", 116 "test_call_csfb_mo_hold_unhold", 117 "test_call_csfb_mt_hold_unhold", 118 "test_call_volte_to_volte_7_digit_dialing", 119 "test_call_volte_to_volte_10_digit_dialing", 120 "test_call_volte_to_volte_11_digit_dialing", 121 "test_call_volte_to_volte_12_digit_dialing", 122 "test_call_volte_to_volte_loop", 123 "test_call_csfb_3g_to_csfb_3g_loop", 124 "test_call_3g_to_3g_loop", 125 126 # APM Live WFC tests 127 # epdg, WFC, APM, WiFi only, WiFi strong 128 "test_call_epdg_to_epdg_apm_wfc_wifi_only", 129 "test_call_epdg_to_volte_apm_wfc_wifi_only", 130 "test_call_epdg_to_csfb_3g_apm_wfc_wifi_only", 131 "test_call_epdg_to_3g_apm_wfc_wifi_only", 132 "test_call_epdg_to_epdg_long_apm_wfc_wifi_only", 133 "test_call_epdg_to_epdg_loop_apm_wfc_wifi_only", 134 "test_call_epdg_mo_hold_unhold_apm_wfc_wifi_only", 135 "test_call_epdg_mt_hold_unhold_apm_wfc_wifi_only", 136 # epdg, WFC, APM, WiFi preferred 137 "test_call_epdg_to_epdg_apm_wfc_wifi_preferred", 138 "test_call_epdg_to_volte_apm_wfc_wifi_preferred", 139 "test_call_epdg_to_csfb_3g_apm_wfc_wifi_preferred", 140 "test_call_epdg_to_3g_apm_wfc_wifi_preferred", 141 "test_call_epdg_to_epdg_long_apm_wfc_wifi_preferred", 142 "test_call_epdg_to_epdg_loop_apm_wfc_wifi_preferred", 143 "test_call_epdg_mo_hold_unhold_apm_wfc_wifi_preferred", 144 "test_call_epdg_mt_hold_unhold_apm_wfc_wifi_preferred", 145 # epdg, WFC, APM, Cellular preferred 146 "test_call_epdg_to_epdg_apm_wfc_cellular_preferred", 147 148 # Non-APM Live WFC tests 149 # epdg, WFC, WiFi only, WiFi strong, cell strong 150 "test_call_epdg_to_epdg_wfc_wifi_only", 151 "test_call_epdg_to_volte_wfc_wifi_only", 152 "test_call_epdg_to_csfb_3g_wfc_wifi_only", 153 "test_call_epdg_to_3g_wfc_wifi_only", 154 "test_call_epdg_to_epdg_long_wfc_wifi_only", 155 "test_call_epdg_to_epdg_loop_wfc_wifi_only", 156 "test_call_epdg_mo_hold_unhold_wfc_wifi_only", 157 "test_call_epdg_mt_hold_unhold_wfc_wifi_only", 158 # epdg, WFC, WiFi preferred 159 "test_call_epdg_to_epdg_wfc_wifi_preferred", 160 "test_call_epdg_to_volte_wfc_wifi_preferred", 161 "test_call_epdg_to_csfb_3g_wfc_wifi_preferred", 162 "test_call_epdg_to_3g_wfc_wifi_preferred", 163 "test_call_epdg_to_epdg_long_wfc_wifi_preferred", 164 "test_call_epdg_to_epdg_loop_wfc_wifi_preferred", 165 "test_call_epdg_mo_hold_unhold_wfc_wifi_preferred", 166 "test_call_epdg_mt_hold_unhold_wfc_wifi_preferred", 167 # epdg, WFC, Cellular preferred 168 "test_call_epdg_to_epdg_wfc_cellular_preferred", 169 170 # Voice Mail Indicator 171 "test_erase_all_pending_voicemail", 172 "test_voicemail_indicator_volte", 173 "test_voicemail_indicator_lte", 174 "test_voicemail_indicator_3g", 175 "test_voicemail_indicator_iwlan", 176 "test_voicemail_indicator_apm_iwlan", 177 "test_call_2g_to_3g_long", 178 "test_call_3g_to_2g_long", 179 "test_call_2g_to_2g", 180 "test_call_2g_to_2g_long", 181 "test_call_gsm_mo_hold_unhold", 182 "test_call_gsm_mt_hold_unhold", 183 184 # long duration voice call (to measure drop rate) 185 "test_call_long_duration_volte", 186 "test_call_long_duration_wfc", 187 "test_call_long_duration_3g" 188 ) 189 190 self.simconf = load_config(self.user_params["sim_conf_file"]) 191 self.stress_test_number = int(self.user_params["stress_test_number"]) 192 self.wifi_network_ssid = self.user_params["wifi_network_ssid"] 193 194 try: 195 self.wifi_network_pass = self.user_params["wifi_network_pass"] 196 except KeyError: 197 self.wifi_network_pass = None 198 199 if "long_duration_call_total_duration" in self.user_params: 200 self.long_duration_call_total_duration = self.user_params[ 201 "long_duration_call_total_duration"] 202 else: 203 self.long_duration_call_total_duration = DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION 204 205 """ Tests Begin """ 206 207 @TelephonyBaseTest.tel_test_wrap 208 def test_call_mo_voice_general(self): 209 """ General voice to voice call. 210 211 1. Make Sure PhoneA attached to voice network. 212 2. Make Sure PhoneB attached to voice network. 213 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 214 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 215 216 Returns: 217 True if pass; False if fail. 218 """ 219 ads = self.android_devices 220 221 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 222 (phone_setup_voice_general, (self.log, ads[1]))] 223 if not multithread_func(self.log, tasks): 224 self.log.error("Phone Failed to Set Up Properly.") 225 return False 226 227 return two_phone_call_short_seq( 228 self.log, ads[0], None, None, ads[1], None, None) 229 230 @TelephonyBaseTest.tel_test_wrap 231 def test_call_mt_voice_general(self): 232 """ General voice to voice call. 233 234 1. Make Sure PhoneA attached to voice network. 235 2. Make Sure PhoneB attached to voice network. 236 3. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 237 4. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 238 239 Returns: 240 True if pass; False if fail. 241 """ 242 ads = self.android_devices 243 244 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 245 (phone_setup_voice_general, (self.log, ads[1]))] 246 if not multithread_func(self.log, tasks): 247 self.log.error("Phone Failed to Set Up Properly.") 248 return False 249 250 return two_phone_call_short_seq( 251 self.log, ads[1], None, None, ads[0], None, None) 252 253 @TelephonyBaseTest.tel_test_wrap 254 def test_call_volte_to_volte(self): 255 """ VoLTE to VoLTE call test 256 257 1. Make Sure PhoneA is in LTE mode (with VoLTE). 258 2. Make Sure PhoneB is in LTE mode (with VoLTE). 259 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 260 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 261 262 Returns: 263 True if pass; False if fail. 264 """ 265 ads = self.android_devices 266 267 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 268 (self.log, ads[1]))] 269 if not multithread_func(self.log, tasks): 270 self.log.error("Phone Failed to Set Up Properly.") 271 return False 272 273 return two_phone_call_short_seq( 274 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 275 phone_idle_volte, is_phone_in_call_volte, None, 276 WAIT_TIME_IN_CALL_FOR_IMS) 277 278 @TelephonyBaseTest.tel_test_wrap 279 def test_call_volte_to_volte_7_digit_dialing(self): 280 """ VoLTE to VoLTE call test, dial with 7 digit number 281 282 1. Make Sure PhoneA is in LTE mode (with VoLTE). 283 2. Make Sure PhoneB is in LTE mode (with VoLTE). 284 3. Call from PhoneA to PhoneB by 7-digit phone number, accept on PhoneB. 285 286 Returns: 287 True if pass; False if fail. 288 """ 289 ads = self.android_devices 290 291 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 292 (self.log, ads[1]))] 293 if not multithread_func(self.log, tasks): 294 self.log.error("Phone Failed to Set Up Properly.") 295 return False 296 297 callee_default_number = get_phone_number(self.log, ads[1]) 298 caller_dialing_number = phone_number_formatter(callee_default_number, 299 7) 300 try: 301 set_phone_number(self.log, ads[1], caller_dialing_number) 302 result = call_setup_teardown( 303 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte, 304 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS) 305 except Exception as e: 306 self.log.error("Exception happened: {}".format(e)) 307 finally: 308 set_phone_number(self.log, ads[1], callee_default_number) 309 return result 310 311 @TelephonyBaseTest.tel_test_wrap 312 def test_call_volte_to_volte_10_digit_dialing(self): 313 """ VoLTE to VoLTE call test, dial with 10 digit number 314 315 1. Make Sure PhoneA is in LTE mode (with VoLTE). 316 2. Make Sure PhoneB is in LTE mode (with VoLTE). 317 3. Call from PhoneA to PhoneB by 10-digit phone number, accept on PhoneB. 318 319 Returns: 320 True if pass; False if fail. 321 """ 322 ads = self.android_devices 323 324 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 325 (self.log, ads[1]))] 326 if not multithread_func(self.log, tasks): 327 self.log.error("Phone Failed to Set Up Properly.") 328 return False 329 330 callee_default_number = get_phone_number(self.log, ads[1]) 331 caller_dialing_number = phone_number_formatter(callee_default_number, 332 10) 333 try: 334 set_phone_number(self.log, ads[1], caller_dialing_number) 335 result = call_setup_teardown( 336 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte, 337 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS) 338 except Exception as e: 339 self.log.error("Exception happened: {}".format(e)) 340 finally: 341 set_phone_number(self.log, ads[1], callee_default_number) 342 return result 343 344 @TelephonyBaseTest.tel_test_wrap 345 def test_call_volte_to_volte_11_digit_dialing(self): 346 """ VoLTE to VoLTE call test, dial with 11 digit number 347 348 1. Make Sure PhoneA is in LTE mode (with VoLTE). 349 2. Make Sure PhoneB is in LTE mode (with VoLTE). 350 3. Call from PhoneA to PhoneB by 11-digit phone number, accept on PhoneB. 351 352 Returns: 353 True if pass; False if fail. 354 """ 355 ads = self.android_devices 356 357 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 358 (self.log, ads[1]))] 359 if not multithread_func(self.log, tasks): 360 self.log.error("Phone Failed to Set Up Properly.") 361 return False 362 363 callee_default_number = get_phone_number(self.log, ads[1]) 364 caller_dialing_number = phone_number_formatter(callee_default_number, 365 11) 366 try: 367 set_phone_number(self.log, ads[1], caller_dialing_number) 368 result = call_setup_teardown( 369 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte, 370 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS) 371 except Exception as e: 372 self.log.error("Exception happened: {}".format(e)) 373 finally: 374 set_phone_number(self.log, ads[1], callee_default_number) 375 return result 376 377 @TelephonyBaseTest.tel_test_wrap 378 def test_call_volte_to_volte_12_digit_dialing(self): 379 """ VoLTE to VoLTE call test, dial with 12 digit number 380 381 1. Make Sure PhoneA is in LTE mode (with VoLTE). 382 2. Make Sure PhoneB is in LTE mode (with VoLTE). 383 3. Call from PhoneA to PhoneB by 12-digit phone number, accept on PhoneB. 384 385 Returns: 386 True if pass; False if fail. 387 """ 388 ads = self.android_devices 389 390 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 391 (self.log, ads[1]))] 392 if not multithread_func(self.log, tasks): 393 self.log.error("Phone Failed to Set Up Properly.") 394 return False 395 396 callee_default_number = get_phone_number(self.log, ads[1]) 397 caller_dialing_number = phone_number_formatter(callee_default_number, 398 12) 399 try: 400 set_phone_number(self.log, ads[1], caller_dialing_number) 401 result = call_setup_teardown( 402 self.log, ads[0], ads[1], ads[0], is_phone_in_call_volte, 403 is_phone_in_call_volte, WAIT_TIME_IN_CALL_FOR_IMS) 404 except Exception as e: 405 self.log.error("Exception happened: {}".format(e)) 406 finally: 407 set_phone_number(self.log, ads[1], callee_default_number) 408 return result 409 410 @TelephonyBaseTest.tel_test_wrap 411 def test_call_volte_to_csfb_3g(self): 412 """ VoLTE to CSFB 3G call test 413 414 1. Make Sure PhoneA is in LTE mode (with VoLTE). 415 2. Make Sure PhoneB is in LTE mode (without VoLTE). 416 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 417 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 418 419 Returns: 420 True if pass; False if fail. 421 """ 422 ads = self.android_devices 423 424 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb, 425 (self.log, ads[1]))] 426 if not multithread_func(self.log, tasks): 427 self.log.error("Phone Failed to Set Up Properly.") 428 return False 429 430 return two_phone_call_short_seq( 431 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 432 phone_idle_csfb, is_phone_in_call_csfb, None) 433 434 @TelephonyBaseTest.tel_test_wrap 435 def test_call_volte_to_csfb_for_tmo(self): 436 """ VoLTE to CSFB 3G call test for TMobile 437 438 1. Make Sure PhoneA is in LTE mode (with VoLTE). 439 2. Make Sure PhoneB is in LTE mode (without VoLTE, CSFB to WCDMA/GSM). 440 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 441 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 442 443 Returns: 444 True if pass; False if fail. 445 """ 446 ads = self.android_devices 447 448 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb, 449 (self.log, ads[1]))] 450 if not multithread_func(self.log, tasks): 451 self.log.error("Phone Failed to Set Up Properly.") 452 return False 453 454 return two_phone_call_short_seq(self.log, ads[0], phone_idle_volte, 455 None, ads[1], phone_idle_csfb, 456 is_phone_in_call_csfb, None) 457 458 @TelephonyBaseTest.tel_test_wrap 459 def test_call_volte_to_csfb_1x_long(self): 460 """ VoLTE to CSFB 1x call test 461 462 1. Make Sure PhoneA is in LTE mode (with VoLTE). 463 2. Make Sure PhoneB is in LTE mode (without VoLTE, CSFB to 1x). 464 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 465 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 466 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 467 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 468 469 Returns: 470 True if pass; False if fail. 471 """ 472 ads = self.android_devices 473 # Make Sure PhoneB is CDMA phone. 474 if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA: 475 self.log.error( 476 "PhoneB not cdma phone, can not csfb 1x. Stop test.") 477 return False 478 479 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb, 480 (self.log, ads[1]))] 481 if not multithread_func(self.log, tasks): 482 self.log.error("Phone Failed to Set Up Properly.") 483 return False 484 485 return two_phone_call_long_seq( 486 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 487 phone_idle_csfb, is_phone_in_call_1x, None) 488 489 @TelephonyBaseTest.tel_test_wrap 490 def test_call_volte_to_csfb_long(self): 491 """ VoLTE to CSFB WCDMA call test 492 493 1. Make Sure PhoneA is in LTE mode (with VoLTE). 494 2. Make Sure PhoneB is in LTE mode (without VoLTE, CSFB to WCDMA/GSM). 495 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 496 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 497 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 498 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 499 500 Returns: 501 True if pass; False if fail. 502 """ 503 ads = self.android_devices 504 # Make Sure PhoneB is GSM phone. 505 if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM: 506 self.log.error( 507 "PhoneB not gsm phone, can not csfb wcdma. Stop test.") 508 return False 509 510 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb, 511 (self.log, ads[1]))] 512 if not multithread_func(self.log, tasks): 513 self.log.error("Phone Failed to Set Up Properly.") 514 return False 515 516 return two_phone_call_long_seq( 517 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 518 phone_idle_csfb, is_phone_in_call_csfb, None) 519 520 @TelephonyBaseTest.tel_test_wrap 521 def test_call_volte_to_3g(self): 522 """ VoLTE to 3G call test 523 524 1. Make Sure PhoneA is in LTE mode (with VoLTE). 525 2. Make Sure PhoneB is in 3G mode. 526 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 527 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 528 529 Returns: 530 True if pass; False if fail. 531 """ 532 ads = self.android_devices 533 534 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_voice_3g, 535 (self.log, ads[1]))] 536 if not multithread_func(self.log, tasks): 537 self.log.error("Phone Failed to Set Up Properly.") 538 return False 539 540 return two_phone_call_short_seq( 541 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 542 phone_idle_3g, is_phone_in_call_3g, None) 543 544 @TelephonyBaseTest.tel_test_wrap 545 def test_call_volte_to_3g_1x_long(self): 546 """ VoLTE to 3G 1x call test 547 548 1. Make Sure PhoneA is in LTE mode (with VoLTE). 549 2. Make Sure PhoneB is in 3G 1x mode. 550 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 551 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 552 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 553 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 554 555 Returns: 556 True if pass; False if fail. 557 """ 558 ads = self.android_devices 559 # Make Sure PhoneB is CDMA phone. 560 if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA: 561 self.log.error("PhoneB not cdma phone, can not 3g 1x. Stop test.") 562 return False 563 564 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_voice_3g, 565 (self.log, ads[1]))] 566 if not multithread_func(self.log, tasks): 567 self.log.error("Phone Failed to Set Up Properly.") 568 return False 569 570 return two_phone_call_long_seq( 571 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 572 phone_idle_3g, is_phone_in_call_1x, None) 573 574 @TelephonyBaseTest.tel_test_wrap 575 def test_call_volte_to_3g_wcdma_long(self): 576 """ VoLTE to 3G WCDMA call test 577 578 1. Make Sure PhoneA is in LTE mode (with VoLTE). 579 2. Make Sure PhoneB is in 3G WCDMA mode. 580 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 581 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 582 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 583 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 584 585 Returns: 586 True if pass; False if fail. 587 """ 588 ads = self.android_devices 589 # Make Sure PhoneB is GSM phone. 590 if ads[1].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM: 591 self.log.error( 592 "PhoneB not gsm phone, can not 3g wcdma. Stop test.") 593 return False 594 595 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_voice_3g, 596 (self.log, ads[1]))] 597 if not multithread_func(self.log, tasks): 598 self.log.error("Phone Failed to Set Up Properly.") 599 return False 600 601 return two_phone_call_long_seq( 602 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 603 phone_idle_3g, is_phone_in_call_wcdma, None) 604 605 @TelephonyBaseTest.tel_test_wrap 606 def test_call_volte_to_2g(self): 607 """ VoLTE to 2G call test 608 609 1. Make Sure PhoneA is in LTE mode (with VoLTE). 610 2. Make Sure PhoneB is in 2G mode. 611 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 612 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 613 614 Returns: 615 True if pass; False if fail. 616 """ 617 ads = self.android_devices 618 619 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_voice_2g, 620 (self.log, ads[1]))] 621 if not multithread_func(self.log, tasks): 622 self.log.error("Phone Failed to Set Up Properly.") 623 return False 624 625 return two_phone_call_short_seq( 626 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 627 phone_idle_2g, is_phone_in_call_2g, None) 628 629 def _call_epdg_to_epdg_wfc(self, ads, apm_mode, wfc_mode, wifi_ssid, 630 wifi_pwd): 631 """ Test epdg<->epdg call functionality. 632 633 Make Sure PhoneA is set to make epdg call. 634 Make Sure PhoneB is set to make epdg call. 635 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 636 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 637 638 Args: 639 ads: list of android objects, this list should have two ad. 640 apm_mode: phones' airplane mode. 641 if True, phones are in airplane mode during test. 642 if False, phones are not in airplane mode during test. 643 wfc_mode: phones' wfc mode. 644 Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED, 645 WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED. 646 wifi_ssid: WiFi ssid to connect during test. 647 wifi_pwd: WiFi password. 648 649 Returns: 650 True if pass; False if fail. 651 """ 652 653 tasks = [(phone_setup_iwlan, 654 (self.log, ads[0], apm_mode, wfc_mode, wifi_ssid, wifi_pwd)), 655 (phone_setup_iwlan, 656 (self.log, ads[1], apm_mode, wfc_mode, wifi_ssid, wifi_pwd))] 657 if not multithread_func(self.log, tasks): 658 self.log.error("Phone Failed to Set Up Properly.") 659 return False 660 661 return two_phone_call_short_seq( 662 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 663 phone_idle_iwlan, is_phone_in_call_iwlan, None, 664 WAIT_TIME_IN_CALL_FOR_IMS) 665 666 @TelephonyBaseTest.tel_test_wrap 667 def test_call_epdg_to_epdg_wfc_wifi_only(self): 668 """ WiFi Only, WiFi calling to WiFi Calling test 669 670 1. Setup PhoneA WFC mode: WIFI_ONLY. 671 2. Setup PhoneB WFC mode: WIFI_ONLY. 672 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 673 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 674 675 Returns: 676 True if pass; False if fail. 677 """ 678 return self._call_epdg_to_epdg_wfc( 679 self.android_devices, False, WFC_MODE_WIFI_ONLY, 680 self.wifi_network_ssid, self.wifi_network_pass) 681 682 @TelephonyBaseTest.tel_test_wrap 683 def test_call_epdg_to_epdg_wfc_wifi_preferred(self): 684 """ WiFi Preferred, WiFi calling to WiFi Calling test 685 686 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 687 2. Setup PhoneB WFC mode: WIFI_PREFERRED. 688 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 689 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 690 691 Returns: 692 True if pass; False if fail. 693 """ 694 return self._call_epdg_to_epdg_wfc( 695 self.android_devices, False, WFC_MODE_WIFI_PREFERRED, 696 self.wifi_network_ssid, self.wifi_network_pass) 697 698 @TelephonyBaseTest.tel_test_wrap 699 def test_call_epdg_to_epdg_wfc_cellular_preferred(self): 700 """ Cellular Preferred, WiFi calling to WiFi Calling test 701 702 1. Setup PhoneA WFC mode: CELLULAR_PREFERRED. 703 2. Setup PhoneB WFC mode: CELLULAR_PREFERRED. 704 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 705 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 706 707 Returns: 708 True if pass; False if fail. 709 """ 710 ads = [self.android_devices[0], self.android_devices[1]] 711 tasks = [(phone_setup_iwlan_cellular_preferred, ( 712 self.log, ads[0], self.wifi_network_ssid, self.wifi_network_pass)), 713 (phone_setup_iwlan_cellular_preferred, 714 (self.log, ads[1], self.wifi_network_ssid, 715 self.wifi_network_pass))] 716 if not multithread_func(self.log, tasks): 717 self.log.error("Phone Failed to Set Up Properly.") 718 return False 719 720 return two_phone_call_short_seq( 721 self.log, ads[0], None, is_phone_in_call_not_iwlan, ads[1], None, 722 is_phone_in_call_not_iwlan, None, WAIT_TIME_IN_CALL_FOR_IMS) 723 724 @TelephonyBaseTest.tel_test_wrap 725 def test_call_epdg_to_epdg_apm_wfc_wifi_only(self): 726 """ Airplane + WiFi Only, WiFi calling to WiFi Calling test 727 728 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 729 2. Setup PhoneB in airplane mode, WFC mode: WIFI_ONLY. 730 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 731 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 732 733 Returns: 734 True if pass; False if fail. 735 """ 736 return self._call_epdg_to_epdg_wfc( 737 self.android_devices, True, WFC_MODE_WIFI_ONLY, 738 self.wifi_network_ssid, self.wifi_network_pass) 739 740 @TelephonyBaseTest.tel_test_wrap 741 def test_call_epdg_to_epdg_apm_wfc_wifi_preferred(self): 742 """ Airplane + WiFi Preferred, WiFi calling to WiFi Calling test 743 744 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED. 745 2. Setup PhoneB in airplane mode, WFC mode: WIFI_PREFERRED. 746 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 747 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 748 749 Returns: 750 True if pass; False if fail. 751 """ 752 return self._call_epdg_to_epdg_wfc( 753 self.android_devices, True, WFC_MODE_WIFI_PREFERRED, 754 self.wifi_network_ssid, self.wifi_network_pass) 755 756 @TelephonyBaseTest.tel_test_wrap 757 def test_call_epdg_to_epdg_apm_wfc_cellular_preferred(self): 758 """ Airplane + Cellular Preferred, WiFi calling to WiFi Calling test 759 760 1. Setup PhoneA in airplane mode, WFC mode: CELLULAR_PREFERRED. 761 2. Setup PhoneB in airplane mode, WFC mode: CELLULAR_PREFERRED. 762 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 763 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 764 765 Returns: 766 True if pass; False if fail. 767 """ 768 return self._call_epdg_to_epdg_wfc( 769 self.android_devices, True, WFC_MODE_CELLULAR_PREFERRED, 770 self.wifi_network_ssid, self.wifi_network_pass) 771 772 @TelephonyBaseTest.tel_test_wrap 773 def test_call_epdg_to_volte_wfc_wifi_only(self): 774 """ WiFi Only, WiFi calling to VoLTE test 775 776 1. Setup PhoneA WFC mode: WIFI_ONLY. 777 2. Make Sure PhoneB is in LTE mode (with VoLTE enabled). 778 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 779 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 780 781 Returns: 782 True if pass; False if fail. 783 """ 784 ads = self.android_devices 785 786 tasks = [(phone_setup_iwlan, 787 (self.log, ads[0], False, WFC_MODE_WIFI_ONLY, 788 self.wifi_network_ssid, self.wifi_network_pass)), 789 (phone_setup_volte, (self.log, ads[1]))] 790 if not multithread_func(self.log, tasks): 791 self.log.error("Phone Failed to Set Up Properly.") 792 return False 793 794 return two_phone_call_short_seq( 795 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 796 phone_idle_volte, is_phone_in_call_volte, None, 797 WAIT_TIME_IN_CALL_FOR_IMS) 798 799 @TelephonyBaseTest.tel_test_wrap 800 def test_call_epdg_to_volte_wfc_wifi_preferred(self): 801 """ WiFi Preferred, WiFi calling to VoLTE test 802 803 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 804 2. Make Sure PhoneB is in LTE mode (with VoLTE enabled). 805 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 806 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 807 808 Returns: 809 True if pass; False if fail. 810 """ 811 ads = self.android_devices 812 813 tasks = [(phone_setup_iwlan, 814 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, 815 self.wifi_network_ssid, self.wifi_network_pass)), 816 (phone_setup_volte, (self.log, ads[1]))] 817 if not multithread_func(self.log, tasks): 818 self.log.error("Phone Failed to Set Up Properly.") 819 return False 820 821 return two_phone_call_short_seq( 822 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 823 phone_idle_volte, is_phone_in_call_volte, None, 824 WAIT_TIME_IN_CALL_FOR_IMS) 825 826 @TelephonyBaseTest.tel_test_wrap 827 def test_call_epdg_to_volte_apm_wfc_wifi_only(self): 828 """ Airplane + WiFi Only, WiFi calling to VoLTE test 829 830 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 831 2. Make Sure PhoneB is in LTE mode (with VoLTE enabled). 832 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 833 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 834 835 Returns: 836 True if pass; False if fail. 837 """ 838 ads = self.android_devices 839 840 tasks = [(phone_setup_iwlan, 841 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY, 842 self.wifi_network_ssid, self.wifi_network_pass)), 843 (phone_setup_volte, (self.log, ads[1]))] 844 if not multithread_func(self.log, tasks): 845 self.log.error("Phone Failed to Set Up Properly.") 846 return False 847 848 return two_phone_call_short_seq( 849 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 850 phone_idle_volte, is_phone_in_call_volte, None, 851 WAIT_TIME_IN_CALL_FOR_IMS) 852 853 @TelephonyBaseTest.tel_test_wrap 854 def test_call_epdg_to_volte_apm_wfc_wifi_preferred(self): 855 """ Airplane + WiFi Preferred, WiFi calling to VoLTE test 856 857 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED. 858 2. Make Sure PhoneB is in LTE mode (with VoLTE enabled). 859 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 860 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 861 862 Returns: 863 True if pass; False if fail. 864 """ 865 ads = self.android_devices 866 867 tasks = [(phone_setup_iwlan, 868 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 869 self.wifi_network_ssid, self.wifi_network_pass)), 870 (phone_setup_volte, (self.log, ads[1]))] 871 if not multithread_func(self.log, tasks): 872 self.log.error("Phone Failed to Set Up Properly.") 873 return False 874 875 return two_phone_call_short_seq( 876 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 877 phone_idle_volte, is_phone_in_call_volte, None, 878 WAIT_TIME_IN_CALL_FOR_IMS) 879 880 @TelephonyBaseTest.tel_test_wrap 881 def test_call_epdg_to_csfb_3g_wfc_wifi_only(self): 882 """ WiFi Only, WiFi calling to CSFB 3G test 883 884 1. Setup PhoneA WFC mode: WIFI_ONLY. 885 2. Make Sure PhoneB is in LTE mode (with VoLTE disabled). 886 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 887 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 888 889 Returns: 890 True if pass; False if fail. 891 """ 892 ads = self.android_devices 893 894 tasks = [(phone_setup_iwlan, 895 (self.log, ads[0], False, WFC_MODE_WIFI_ONLY, 896 self.wifi_network_ssid, self.wifi_network_pass)), 897 (phone_setup_csfb, (self.log, ads[1]))] 898 if not multithread_func(self.log, tasks): 899 self.log.error("Phone Failed to Set Up Properly.") 900 return False 901 902 return two_phone_call_short_seq( 903 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 904 phone_idle_csfb, is_phone_in_call_csfb, None) 905 906 @TelephonyBaseTest.tel_test_wrap 907 def test_call_epdg_to_csfb_3g_wfc_wifi_preferred(self): 908 """ WiFi Preferred, WiFi calling to CSFB 3G test 909 910 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 911 2. Make Sure PhoneB is in LTE mode (with VoLTE disabled). 912 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 913 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 914 915 Returns: 916 True if pass; False if fail. 917 """ 918 ads = self.android_devices 919 920 tasks = [(phone_setup_iwlan, 921 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, 922 self.wifi_network_ssid, self.wifi_network_pass)), 923 (phone_setup_csfb, (self.log, ads[1]))] 924 if not multithread_func(self.log, tasks): 925 self.log.error("Phone Failed to Set Up Properly.") 926 return False 927 928 return two_phone_call_short_seq( 929 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 930 phone_idle_csfb, is_phone_in_call_csfb, None) 931 932 @TelephonyBaseTest.tel_test_wrap 933 def test_call_epdg_to_csfb_3g_apm_wfc_wifi_only(self): 934 """ Airplane + WiFi Only, WiFi calling to CSFB 3G test 935 936 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 937 2. Make Sure PhoneB is in LTE mode (with VoLTE disabled). 938 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 939 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 940 941 Returns: 942 True if pass; False if fail. 943 """ 944 ads = self.android_devices 945 946 tasks = [(phone_setup_iwlan, 947 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY, 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 @TelephonyBaseTest.tel_test_wrap 959 def test_call_epdg_to_csfb_3g_apm_wfc_wifi_preferred(self): 960 """ Airplane + WiFi Preferred, WiFi calling to CSFB 3G test 961 962 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED. 963 2. Make Sure PhoneB is in LTE mode (with VoLTE disabled). 964 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 965 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 966 967 Returns: 968 True if pass; False if fail. 969 """ 970 ads = self.android_devices 971 972 tasks = [(phone_setup_iwlan, 973 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 974 self.wifi_network_ssid, self.wifi_network_pass)), 975 (phone_setup_csfb, (self.log, ads[1]))] 976 if not multithread_func(self.log, tasks): 977 self.log.error("Phone Failed to Set Up Properly.") 978 return False 979 980 return two_phone_call_short_seq( 981 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 982 phone_idle_csfb, is_phone_in_call_csfb, None) 983 984 @TelephonyBaseTest.tel_test_wrap 985 def test_call_epdg_to_3g_wfc_wifi_only(self): 986 """ WiFi Only, WiFi calling to 3G test 987 988 1. Setup PhoneA WFC mode: WIFI_ONLY. 989 2. Make Sure PhoneB is in 3G mode. 990 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 991 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 992 993 Returns: 994 True if pass; False if fail. 995 """ 996 ads = self.android_devices 997 998 tasks = [(phone_setup_iwlan, 999 (self.log, ads[0], False, WFC_MODE_WIFI_ONLY, 1000 self.wifi_network_ssid, self.wifi_network_pass)), 1001 (phone_setup_voice_3g, (self.log, ads[1]))] 1002 if not multithread_func(self.log, tasks): 1003 self.log.error("Phone Failed to Set Up Properly.") 1004 return False 1005 1006 return two_phone_call_short_seq( 1007 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1008 phone_idle_3g, is_phone_in_call_3g, None) 1009 1010 @TelephonyBaseTest.tel_test_wrap 1011 def test_call_epdg_to_3g_wfc_wifi_preferred(self): 1012 """ WiFi Preferred, WiFi calling to 3G test 1013 1014 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 1015 2. Make Sure PhoneB is in 3G mode. 1016 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1017 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1018 1019 Returns: 1020 True if pass; False if fail. 1021 """ 1022 ads = self.android_devices 1023 1024 tasks = [(phone_setup_iwlan, 1025 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, 1026 self.wifi_network_ssid, self.wifi_network_pass)), 1027 (phone_setup_voice_3g, (self.log, ads[1]))] 1028 if not multithread_func(self.log, tasks): 1029 self.log.error("Phone Failed to Set Up Properly.") 1030 return False 1031 1032 return two_phone_call_short_seq( 1033 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1034 phone_idle_3g, is_phone_in_call_3g, None) 1035 1036 @TelephonyBaseTest.tel_test_wrap 1037 def test_call_epdg_to_3g_apm_wfc_wifi_only(self): 1038 """ Airplane + WiFi Only, WiFi calling to 3G test 1039 1040 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 1041 2. Make Sure PhoneB is in 3G mode. 1042 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1043 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1044 1045 Returns: 1046 True if pass; False if fail. 1047 """ 1048 ads = self.android_devices 1049 1050 tasks = [(phone_setup_iwlan, 1051 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY, 1052 self.wifi_network_ssid, self.wifi_network_pass)), 1053 (phone_setup_voice_3g, (self.log, ads[1]))] 1054 if not multithread_func(self.log, tasks): 1055 self.log.error("Phone Failed to Set Up Properly.") 1056 return False 1057 1058 return two_phone_call_short_seq( 1059 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1060 phone_idle_3g, is_phone_in_call_3g, None) 1061 1062 @TelephonyBaseTest.tel_test_wrap 1063 def test_call_epdg_to_3g_apm_wfc_wifi_preferred(self): 1064 """ Airplane + WiFi Preferred, WiFi calling to 3G test 1065 1066 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED. 1067 2. Make Sure PhoneB is in 3G mode. 1068 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1069 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1070 1071 Returns: 1072 True if pass; False if fail. 1073 """ 1074 ads = self.android_devices 1075 1076 tasks = [(phone_setup_iwlan, 1077 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1078 self.wifi_network_ssid, self.wifi_network_pass)), 1079 (phone_setup_voice_3g, (self.log, ads[1]))] 1080 if not multithread_func(self.log, tasks): 1081 self.log.error("Phone Failed to Set Up Properly.") 1082 return False 1083 1084 return two_phone_call_short_seq( 1085 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1086 phone_idle_3g, is_phone_in_call_3g, None) 1087 1088 @TelephonyBaseTest.tel_test_wrap 1089 def test_call_csfb_3g_to_csfb_3g(self): 1090 """ CSFB 3G to CSFB 3G call test 1091 1092 1. Make Sure PhoneA is in LTE mode, VoLTE disabled. 1093 2. Make Sure PhoneB is in LTE mode, VoLTE disabled. 1094 3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA. 1095 4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB. 1096 1097 Returns: 1098 True if pass; False if fail. 1099 """ 1100 ads = self.android_devices 1101 1102 tasks = [(phone_setup_csfb, (self.log, ads[0])), (phone_setup_csfb, 1103 (self.log, ads[1]))] 1104 if not multithread_func(self.log, tasks): 1105 self.log.error("Phone Failed to Set Up Properly.") 1106 return False 1107 1108 return two_phone_call_short_seq( 1109 self.log, ads[0], phone_idle_csfb, is_phone_in_call_csfb, ads[1], 1110 phone_idle_csfb, is_phone_in_call_csfb, None) 1111 1112 @TelephonyBaseTest.tel_test_wrap 1113 def test_call_3g_to_3g(self): 1114 """ 3G to 3G call test 1115 1116 1. Make Sure PhoneA is in 3G mode. 1117 2. Make Sure PhoneB is in 3G mode. 1118 3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA. 1119 4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB. 1120 1121 Returns: 1122 True if pass; False if fail. 1123 """ 1124 ads = self.android_devices 1125 1126 tasks = [(phone_setup_voice_3g, (self.log, ads[0])), (phone_setup_voice_3g, 1127 (self.log, ads[1]))] 1128 if not multithread_func(self.log, tasks): 1129 self.log.error("Phone Failed to Set Up Properly.") 1130 return False 1131 1132 return two_phone_call_short_seq( 1133 self.log, ads[0], phone_idle_3g, is_phone_in_call_3g, ads[1], 1134 phone_idle_3g, is_phone_in_call_3g, None) 1135 1136 @TelephonyBaseTest.tel_test_wrap 1137 def test_call_volte_to_volte_long(self): 1138 """ VoLTE to VoLTE call test 1139 1140 1. Make Sure PhoneA is in LTE mode (with VoLTE). 1141 2. Make Sure PhoneB is in LTE mode (with VoLTE). 1142 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1143 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1144 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1145 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1146 1147 Returns: 1148 True if pass; False if fail. 1149 """ 1150 ads = self.android_devices 1151 1152 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 1153 (self.log, ads[1]))] 1154 if not multithread_func(self.log, tasks): 1155 self.log.error("Phone Failed to Set Up Properly.") 1156 return False 1157 1158 return two_phone_call_long_seq( 1159 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1], 1160 phone_idle_volte, is_phone_in_call_volte, None, 1161 WAIT_TIME_IN_CALL_FOR_IMS) 1162 1163 @TelephonyBaseTest.tel_test_wrap 1164 def test_call_epdg_to_epdg_long_wfc_wifi_only(self): 1165 """ WiFi Only, WiFi calling to WiFi Calling test 1166 1167 1. Setup PhoneA WFC mode: WIFI_ONLY. 1168 2. Setup PhoneB WFC mode: WIFI_ONLY. 1169 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1170 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1171 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1172 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1173 1174 Returns: 1175 True if pass; False if fail. 1176 """ 1177 ads = self.android_devices 1178 1179 tasks = [(phone_setup_iwlan, 1180 (self.log, ads[0], False, WFC_MODE_WIFI_ONLY, 1181 self.wifi_network_ssid, self.wifi_network_pass)), 1182 (phone_setup_iwlan, 1183 (self.log, ads[1], False, WFC_MODE_WIFI_ONLY, 1184 self.wifi_network_ssid, self.wifi_network_pass))] 1185 if not multithread_func(self.log, tasks): 1186 self.log.error("Phone Failed to Set Up Properly.") 1187 return False 1188 1189 return two_phone_call_long_seq( 1190 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1191 phone_idle_iwlan, is_phone_in_call_iwlan, None, 1192 WAIT_TIME_IN_CALL_FOR_IMS) 1193 1194 @TelephonyBaseTest.tel_test_wrap 1195 def test_call_epdg_to_epdg_long_wfc_wifi_preferred(self): 1196 """ WiFi Preferred, WiFi calling to WiFi Calling test 1197 1198 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 1199 2. Setup PhoneB WFC mode: WIFI_PREFERRED. 1200 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1201 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1202 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1203 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1204 1205 Returns: 1206 True if pass; False if fail. 1207 """ 1208 ads = self.android_devices 1209 1210 tasks = [(phone_setup_iwlan, 1211 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, 1212 self.wifi_network_ssid, self.wifi_network_pass)), 1213 (phone_setup_iwlan, 1214 (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED, 1215 self.wifi_network_ssid, self.wifi_network_pass))] 1216 if not multithread_func(self.log, tasks): 1217 self.log.error("Phone Failed to Set Up Properly.") 1218 return False 1219 1220 return two_phone_call_long_seq( 1221 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1222 phone_idle_iwlan, is_phone_in_call_iwlan, None, 1223 WAIT_TIME_IN_CALL_FOR_IMS) 1224 1225 @TelephonyBaseTest.tel_test_wrap 1226 def test_call_epdg_to_epdg_long_apm_wfc_wifi_only(self): 1227 """ Airplane + WiFi Only, WiFi calling to WiFi Calling test 1228 1229 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 1230 2. Setup PhoneB in airplane mode, WFC mode: WIFI_ONLY. 1231 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1232 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1233 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1234 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1235 1236 Returns: 1237 True if pass; False if fail. 1238 """ 1239 ads = self.android_devices 1240 1241 tasks = [(phone_setup_iwlan, 1242 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY, 1243 self.wifi_network_ssid, self.wifi_network_pass)), 1244 (phone_setup_iwlan, 1245 (self.log, ads[1], True, WFC_MODE_WIFI_ONLY, 1246 self.wifi_network_ssid, self.wifi_network_pass))] 1247 if not multithread_func(self.log, tasks): 1248 self.log.error("Phone Failed to Set Up Properly.") 1249 return False 1250 1251 return two_phone_call_long_seq( 1252 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1253 phone_idle_iwlan, is_phone_in_call_iwlan, None, 1254 WAIT_TIME_IN_CALL_FOR_IMS) 1255 1256 @TelephonyBaseTest.tel_test_wrap 1257 def test_call_epdg_to_epdg_long_apm_wfc_wifi_preferred(self): 1258 """ Airplane + WiFi Preferred, WiFi calling to WiFi Calling test 1259 1260 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED. 1261 2. Setup PhoneB in airplane mode, WFC mode: WIFI_PREFERRED. 1262 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1263 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1264 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1265 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1266 1267 Returns: 1268 True if pass; False if fail. 1269 """ 1270 ads = self.android_devices 1271 1272 tasks = [(phone_setup_iwlan, 1273 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1274 self.wifi_network_ssid, self.wifi_network_pass)), 1275 (phone_setup_iwlan, 1276 (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED, 1277 self.wifi_network_ssid, self.wifi_network_pass))] 1278 if not multithread_func(self.log, tasks): 1279 self.log.error("Phone Failed to Set Up Properly.") 1280 return False 1281 1282 return two_phone_call_long_seq( 1283 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1], 1284 phone_idle_iwlan, is_phone_in_call_iwlan, None, 1285 WAIT_TIME_IN_CALL_FOR_IMS) 1286 1287 @TelephonyBaseTest.tel_test_wrap 1288 def test_call_csfb_3g_to_csfb_3g_long(self): 1289 """ CSFB 3G to CSFB 3G call test 1290 1291 1. Make Sure PhoneA is in LTE mode, VoLTE disabled. 1292 2. Make Sure PhoneB is in LTE mode, VoLTE disabled. 1293 3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA. 1294 4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB. 1295 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1296 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1297 1298 Returns: 1299 True if pass; False if fail. 1300 """ 1301 ads = self.android_devices 1302 1303 tasks = [(phone_setup_csfb, (self.log, ads[0])), (phone_setup_csfb, 1304 (self.log, ads[1]))] 1305 if not multithread_func(self.log, tasks): 1306 self.log.error("Phone Failed to Set Up Properly.") 1307 return False 1308 1309 return two_phone_call_long_seq( 1310 self.log, ads[0], phone_idle_csfb, is_phone_in_call_csfb, ads[1], 1311 phone_idle_csfb, is_phone_in_call_csfb, None) 1312 1313 @TelephonyBaseTest.tel_test_wrap 1314 def test_call_3g_to_3g_long(self): 1315 """ 3G to 3G call test 1316 1317 1. Make Sure PhoneA is in 3G mode. 1318 2. Make Sure PhoneB is in 3G mode. 1319 3. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneA. 1320 4. Call from PhoneA to PhoneB, accept on PhoneA, hang up on PhoneB. 1321 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1322 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1323 1324 Returns: 1325 True if pass; False if fail. 1326 """ 1327 ads = self.android_devices 1328 1329 tasks = [(phone_setup_voice_3g, (self.log, ads[0])), (phone_setup_voice_3g, 1330 (self.log, ads[1]))] 1331 if not multithread_func(self.log, tasks): 1332 self.log.error("Phone Failed to Set Up Properly.") 1333 return False 1334 1335 return two_phone_call_long_seq( 1336 self.log, ads[0], phone_idle_3g, is_phone_in_call_3g, ads[1], 1337 phone_idle_3g, is_phone_in_call_3g, None) 1338 1339 @TelephonyBaseTest.tel_test_wrap 1340 def test_call_volte_to_volte_loop(self): 1341 """ Stress test: VoLTE to VoLTE call test 1342 1343 1. Make Sure PhoneA is in LTE mode (with VoLTE). 1344 2. Make Sure PhoneB is in LTE mode (with VoLTE). 1345 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1346 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1347 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1348 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1349 7. Repeat step 3~6. 1350 1351 Returns: 1352 True if pass; False if fail. 1353 """ 1354 1355 # TODO: b/26338422 Make this a parameter 1356 MINIMUM_SUCCESS_RATE = .95 1357 ads = self.android_devices 1358 1359 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 1360 (self.log, ads[1]))] 1361 if not multithread_func(self.log, tasks): 1362 self.log.error("Phone Failed to Set Up Properly.") 1363 return False 1364 1365 success_count = 0 1366 fail_count = 0 1367 1368 for i in range(1, self.stress_test_number + 1): 1369 1370 if two_phone_call_long_seq( 1371 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, 1372 ads[1], phone_idle_volte, is_phone_in_call_volte, None, 1373 WAIT_TIME_IN_CALL_FOR_IMS): 1374 success_count += 1 1375 result_str = "Succeeded" 1376 1377 else: 1378 fail_count += 1 1379 result_str = "Failed" 1380 1381 self.log.info("Iteration {} {}. Current: {} / {} passed.".format( 1382 i, result_str, success_count, self.stress_test_number)) 1383 1384 self.log.info("Final Count - Success: {}, Failure: {} - {}%".format( 1385 success_count, fail_count, str(100 * success_count / ( 1386 success_count + fail_count)))) 1387 if success_count / ( 1388 success_count + fail_count) >= MINIMUM_SUCCESS_RATE: 1389 return True 1390 else: 1391 return False 1392 1393 @TelephonyBaseTest.tel_test_wrap 1394 def test_call_epdg_to_epdg_loop_wfc_wifi_only(self): 1395 """ Stress test: WiFi Only, WiFi calling to WiFi Calling test 1396 1397 1. Setup PhoneA WFC mode: WIFI_ONLY. 1398 2. Setup PhoneB WFC mode: WIFI_ONLY. 1399 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1400 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1401 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1402 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1403 7. Repeat step 3~6. 1404 1405 Returns: 1406 True if pass; False if fail. 1407 """ 1408 1409 # TODO: b/26338422 Make this a parameter 1410 MINIMUM_SUCCESS_RATE = .95 1411 ads = self.android_devices 1412 1413 tasks = [(phone_setup_iwlan, 1414 (self.log, ads[0], False, WFC_MODE_WIFI_ONLY, 1415 self.wifi_network_ssid, self.wifi_network_pass)), 1416 (phone_setup_iwlan, 1417 (self.log, ads[1], False, WFC_MODE_WIFI_ONLY, 1418 self.wifi_network_ssid, self.wifi_network_pass))] 1419 if not multithread_func(self.log, tasks): 1420 self.log.error("Phone Failed to Set Up Properly.") 1421 return False 1422 1423 success_count = 0 1424 fail_count = 0 1425 1426 for i in range(1, self.stress_test_number + 1): 1427 1428 if two_phone_call_long_seq( 1429 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, 1430 ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None, 1431 WAIT_TIME_IN_CALL_FOR_IMS): 1432 success_count += 1 1433 result_str = "Succeeded" 1434 1435 else: 1436 fail_count += 1 1437 result_str = "Failed" 1438 1439 self.log.info("Iteration {} {}. Current: {} / {} passed.".format( 1440 i, result_str, success_count, self.stress_test_number)) 1441 1442 self.log.info("Final Count - Success: {}, Failure: {} - {}%".format( 1443 success_count, fail_count, str(100 * success_count / ( 1444 success_count + fail_count)))) 1445 if success_count / ( 1446 success_count + fail_count) >= MINIMUM_SUCCESS_RATE: 1447 return True 1448 else: 1449 return False 1450 1451 @TelephonyBaseTest.tel_test_wrap 1452 def test_call_epdg_to_epdg_loop_wfc_wifi_preferred(self): 1453 """ Stress test: WiFi Preferred, WiFi Calling to WiFi Calling test 1454 1455 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 1456 2. Setup PhoneB WFC mode: WIFI_PREFERRED. 1457 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1458 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1459 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1460 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1461 7. Repeat step 3~6. 1462 1463 Returns: 1464 True if pass; False if fail. 1465 """ 1466 1467 # TODO: b/26338422 Make this a parameter 1468 MINIMUM_SUCCESS_RATE = .95 1469 ads = self.android_devices 1470 1471 tasks = [(phone_setup_iwlan, 1472 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, 1473 self.wifi_network_ssid, self.wifi_network_pass)), 1474 (phone_setup_iwlan, 1475 (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED, 1476 self.wifi_network_ssid, self.wifi_network_pass))] 1477 if not multithread_func(self.log, tasks): 1478 self.log.error("Phone Failed to Set Up Properly.") 1479 return False 1480 1481 success_count = 0 1482 fail_count = 0 1483 1484 for i in range(1, self.stress_test_number + 1): 1485 1486 if two_phone_call_long_seq( 1487 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, 1488 ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None, 1489 WAIT_TIME_IN_CALL_FOR_IMS): 1490 success_count += 1 1491 result_str = "Succeeded" 1492 1493 else: 1494 fail_count += 1 1495 result_str = "Failed" 1496 1497 self.log.info("Iteration {} {}. Current: {} / {} passed.".format( 1498 i, result_str, success_count, self.stress_test_number)) 1499 1500 self.log.info("Final Count - Success: {}, Failure: {} - {}%".format( 1501 success_count, fail_count, str(100 * success_count / ( 1502 success_count + fail_count)))) 1503 if success_count / ( 1504 success_count + fail_count) >= MINIMUM_SUCCESS_RATE: 1505 return True 1506 else: 1507 return False 1508 1509 @TelephonyBaseTest.tel_test_wrap 1510 def test_call_epdg_to_epdg_loop_apm_wfc_wifi_only(self): 1511 """ Stress test: Airplane + WiFi Only, WiFi Calling to WiFi Calling test 1512 1513 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 1514 2. Setup PhoneB in airplane mode, WFC mode: WIFI_ONLY. 1515 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1516 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1517 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1518 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1519 7. Repeat step 3~6. 1520 1521 Returns: 1522 True if pass; False if fail. 1523 """ 1524 1525 # TODO: b/26338422 Make this a parameter 1526 MINIMUM_SUCCESS_RATE = .95 1527 ads = self.android_devices 1528 1529 tasks = [(phone_setup_iwlan, 1530 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY, 1531 self.wifi_network_ssid, self.wifi_network_pass)), 1532 (phone_setup_iwlan, 1533 (self.log, ads[1], True, WFC_MODE_WIFI_ONLY, 1534 self.wifi_network_ssid, self.wifi_network_pass))] 1535 if not multithread_func(self.log, tasks): 1536 self.log.error("Phone Failed to Set Up Properly.") 1537 return False 1538 1539 success_count = 0 1540 fail_count = 0 1541 1542 for i in range(1, self.stress_test_number + 1): 1543 1544 if two_phone_call_long_seq( 1545 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, 1546 ads[1], phone_idle_iwlan, is_phone_in_call_iwlan, None, 1547 WAIT_TIME_IN_CALL_FOR_IMS): 1548 success_count += 1 1549 result_str = "Succeeded" 1550 1551 else: 1552 fail_count += 1 1553 result_str = "Failed" 1554 1555 self.log.info("Iteration {} {}. Current: {} / {} passed.".format( 1556 i, result_str, success_count, self.stress_test_number)) 1557 1558 self.log.info("Final Count - Success: {}, Failure: {} - {}%".format( 1559 success_count, fail_count, str(100 * success_count / ( 1560 success_count + fail_count)))) 1561 if success_count / ( 1562 success_count + fail_count) >= MINIMUM_SUCCESS_RATE: 1563 return True 1564 else: 1565 return False 1566 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, str(100 * success_count / ( 1618 success_count + fail_count)))) 1619 if success_count / ( 1620 success_count + fail_count) >= MINIMUM_SUCCESS_RATE: 1621 return True 1622 else: 1623 return False 1624 1625 @TelephonyBaseTest.tel_test_wrap 1626 def test_call_csfb_3g_to_csfb_3g_loop(self): 1627 """ Stress test: CSFB 3G to CSFB 3G call test 1628 1629 1. Make Sure PhoneA is in LTE mode, VoLTE disabled. 1630 2. Make Sure PhoneB is in LTE mode, VoLTE disabled. 1631 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1632 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1633 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1634 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1635 7. Repeat step 3~6. 1636 1637 Returns: 1638 True if pass; False if fail. 1639 """ 1640 1641 # TODO: b/26338422 Make this a parameter 1642 MINIMUM_SUCCESS_RATE = .95 1643 ads = self.android_devices 1644 1645 tasks = [(phone_setup_csfb, (self.log, ads[0])), (phone_setup_csfb, 1646 (self.log, ads[1]))] 1647 if not multithread_func(self.log, tasks): 1648 self.log.error("Phone Failed to Set Up Properly.") 1649 return False 1650 1651 success_count = 0 1652 fail_count = 0 1653 1654 for i in range(1, self.stress_test_number + 1): 1655 1656 if two_phone_call_long_seq( 1657 self.log, ads[0], phone_idle_csfb, is_phone_in_call_csfb, 1658 ads[1], phone_idle_csfb, is_phone_in_call_csfb, None): 1659 success_count += 1 1660 result_str = "Succeeded" 1661 1662 else: 1663 fail_count += 1 1664 result_str = "Failed" 1665 1666 self.log.info("Iteration {} {}. Current: {} / {} passed.".format( 1667 i, result_str, success_count, self.stress_test_number)) 1668 1669 self.log.info("Final Count - Success: {}, Failure: {}".format( 1670 success_count, fail_count)) 1671 if success_count / ( 1672 success_count + fail_count) >= MINIMUM_SUCCESS_RATE: 1673 return True 1674 else: 1675 return False 1676 1677 @TelephonyBaseTest.tel_test_wrap 1678 def test_call_3g_to_3g_loop(self): 1679 """ Stress test: 3G to 3G call test 1680 1681 1. Make Sure PhoneA is in 3G mode 1682 2. Make Sure PhoneB is in 3G mode 1683 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 1684 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 1685 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 1686 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 1687 7. Repeat step 3~6. 1688 1689 Returns: 1690 True if pass; False if fail. 1691 """ 1692 1693 # TODO: b/26338422 Make this a parameter 1694 MINIMUM_SUCCESS_RATE = .95 1695 ads = self.android_devices 1696 1697 tasks = [(phone_setup_voice_3g, (self.log, ads[0])), (phone_setup_voice_3g, 1698 (self.log, ads[1]))] 1699 if not multithread_func(self.log, tasks): 1700 self.log.error("Phone Failed to Set Up Properly.") 1701 return False 1702 1703 success_count = 0 1704 fail_count = 0 1705 1706 for i in range(1, self.stress_test_number + 1): 1707 1708 if two_phone_call_long_seq( 1709 self.log, ads[0], phone_idle_3g, is_phone_in_call_3g, 1710 ads[1], phone_idle_3g, is_phone_in_call_3g, None): 1711 success_count += 1 1712 result_str = "Succeeded" 1713 1714 else: 1715 fail_count += 1 1716 result_str = "Failed" 1717 1718 self.log.info("Iteration {} {}. Current: {} / {} passed.".format( 1719 i, result_str, success_count, self.stress_test_number)) 1720 1721 self.log.info("Final Count - Success: {}, Failure: {}".format( 1722 success_count, fail_count)) 1723 if success_count / ( 1724 success_count + fail_count) >= MINIMUM_SUCCESS_RATE: 1725 return True 1726 else: 1727 return False 1728 1729 def _hold_unhold_test(self, ads): 1730 """ Test hold/unhold functionality. 1731 1732 PhoneA is in call with PhoneB. The call on PhoneA is active. 1733 Get call list on PhoneA. 1734 Hold call_id on PhoneA. 1735 Check call_id state. 1736 Unhold call_id on PhoneA. 1737 Check call_id state. 1738 1739 Args: 1740 ads: List of android objects. 1741 This list should contain 2 android objects. 1742 ads[0] is the ad to do hold/unhold operation. 1743 1744 Returns: 1745 True if pass; False if fail. 1746 """ 1747 call_list = ads[0].droid.telecomCallGetCallIds() 1748 self.log.info("Calls in PhoneA{}".format(call_list)) 1749 if num_active_calls(self.log, ads[0]) != 1: 1750 return False 1751 call_id = call_list[0] 1752 1753 if ads[0].droid.telecomCallGetCallState(call_id) != CALL_STATE_ACTIVE: 1754 self.log.error( 1755 "Call_id:{}, state:{}, expected: STATE_ACTIVE".format( 1756 call_id, ads[0].droid.telecomCallGetCallState(call_id))) 1757 return False 1758 # TODO: b/26296375 add voice check. 1759 1760 self.log.info("Hold call_id {} on PhoneA".format(call_id)) 1761 ads[0].droid.telecomCallHold(call_id) 1762 time.sleep(WAIT_TIME_IN_CALL) 1763 if ads[0].droid.telecomCallGetCallState(call_id) != CALL_STATE_HOLDING: 1764 self.log.error( 1765 "Call_id:{}, state:{}, expected: STATE_HOLDING".format( 1766 call_id, ads[0].droid.telecomCallGetCallState(call_id))) 1767 return False 1768 # TODO: b/26296375 add voice check. 1769 1770 self.log.info("Unhold call_id {} on PhoneA".format(call_id)) 1771 ads[0].droid.telecomCallUnhold(call_id) 1772 time.sleep(WAIT_TIME_IN_CALL) 1773 if ads[0].droid.telecomCallGetCallState(call_id) != CALL_STATE_ACTIVE: 1774 self.log.error( 1775 "Call_id:{}, state:{}, expected: STATE_ACTIVE".format( 1776 call_id, ads[0].droid.telecomCallGetCallState(call_id))) 1777 return False 1778 # TODO: b/26296375 add voice check. 1779 1780 if not verify_incall_state(self.log, [ads[0], ads[1]], True): 1781 self.log.error("Caller/Callee dropped call.") 1782 return False 1783 1784 return True 1785 1786 @TelephonyBaseTest.tel_test_wrap 1787 def test_call_epdg_mo_hold_unhold_wfc_wifi_only(self): 1788 """ WiFi Only, WiFi calling MO call hold/unhold test 1789 1790 1. Setup PhoneA WFC mode: WIFI_ONLY. 1791 2. Make sure PhoneB can make/receive voice call. 1792 3. Call from PhoneA to PhoneB, accept on PhoneB. 1793 4. Hold and unhold on PhoneA. 1794 1795 Returns: 1796 True if pass; False if fail. 1797 """ 1798 ads = self.android_devices 1799 1800 tasks = [(phone_setup_iwlan, 1801 (self.log, ads[0], False, WFC_MODE_WIFI_ONLY, 1802 self.wifi_network_ssid, self.wifi_network_pass)), 1803 (phone_setup_voice_general, (self.log, ads[1]))] 1804 if not multithread_func(self.log, tasks): 1805 self.log.error("Phone Failed to Set Up Properly.") 1806 return False 1807 1808 ads[0].droid.telecomCallClearCallList() 1809 if num_active_calls(self.log, ads[0]) != 0: 1810 self.log.error("Phone {} Call List is not empty." 1811 .format(ads[0].serial)) 1812 return False 1813 1814 self.log.info("Begin MO Call Hold/Unhold Test.") 1815 if not call_setup_teardown(self.log, 1816 ads[0], 1817 ads[1], 1818 ad_hangup=None, 1819 verify_caller_func=is_phone_in_call_iwlan, 1820 verify_callee_func=None): 1821 return False 1822 1823 if not self._hold_unhold_test(ads): 1824 self.log.error("Hold/Unhold test fail.") 1825 return False 1826 1827 return True 1828 1829 @TelephonyBaseTest.tel_test_wrap 1830 def test_call_epdg_mo_hold_unhold_wfc_wifi_preferred(self): 1831 """ WiFi Preferred, WiFi calling MO call hold/unhold test 1832 1833 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 1834 2. Make sure PhoneB can make/receive voice call. 1835 3. Call from PhoneA to PhoneB, accept on PhoneB. 1836 4. Hold and unhold on PhoneA. 1837 1838 Returns: 1839 True if pass; False if fail. 1840 """ 1841 ads = self.android_devices 1842 1843 tasks = [(phone_setup_iwlan, 1844 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, 1845 self.wifi_network_ssid, self.wifi_network_pass)), 1846 (phone_setup_voice_general, (self.log, ads[1]))] 1847 if not multithread_func(self.log, tasks): 1848 self.log.error("Phone Failed to Set Up Properly.") 1849 return False 1850 1851 ads[0].droid.telecomCallClearCallList() 1852 if num_active_calls(self.log, ads[0]) != 0: 1853 self.log.error("Phone {} Call List is not empty." 1854 .format(ads[0].serial)) 1855 return False 1856 1857 self.log.info("Begin MO Call Hold/Unhold Test.") 1858 if not call_setup_teardown(self.log, 1859 ads[0], 1860 ads[1], 1861 ad_hangup=None, 1862 verify_caller_func=is_phone_in_call_iwlan, 1863 verify_callee_func=None): 1864 return False 1865 1866 if not self._hold_unhold_test(ads): 1867 self.log.error("Hold/Unhold test fail.") 1868 return False 1869 1870 return True 1871 1872 @TelephonyBaseTest.tel_test_wrap 1873 def test_call_epdg_mo_hold_unhold_apm_wfc_wifi_only(self): 1874 """ Airplane + WiFi Only, WiFi calling MO call hold/unhold test 1875 1876 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 1877 2. Make sure PhoneB can make/receive voice call. 1878 3. Call from PhoneA to PhoneB, accept on PhoneB. 1879 4. Hold and unhold on PhoneA. 1880 1881 Returns: 1882 True if pass; False if fail. 1883 """ 1884 ads = self.android_devices 1885 1886 tasks = [(phone_setup_iwlan, 1887 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY, 1888 self.wifi_network_ssid, self.wifi_network_pass)), 1889 (phone_setup_voice_general, (self.log, ads[1]))] 1890 if not multithread_func(self.log, tasks): 1891 self.log.error("Phone Failed to Set Up Properly.") 1892 return False 1893 1894 ads[0].droid.telecomCallClearCallList() 1895 if num_active_calls(self.log, ads[0]) != 0: 1896 self.log.error("Phone {} Call List is not empty." 1897 .format(ads[0].serial)) 1898 return False 1899 1900 self.log.info("Begin MO Call Hold/Unhold Test.") 1901 if not call_setup_teardown(self.log, 1902 ads[0], 1903 ads[1], 1904 ad_hangup=None, 1905 verify_caller_func=is_phone_in_call_iwlan, 1906 verify_callee_func=None): 1907 return False 1908 1909 if not self._hold_unhold_test(ads): 1910 self.log.error("Hold/Unhold test fail.") 1911 return False 1912 1913 return True 1914 1915 @TelephonyBaseTest.tel_test_wrap 1916 def test_call_epdg_mo_hold_unhold_apm_wfc_wifi_preferred(self): 1917 """ Airplane + WiFi Preferred, WiFi calling MO call hold/unhold test 1918 1919 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED. 1920 2. Make sure PhoneB can make/receive voice call. 1921 3. Call from PhoneA to PhoneB, accept on PhoneB. 1922 4. Hold and unhold on PhoneA. 1923 1924 Returns: 1925 True if pass; False if fail. 1926 """ 1927 ads = self.android_devices 1928 1929 tasks = [(phone_setup_iwlan, 1930 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1931 self.wifi_network_ssid, self.wifi_network_pass)), 1932 (phone_setup_voice_general, (self.log, ads[1]))] 1933 if not multithread_func(self.log, tasks): 1934 self.log.error("Phone Failed to Set Up Properly.") 1935 return False 1936 1937 ads[0].droid.telecomCallClearCallList() 1938 if num_active_calls(self.log, ads[0]) != 0: 1939 self.log.error("Phone {} Call List is not empty." 1940 .format(ads[0].serial)) 1941 return False 1942 1943 self.log.info("Begin MO Call Hold/Unhold Test.") 1944 if not call_setup_teardown(self.log, 1945 ads[0], 1946 ads[1], 1947 ad_hangup=None, 1948 verify_caller_func=is_phone_in_call_iwlan, 1949 verify_callee_func=None): 1950 return False 1951 1952 if not self._hold_unhold_test(ads): 1953 self.log.error("Hold/Unhold test fail.") 1954 return False 1955 1956 return True 1957 1958 @TelephonyBaseTest.tel_test_wrap 1959 def test_call_epdg_mt_hold_unhold_wfc_wifi_only(self): 1960 """ WiFi Only, WiFi calling MT call hold/unhold test 1961 1962 1. Setup PhoneA WFC mode: WIFI_ONLY. 1963 2. Make sure PhoneB can make/receive voice call. 1964 3. Call from PhoneB to PhoneA, accept on PhoneA. 1965 4. Hold and unhold on PhoneA. 1966 1967 Returns: 1968 True if pass; False if fail. 1969 """ 1970 ads = self.android_devices 1971 1972 tasks = [(phone_setup_iwlan, 1973 (self.log, ads[0], False, WFC_MODE_WIFI_ONLY, 1974 self.wifi_network_ssid, self.wifi_network_pass)), 1975 (phone_setup_voice_general, (self.log, ads[1]))] 1976 if not multithread_func(self.log, tasks): 1977 self.log.error("Phone Failed to Set Up Properly.") 1978 return False 1979 1980 ads[0].droid.telecomCallClearCallList() 1981 if num_active_calls(self.log, ads[0]) != 0: 1982 self.log.error("Phone {} Call List is not empty." 1983 .format(ads[0].serial)) 1984 return False 1985 1986 self.log.info("Begin MT Call Hold/Unhold Test.") 1987 if not call_setup_teardown(self.log, 1988 ads[1], 1989 ads[0], 1990 ad_hangup=None, 1991 verify_caller_func=None, 1992 verify_callee_func=is_phone_in_call_iwlan): 1993 return False 1994 1995 if not self._hold_unhold_test(ads): 1996 self.log.error("Hold/Unhold test fail.") 1997 return False 1998 1999 return True 2000 2001 @TelephonyBaseTest.tel_test_wrap 2002 def test_call_epdg_mt_hold_unhold_wfc_wifi_preferred(self): 2003 """ WiFi Preferred, WiFi calling MT call hold/unhold test 2004 2005 1. Setup PhoneA WFC mode: WIFI_PREFERRED. 2006 2. Make sure PhoneB can make/receive voice call. 2007 3. Call from PhoneB to PhoneA, accept on PhoneA. 2008 4. Hold and unhold on PhoneA. 2009 2010 Returns: 2011 True if pass; False if fail. 2012 """ 2013 ads = self.android_devices 2014 2015 tasks = [(phone_setup_iwlan, 2016 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, 2017 self.wifi_network_ssid, self.wifi_network_pass)), 2018 (phone_setup_voice_general, (self.log, ads[1]))] 2019 if not multithread_func(self.log, tasks): 2020 self.log.error("Phone Failed to Set Up Properly.") 2021 return False 2022 2023 ads[0].droid.telecomCallClearCallList() 2024 if num_active_calls(self.log, ads[0]) != 0: 2025 self.log.error("Phone {} Call List is not empty." 2026 .format(ads[0].serial)) 2027 return False 2028 2029 self.log.info("Begin MT Call Hold/Unhold Test.") 2030 if not call_setup_teardown(self.log, 2031 ads[1], 2032 ads[0], 2033 ad_hangup=None, 2034 verify_caller_func=None, 2035 verify_callee_func=is_phone_in_call_iwlan): 2036 return False 2037 2038 if not self._hold_unhold_test(ads): 2039 self.log.error("Hold/Unhold test fail.") 2040 return False 2041 2042 return True 2043 2044 @TelephonyBaseTest.tel_test_wrap 2045 def test_call_epdg_mt_hold_unhold_apm_wfc_wifi_only(self): 2046 """ Airplane + WiFi Only, WiFi calling MT call hold/unhold test 2047 2048 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY. 2049 2. Make sure PhoneB can make/receive voice call. 2050 3. Call from PhoneB to PhoneA, accept on PhoneA. 2051 4. Hold and unhold on PhoneA. 2052 2053 Returns: 2054 True if pass; False if fail. 2055 """ 2056 ads = self.android_devices 2057 2058 tasks = [(phone_setup_iwlan, 2059 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY, 2060 self.wifi_network_ssid, self.wifi_network_pass)), 2061 (phone_setup_voice_general, (self.log, ads[1]))] 2062 if not multithread_func(self.log, tasks): 2063 self.log.error("Phone Failed to Set Up Properly.") 2064 return False 2065 2066 ads[0].droid.telecomCallClearCallList() 2067 if num_active_calls(self.log, ads[0]) != 0: 2068 self.log.error("Phone {} Call List is not empty." 2069 .format(ads[0].serial)) 2070 return False 2071 2072 self.log.info("Begin MT Call Hold/Unhold Test.") 2073 if not call_setup_teardown(self.log, 2074 ads[1], 2075 ads[0], 2076 ad_hangup=None, 2077 verify_caller_func=None, 2078 verify_callee_func=is_phone_in_call_iwlan): 2079 return False 2080 2081 if not self._hold_unhold_test(ads): 2082 self.log.error("Hold/Unhold test fail.") 2083 return False 2084 2085 return True 2086 2087 @TelephonyBaseTest.tel_test_wrap 2088 def test_call_epdg_mt_hold_unhold_apm_wfc_wifi_preferred(self): 2089 """ Airplane + WiFi Preferred, WiFi calling MT call hold/unhold test 2090 2091 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED. 2092 2. Make sure PhoneB can make/receive voice call. 2093 3. Call from PhoneB to PhoneA, accept on PhoneA. 2094 4. Hold and unhold on PhoneA. 2095 2096 Returns: 2097 True if pass; False if fail. 2098 """ 2099 ads = self.android_devices 2100 2101 tasks = [(phone_setup_iwlan, 2102 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 2103 self.wifi_network_ssid, self.wifi_network_pass)), 2104 (phone_setup_voice_general, (self.log, ads[1]))] 2105 if not multithread_func(self.log, tasks): 2106 self.log.error("Phone Failed to Set Up Properly.") 2107 return False 2108 2109 ads[0].droid.telecomCallClearCallList() 2110 if num_active_calls(self.log, ads[0]) != 0: 2111 self.log.error("Phone {} Call List is not empty." 2112 .format(ads[0].serial)) 2113 return False 2114 2115 self.log.info("Begin MT Call Hold/Unhold Test.") 2116 if not call_setup_teardown(self.log, 2117 ads[1], 2118 ads[0], 2119 ad_hangup=None, 2120 verify_caller_func=None, 2121 verify_callee_func=is_phone_in_call_iwlan): 2122 return False 2123 2124 if not self._hold_unhold_test(ads): 2125 self.log.error("Hold/Unhold test fail.") 2126 return False 2127 2128 return True 2129 2130 @TelephonyBaseTest.tel_test_wrap 2131 def test_call_volte_mo_hold_unhold(self): 2132 """ VoLTE MO call hold/unhold test 2133 2134 1. Make Sure PhoneA is in LTE mode (with VoLTE). 2135 2. Make Sure PhoneB is able to make/receive call. 2136 3. Call from PhoneA to PhoneB, accept on PhoneB. 2137 4. Hold and unhold on PhoneA. 2138 2139 Returns: 2140 True if pass; False if fail. 2141 """ 2142 ads = self.android_devices 2143 2144 tasks = [(phone_setup_volte, (self.log, ads[0])), 2145 (phone_setup_voice_general, (self.log, ads[1]))] 2146 if not multithread_func(self.log, tasks): 2147 self.log.error("Phone Failed to Set Up Properly.") 2148 return False 2149 2150 ads[0].droid.telecomCallClearCallList() 2151 if num_active_calls(self.log, ads[0]) != 0: 2152 self.log.error("Phone {} Call List is not empty." 2153 .format(ads[0].serial)) 2154 return False 2155 2156 self.log.info("Begin MO Call Hold/Unhold Test.") 2157 if not call_setup_teardown(self.log, 2158 ads[0], 2159 ads[1], 2160 ad_hangup=None, 2161 verify_caller_func=is_phone_in_call_volte, 2162 verify_callee_func=None): 2163 return False 2164 2165 if not self._hold_unhold_test(ads): 2166 self.log.error("Hold/Unhold test fail.") 2167 return False 2168 2169 return True 2170 2171 @TelephonyBaseTest.tel_test_wrap 2172 def test_call_volte_mt_hold_unhold(self): 2173 """ VoLTE MT call hold/unhold test 2174 2175 1. Make Sure PhoneA is in LTE mode (with VoLTE). 2176 2. Make Sure PhoneB is able to make/receive call. 2177 3. Call from PhoneB to PhoneA, accept on PhoneA. 2178 4. Hold and unhold on PhoneA. 2179 2180 Returns: 2181 True if pass; False if fail. 2182 """ 2183 ads = self.android_devices 2184 2185 tasks = [(phone_setup_volte, (self.log, ads[0])), 2186 (phone_setup_voice_general, (self.log, ads[1]))] 2187 if not multithread_func(self.log, tasks): 2188 self.log.error("Phone Failed to Set Up Properly.") 2189 return False 2190 2191 ads[0].droid.telecomCallClearCallList() 2192 if num_active_calls(self.log, ads[0]) != 0: 2193 self.log.error("Phone {} Call List is not empty." 2194 .format(ads[0].serial)) 2195 return False 2196 2197 self.log.info("Begin MT Call Hold/Unhold Test.") 2198 if not call_setup_teardown(self.log, 2199 ads[1], 2200 ads[0], 2201 ad_hangup=None, 2202 verify_caller_func=None, 2203 verify_callee_func=is_phone_in_call_volte): 2204 return False 2205 2206 if not self._hold_unhold_test(ads): 2207 self.log.error("Hold/Unhold test fail.") 2208 return False 2209 2210 return True 2211 2212 @TelephonyBaseTest.tel_test_wrap 2213 def test_call_wcdma_mo_hold_unhold(self): 2214 """ MO WCDMA hold/unhold test 2215 2216 1. Make Sure PhoneA is in 3G WCDMA mode. 2217 2. Make Sure PhoneB is able to make/receive call. 2218 3. Call from PhoneA to PhoneB, accept on PhoneB. 2219 4. Hold and unhold on PhoneA. 2220 2221 Returns: 2222 True if pass; False if fail. 2223 """ 2224 ads = self.android_devices 2225 # make sure PhoneA is GSM phone before proceed. 2226 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 2227 self.log.error("Not GSM phone, abort this wcdma hold/unhold test.") 2228 return False 2229 2230 tasks = [(phone_setup_voice_3g, (self.log, ads[0])), 2231 (phone_setup_voice_general, (self.log, ads[1]))] 2232 if not multithread_func(self.log, tasks): 2233 self.log.error("Phone Failed to Set Up Properly.") 2234 return False 2235 2236 ads[0].droid.telecomCallClearCallList() 2237 if num_active_calls(self.log, ads[0]) != 0: 2238 self.log.error("Phone {} Call List is not empty." 2239 .format(ads[0].serial)) 2240 return False 2241 2242 self.log.info("Begin MO Call Hold/Unhold Test.") 2243 if not call_setup_teardown(self.log, 2244 ads[0], 2245 ads[1], 2246 ad_hangup=None, 2247 verify_caller_func=is_phone_in_call_3g, 2248 verify_callee_func=None): 2249 return False 2250 2251 if not self._hold_unhold_test(ads): 2252 self.log.error("Hold/Unhold test fail.") 2253 return False 2254 2255 return True 2256 2257 @TelephonyBaseTest.tel_test_wrap 2258 def test_call_wcdma_mt_hold_unhold(self): 2259 """ MT WCDMA hold/unhold test 2260 2261 1. Make Sure PhoneA is in 3G WCDMA mode. 2262 2. Make Sure PhoneB is able to make/receive call. 2263 3. Call from PhoneB to PhoneA, accept on PhoneA. 2264 4. Hold and unhold on PhoneA. 2265 2266 Returns: 2267 True if pass; False if fail. 2268 """ 2269 ads = self.android_devices 2270 # make sure PhoneA is GSM phone before proceed. 2271 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 2272 self.log.error("Not GSM phone, abort this wcdma hold/unhold test.") 2273 return False 2274 2275 tasks = [(phone_setup_voice_3g, (self.log, ads[0])), 2276 (phone_setup_voice_general, (self.log, ads[1]))] 2277 if not multithread_func(self.log, tasks): 2278 self.log.error("Phone Failed to Set Up Properly.") 2279 return False 2280 2281 ads[0].droid.telecomCallClearCallList() 2282 if num_active_calls(self.log, ads[0]) != 0: 2283 self.log.error("Phone {} Call List is not empty." 2284 .format(ads[0].serial)) 2285 return False 2286 2287 self.log.info("Begin MT Call Hold/Unhold Test.") 2288 if not call_setup_teardown(self.log, 2289 ads[1], 2290 ads[0], 2291 ad_hangup=None, 2292 verify_caller_func=None, 2293 verify_callee_func=is_phone_in_call_3g): 2294 return False 2295 2296 if not self._hold_unhold_test(ads): 2297 self.log.error("Hold/Unhold test fail.") 2298 return False 2299 2300 return True 2301 2302 @TelephonyBaseTest.tel_test_wrap 2303 def test_call_csfb_mo_hold_unhold(self): 2304 """ MO CSFB WCDMA/GSM hold/unhold test 2305 2306 1. Make Sure PhoneA is in LTE mode (VoLTE disabled). 2307 2. Make Sure PhoneB is able to make/receive call. 2308 3. Call from PhoneA to PhoneB, accept on PhoneB. 2309 4. Hold and unhold on PhoneA. 2310 2311 Returns: 2312 True if pass; False if fail. 2313 """ 2314 ads = self.android_devices 2315 # make sure PhoneA is GSM phone before proceed. 2316 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 2317 self.log.error("Not GSM phone, abort this wcdma hold/unhold test.") 2318 return False 2319 2320 tasks = [(phone_setup_csfb, (self.log, ads[0])), 2321 (phone_setup_voice_general, (self.log, ads[1]))] 2322 if not multithread_func(self.log, tasks): 2323 self.log.error("Phone Failed to Set Up Properly.") 2324 return False 2325 2326 ads[0].droid.telecomCallClearCallList() 2327 if num_active_calls(self.log, ads[0]) != 0: 2328 self.log.error("Phone {} Call List is not empty." 2329 .format(ads[0].serial)) 2330 return False 2331 2332 self.log.info("Begin MO Call Hold/Unhold Test.") 2333 if not call_setup_teardown(self.log, 2334 ads[0], 2335 ads[1], 2336 ad_hangup=None, 2337 verify_caller_func=is_phone_in_call_csfb, 2338 verify_callee_func=None): 2339 return False 2340 2341 if not self._hold_unhold_test(ads): 2342 self.log.error("Hold/Unhold test fail.") 2343 return False 2344 2345 return True 2346 2347 @TelephonyBaseTest.tel_test_wrap 2348 def test_call_csfb_mt_hold_unhold(self): 2349 """ MT CSFB WCDMA/GSM hold/unhold test 2350 2351 1. Make Sure PhoneA is in LTE mode (VoLTE disabled). 2352 2. Make Sure PhoneB is able to make/receive call. 2353 3. Call from PhoneB to PhoneA, accept on PhoneA. 2354 4. Hold and unhold on PhoneA. 2355 2356 Returns: 2357 True if pass; False if fail. 2358 """ 2359 ads = self.android_devices 2360 # make sure PhoneA is GSM phone before proceed. 2361 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 2362 self.log.error("Not GSM phone, abort this wcdma hold/unhold test.") 2363 return False 2364 2365 tasks = [(phone_setup_csfb, (self.log, ads[0])), 2366 (phone_setup_voice_general, (self.log, ads[1]))] 2367 if not multithread_func(self.log, tasks): 2368 self.log.error("Phone Failed to Set Up Properly.") 2369 return False 2370 2371 ads[0].droid.telecomCallClearCallList() 2372 if num_active_calls(self.log, ads[0]) != 0: 2373 self.log.error("Phone {} Call List is not empty." 2374 .format(ads[0].serial)) 2375 return False 2376 2377 self.log.info("Begin MT Call Hold/Unhold Test.") 2378 if not call_setup_teardown(self.log, 2379 ads[1], 2380 ads[0], 2381 ad_hangup=None, 2382 verify_caller_func=None, 2383 verify_callee_func=is_phone_in_call_csfb): 2384 return False 2385 2386 if not self._hold_unhold_test(ads): 2387 self.log.error("Hold/Unhold test fail.") 2388 return False 2389 2390 return True 2391 2392 @TelephonyBaseTest.tel_test_wrap 2393 def test_erase_all_pending_voicemail(self): 2394 """Script for TMO/ATT/SPT phone to erase all pending voice mail. 2395 This script only works if phone have already set up voice mail options, 2396 and phone should disable password protection for voice mail. 2397 2398 1. If phone don't have pending voice message, return True. 2399 2. Dial voice mail number. 2400 For TMO, the number is '123'. 2401 For ATT, the number is phone's number. 2402 For SPT, the number is phone's number. 2403 3. Use DTMF to delete all pending voice messages. 2404 4. Check telephonyGetVoiceMailCount result. it should be 0. 2405 2406 Returns: 2407 False if error happens. True is succeed. 2408 """ 2409 ads = self.android_devices 2410 2411 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 2412 (phone_setup_voice_general, (self.log, ads[1]))] 2413 if not multithread_func(self.log, tasks): 2414 self.log.error("Phone Failed to Set Up Properly.") 2415 return False 2416 2417 return call_voicemail_erase_all_pending_voicemail( 2418 self.log, self.android_devices[1]) 2419 2420 @TelephonyBaseTest.tel_test_wrap 2421 def test_voicemail_indicator_volte(self): 2422 """Test Voice Mail notification in LTE (VoLTE enabled). 2423 This script currently only works for TMO now. 2424 2425 1. Make sure DUT (ads[1]) in VoLTE mode. Both PhoneB (ads[0]) and DUT idle. 2426 2. Make call from PhoneB to DUT, reject on DUT. 2427 3. On PhoneB, leave a voice mail to DUT. 2428 4. Verify DUT receive voice mail notification. 2429 2430 Returns: 2431 True if pass; False if fail. 2432 """ 2433 ads = self.android_devices 2434 2435 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 2436 (phone_setup_volte, (self.log, ads[1]))] 2437 if not multithread_func(self.log, tasks): 2438 self.log.error("Phone Failed to Set Up Properly.") 2439 return False 2440 if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]): 2441 self.log.error("Failed to clear voice mail.") 2442 return False 2443 2444 return two_phone_call_leave_voice_mail(self.log, ads[0], None, None, 2445 ads[1], phone_idle_volte) 2446 2447 @TelephonyBaseTest.tel_test_wrap 2448 def test_voicemail_indicator_lte(self): 2449 """Test Voice Mail notification in LTE (VoLTE disabled). 2450 This script currently only works for TMO/ATT/SPT now. 2451 2452 1. Make sure DUT (ads[1]) in LTE (No VoLTE) mode. Both PhoneB (ads[0]) and DUT idle. 2453 2. Make call from PhoneB to DUT, reject on DUT. 2454 3. On PhoneB, leave a voice mail to DUT. 2455 4. Verify DUT receive voice mail notification. 2456 2457 Returns: 2458 True if pass; False if fail. 2459 """ 2460 ads = self.android_devices 2461 2462 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 2463 (phone_setup_csfb, (self.log, ads[1]))] 2464 if not multithread_func(self.log, tasks): 2465 self.log.error("Phone Failed to Set Up Properly.") 2466 return False 2467 if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]): 2468 self.log.error("Failed to clear voice mail.") 2469 return False 2470 2471 return two_phone_call_leave_voice_mail(self.log, ads[0], None, None, 2472 ads[1], phone_idle_csfb) 2473 2474 @TelephonyBaseTest.tel_test_wrap 2475 def test_voicemail_indicator_3g(self): 2476 """Test Voice Mail notification in 3G 2477 This script currently only works for TMO/ATT/SPT now. 2478 2479 1. Make sure DUT (ads[1]) in 3G mode. Both PhoneB (ads[0]) and DUT idle. 2480 2. Make call from PhoneB to DUT, reject on DUT. 2481 3. On PhoneB, leave a voice mail to DUT. 2482 4. Verify DUT receive voice mail notification. 2483 2484 Returns: 2485 True if pass; False if fail. 2486 """ 2487 ads = self.android_devices 2488 2489 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 2490 (phone_setup_voice_3g, (self.log, ads[1]))] 2491 if not multithread_func(self.log, tasks): 2492 self.log.error("Phone Failed to Set Up Properly.") 2493 return False 2494 if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]): 2495 self.log.error("Failed to clear voice mail.") 2496 return False 2497 2498 return two_phone_call_leave_voice_mail(self.log, ads[0], None, None, 2499 ads[1], phone_idle_3g) 2500 2501 @TelephonyBaseTest.tel_test_wrap 2502 def test_voicemail_indicator_2g(self): 2503 """Test Voice Mail notification in 2G 2504 This script currently only works for TMO/ATT/SPT now. 2505 2506 1. Make sure DUT (ads[0]) in 2G mode. Both PhoneB (ads[1]) and DUT idle. 2507 2. Make call from PhoneB to DUT, reject on DUT. 2508 3. On PhoneB, leave a voice mail to DUT. 2509 4. Verify DUT receive voice mail notification. 2510 2511 Returns: 2512 True if pass; False if fail. 2513 """ 2514 ads = self.android_devices 2515 2516 tasks = [(phone_setup_voice_general, (self.log, ads[1])), 2517 (phone_setup_voice_2g, (self.log, ads[0]))] 2518 if not multithread_func(self.log, tasks): 2519 self.log.error("Phone Failed to Set Up Properly.") 2520 return False 2521 if not call_voicemail_erase_all_pending_voicemail(self.log, ads[0]): 2522 self.log.error("Failed to clear voice mail.") 2523 return False 2524 2525 return two_phone_call_leave_voice_mail(self.log, ads[1], None, None, 2526 ads[0], phone_idle_2g) 2527 2528 @TelephonyBaseTest.tel_test_wrap 2529 def test_voicemail_indicator_iwlan(self): 2530 """Test Voice Mail notification in WiFI Calling 2531 This script currently only works for TMO now. 2532 2533 1. Make sure DUT (ads[1]) in WFC mode. Both PhoneB (ads[0]) and DUT idle. 2534 2. Make call from PhoneB to DUT, reject on DUT. 2535 3. On PhoneB, leave a voice mail to DUT. 2536 4. Verify DUT receive voice mail notification. 2537 2538 Returns: 2539 True if pass; False if fail. 2540 """ 2541 ads = self.android_devices 2542 2543 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 2544 (phone_setup_iwlan, 2545 (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED, 2546 self.wifi_network_ssid, self.wifi_network_pass))] 2547 if not multithread_func(self.log, tasks): 2548 self.log.error("Phone Failed to Set Up Properly.") 2549 return False 2550 if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]): 2551 self.log.error("Failed to clear voice mail.") 2552 return False 2553 2554 return two_phone_call_leave_voice_mail(self.log, ads[0], None, None, 2555 ads[1], phone_idle_iwlan) 2556 2557 @TelephonyBaseTest.tel_test_wrap 2558 def test_voicemail_indicator_apm_iwlan(self): 2559 """Test Voice Mail notification in WiFI Calling 2560 This script currently only works for TMO now. 2561 2562 1. Make sure DUT (ads[1]) in APM WFC mode. Both PhoneB (ads[0]) and DUT idle. 2563 2. Make call from PhoneB to DUT, reject on DUT. 2564 3. On PhoneB, leave a voice mail to DUT. 2565 4. Verify DUT receive voice mail notification. 2566 2567 Returns: 2568 True if pass; False if fail. 2569 """ 2570 ads = self.android_devices 2571 2572 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 2573 (phone_setup_iwlan, 2574 (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED, 2575 self.wifi_network_ssid, self.wifi_network_pass))] 2576 if not multithread_func(self.log, tasks): 2577 self.log.error("Phone Failed to Set Up Properly.") 2578 return False 2579 if not call_voicemail_erase_all_pending_voicemail(self.log, ads[1]): 2580 self.log.error("Failed to clear voice mail.") 2581 return False 2582 2583 return two_phone_call_leave_voice_mail(self.log, ads[0], None, None, 2584 ads[1], phone_idle_iwlan) 2585 2586 @TelephonyBaseTest.tel_test_wrap 2587 def test_call_2g_to_2g(self): 2588 """ Test 2g<->2g call functionality. 2589 2590 Make Sure PhoneA is in 2g mode. 2591 Make Sure PhoneB is in 2g mode. 2592 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 2593 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 2594 2595 Returns: 2596 True if pass; False if fail. 2597 """ 2598 ads = self.android_devices 2599 2600 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 2601 (phone_setup_voice_2g, (self.log, ads[1]))] 2602 if not multithread_func(self.log, tasks): 2603 self.log.error("Phone Failed to Set Up Properly.") 2604 return False 2605 2606 return two_phone_call_short_seq( 2607 self.log, ads[0], phone_idle_2g, is_phone_in_call_2g, ads[1], 2608 phone_idle_2g, is_phone_in_call_2g, None) 2609 2610 @TelephonyBaseTest.tel_test_wrap 2611 def test_call_2g_to_2g_long(self): 2612 """ Test 2g<->2g call functionality. 2613 2614 Make Sure PhoneA is in 2g mode. 2615 Make Sure PhoneB is in 2g mode. 2616 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 2617 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 2618 Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 2619 Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 2620 2621 Returns: 2622 True if pass; False if fail. 2623 """ 2624 ads = self.android_devices 2625 2626 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 2627 (phone_setup_voice_2g, (self.log, ads[1]))] 2628 if not multithread_func(self.log, tasks): 2629 self.log.error("Phone Failed to Set Up Properly.") 2630 return False 2631 2632 return two_phone_call_long_seq( 2633 self.log, ads[0], phone_idle_2g, is_phone_in_call_2g, ads[1], 2634 phone_idle_2g, is_phone_in_call_2g, None) 2635 2636 @TelephonyBaseTest.tel_test_wrap 2637 def test_call_3g_to_2g_long(self): 2638 """ Test 3g<->2g call functionality. 2639 2640 Make Sure PhoneA is in 3g mode. 2641 Make Sure PhoneB is in 2g mode. 2642 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 2643 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 2644 Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 2645 Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 2646 2647 Returns: 2648 True if pass; False if fail. 2649 """ 2650 ads = self.android_devices 2651 2652 tasks = [(phone_setup_voice_3g, (self.log, ads[0])), 2653 (phone_setup_voice_2g, (self.log, ads[1]))] 2654 if not multithread_func(self.log, tasks): 2655 self.log.error("Phone Failed to Set Up Properly.") 2656 return False 2657 2658 return two_phone_call_long_seq( 2659 self.log, ads[0], phone_idle_2g, is_phone_in_call_3g, ads[1], 2660 phone_idle_2g, is_phone_in_call_2g, None) 2661 2662 @TelephonyBaseTest.tel_test_wrap 2663 def test_call_2g_to_3g_long(self): 2664 """ Test 2g<->3g call functionality. 2665 2666 Make Sure PhoneA is in 2g mode. 2667 Make Sure PhoneB is in 3g mode. 2668 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. 2669 Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. 2670 Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB. 2671 Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA. 2672 2673 Returns: 2674 True if pass; False if fail. 2675 """ 2676 ads = self.android_devices 2677 2678 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 2679 (phone_setup_voice_3g, (self.log, ads[1]))] 2680 if not multithread_func(self.log, tasks): 2681 self.log.error("Phone Failed to Set Up Properly.") 2682 return False 2683 2684 return two_phone_call_long_seq( 2685 self.log, ads[0], phone_idle_2g, is_phone_in_call_2g, ads[1], 2686 phone_idle_2g, is_phone_in_call_3g, None) 2687 2688 @TelephonyBaseTest.tel_test_wrap 2689 def test_call_gsm_mo_hold_unhold(self): 2690 """ Test GSM call hold/unhold functionality. 2691 2692 Make Sure PhoneA is in 2g mode (GSM). 2693 Make Sure PhoneB is able to make/receive call. 2694 Call from PhoneA to PhoneB, accept on PhoneB, hold and unhold on PhoneA. 2695 2696 Returns: 2697 True if pass; False if fail. 2698 """ 2699 ads = self.android_devices 2700 # make sure PhoneA is GSM phone before proceed. 2701 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 2702 self.log.error("Not GSM phone, abort this wcdma hold/unhold test.") 2703 return False 2704 2705 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 2706 (phone_setup_voice_general, (self.log, ads[1]))] 2707 if not multithread_func(self.log, tasks): 2708 self.log.error("Phone Failed to Set Up Properly.") 2709 return False 2710 2711 ads[0].droid.telecomCallClearCallList() 2712 if num_active_calls(self.log, ads[0]) != 0: 2713 self.log.error("Phone {} Call List is not empty." 2714 .format(ads[0].serial)) 2715 return False 2716 2717 self.log.info("Begin MO Call Hold/Unhold Test.") 2718 if not call_setup_teardown(self.log, 2719 ads[0], 2720 ads[1], 2721 ad_hangup=None, 2722 verify_caller_func=is_phone_in_call_2g, 2723 verify_callee_func=None): 2724 return False 2725 2726 if not self._hold_unhold_test(ads): 2727 self.log.error("Hold/Unhold test fail.") 2728 return False 2729 2730 return True 2731 2732 @TelephonyBaseTest.tel_test_wrap 2733 def test_call_gsm_mt_hold_unhold(self): 2734 """ Test GSM call hold/unhold functionality. 2735 2736 Make Sure PhoneA is in 2g mode (GSM). 2737 Make Sure PhoneB is able to make/receive call. 2738 Call from PhoneB to PhoneA, accept on PhoneA, hold and unhold on PhoneA. 2739 2740 Returns: 2741 True if pass; False if fail. 2742 """ 2743 ads = self.android_devices 2744 # make sure PhoneA is GSM phone before proceed. 2745 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 2746 self.log.error("Not GSM phone, abort this wcdma hold/unhold test.") 2747 return False 2748 2749 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 2750 (phone_setup_voice_general, (self.log, ads[1]))] 2751 if not multithread_func(self.log, tasks): 2752 self.log.error("Phone Failed to Set Up Properly.") 2753 return False 2754 2755 ads[0].droid.telecomCallClearCallList() 2756 if num_active_calls(self.log, ads[0]) != 0: 2757 self.log.error("Phone {} Call List is not empty." 2758 .format(ads[0].serial)) 2759 return False 2760 2761 self.log.info("Begin MT Call Hold/Unhold Test.") 2762 if not call_setup_teardown(self.log, 2763 ads[1], 2764 ads[0], 2765 ad_hangup=None, 2766 verify_caller_func=None, 2767 verify_callee_func=is_phone_in_call_2g): 2768 return False 2769 2770 if not self._hold_unhold_test(ads): 2771 self.log.error("Hold/Unhold test fail.") 2772 return False 2773 2774 return True 2775 2776 def _test_call_long_duration(self, dut_incall_check_func, 2777 total_duration): 2778 ads = self.android_devices 2779 self.log.info("Long Duration Call Test. Total duration = {}". 2780 format(total_duration)) 2781 return call_setup_teardown(self.log, ads[0], ads[1], ads[0], 2782 verify_caller_func=dut_incall_check_func, 2783 wait_time_in_call=total_duration) 2784 2785 @TelephonyBaseTest.tel_test_wrap 2786 def test_call_long_duration_volte(self): 2787 """ Test call drop rate for VoLTE long duration call. 2788 2789 Steps: 2790 1. Setup VoLTE for DUT. 2791 2. Make VoLTE call from DUT to PhoneB. 2792 3. For <total_duration> time, check if DUT drop call or not. 2793 2794 Expected Results: 2795 DUT should not drop call. 2796 2797 Returns: 2798 False if DUT call dropped during test. 2799 Otherwise True. 2800 """ 2801 ads = self.android_devices 2802 2803 tasks = [(phone_setup_volte, (self.log, ads[0])), 2804 (phone_setup_voice_general, (self.log, ads[1]))] 2805 if not multithread_func(self.log, tasks): 2806 self.log.error("Phone Failed to Set Up Properly.") 2807 return False 2808 2809 return self._test_call_long_duration(is_phone_in_call_volte, 2810 self.long_duration_call_total_duration) 2811 2812 @TelephonyBaseTest.tel_test_wrap 2813 def test_call_long_duration_wfc(self): 2814 """ Test call drop rate for WiFi Calling long duration call. 2815 2816 Steps: 2817 1. Setup WFC for DUT. 2818 2. Make WFC call from DUT to PhoneB. 2819 3. For <total_duration> time, check if DUT drop call or not. 2820 2821 Expected Results: 2822 DUT should not drop call. 2823 2824 Returns: 2825 False if DUT call dropped during test. 2826 Otherwise True. 2827 """ 2828 ads = self.android_devices 2829 2830 tasks = [(phone_setup_iwlan, 2831 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 2832 self.wifi_network_ssid, self.wifi_network_pass)), 2833 (phone_setup_voice_general, (self.log, ads[1]))] 2834 if not multithread_func(self.log, tasks): 2835 self.log.error("Phone Failed to Set Up Properly.") 2836 return False 2837 2838 return self._test_call_long_duration(is_phone_in_call_iwlan, 2839 self.long_duration_call_total_duration) 2840 2841 @TelephonyBaseTest.tel_test_wrap 2842 def test_call_long_duration_3g(self): 2843 """ Test call drop rate for 3G long duration call. 2844 2845 Steps: 2846 1. Setup 3G for DUT. 2847 2. Make CS call from DUT to PhoneB. 2848 3. For <total_duration> time, check if DUT drop call or not. 2849 2850 Expected Results: 2851 DUT should not drop call. 2852 2853 Returns: 2854 False if DUT call dropped during test. 2855 Otherwise True. 2856 """ 2857 ads = self.android_devices 2858 2859 tasks = [(phone_setup_voice_3g, (self.log, ads[0])), 2860 (phone_setup_voice_general, (self.log, ads[1]))] 2861 if not multithread_func(self.log, tasks): 2862 self.log.error("Phone Failed to Set Up Properly.") 2863 return False 2864 2865 return self._test_call_long_duration(is_phone_in_call_3g, 2866 self.long_duration_call_total_duration) 2867 """ Tests End """ 2868