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 20import time 21from queue import Empty 22from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 23from acts.test_utils.tel.tel_defines import GEN_3G 24from acts.test_utils.tel.tel_defines import GEN_4G 25from acts.test_utils.tel.tel_defines import PHONE_TYPE_CDMA 26from acts.test_utils.tel.tel_defines import PHONE_TYPE_GSM 27from acts.test_utils.tel.tel_defines import RAT_3G 28from acts.test_utils.tel.tel_defines import VT_STATE_BIDIRECTIONAL 29from acts.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING 30from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED 31from acts.test_utils.tel.tel_test_utils import call_setup_teardown 32from acts.test_utils.tel.tel_test_utils import \ 33 ensure_network_generation_for_subscription 34from acts.test_utils.tel.tel_test_utils import ensure_network_generation 35from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected 36from acts.test_utils.tel.tel_test_utils import mms_send_receive_verify 37from acts.test_utils.tel.tel_test_utils import mms_receive_verify_after_call_hangup 38from acts.test_utils.tel.tel_test_utils import multithread_func 39from acts.test_utils.tel.tel_test_utils import set_call_state_listen_level 40from acts.test_utils.tel.tel_test_utils import setup_sim 41from acts.test_utils.tel.tel_test_utils import sms_send_receive_verify 42from acts.test_utils.tel.tel_video_utils import phone_setup_video 43from acts.test_utils.tel.tel_video_utils import is_phone_in_call_video_bidirectional 44from acts.test_utils.tel.tel_video_utils import video_call_setup_teardown 45from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_1x 46from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_2g 47from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_3g 48from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb 49from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan 50from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_volte 51from acts.test_utils.tel.tel_voice_utils import phone_setup_3g 52from acts.test_utils.tel.tel_voice_utils import phone_setup_csfb 53from acts.test_utils.tel.tel_voice_utils import phone_setup_data_general 54from acts.test_utils.tel.tel_voice_utils import phone_setup_iwlan 55from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_2g 56from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_3g 57from acts.test_utils.tel.tel_voice_utils import phone_setup_volte 58from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_general 59from acts.utils import rand_ascii_str 60 61 62class TelLiveSmsTest(TelephonyBaseTest): 63 def __init__(self, controllers): 64 TelephonyBaseTest.__init__(self, controllers) 65 66 # The path for "sim config file" should be set 67 # in "testbed.config" entry "sim_conf_file". 68 self.wifi_network_ssid = self.user_params["wifi_network_ssid"] 69 70 try: 71 self.wifi_network_pass = self.user_params["wifi_network_pass"] 72 except KeyError: 73 self.wifi_network_pass = None 74 75 for ad in self.android_devices: 76 ad.adb.shell("su root setenforce 0") 77 #not needed for now. might need for image attachment later 78 #ad.adb.shell("pm grant com.google.android.apps.messaging " 79 # "android.permission.READ_EXTERNAL_STORAGE") 80 81 def _sms_test(self, ads): 82 """Test SMS between two phones. 83 84 Returns: 85 True if success. 86 False if failed. 87 """ 88 89 sms_params = [(ads[0], ads[1])] 90 message_arrays = [[rand_ascii_str(50)], [rand_ascii_str(160)], 91 [rand_ascii_str(180)]] 92 93 for outer_param in sms_params: 94 outer_param = (self.log, ) + outer_param 95 for message_array in message_arrays: 96 inner_param = outer_param + (message_array, ) 97 if not sms_send_receive_verify(*inner_param): 98 return False 99 100 return True 101 102 def _mms_test(self, ads): 103 """Test MMS between two phones. 104 105 Returns: 106 True if success. 107 False if failed. 108 """ 109 return mms_send_receive_verify( 110 self.log, ads[0], ads[1], 111 [("Test Message", "Basic Message Body", None)]) 112 113 def _mms_test_after_call_hangup(self, ads): 114 """Test MMS send out after call hang up. 115 116 Returns: 117 True if success. 118 False if failed. 119 """ 120 args = [self.log, ads[0], ads[1], 121 [("Test Message", "Basic Message Body", None)]] 122 if not mms_send_receive_verify(*args): 123 self.log.info("MMS send in call is suspended.") 124 if not mms_receive_verify_after_call_hangup(*args): 125 self.log.error("MMS is not send out after call release.") 126 return False 127 else: 128 self.log.info("MMS is send out after call release.") 129 return True 130 else: 131 self.log.info("MMS is send out successfully in call.") 132 return True 133 134 def _sms_test_mo(self, ads): 135 return self._sms_test([ads[0], ads[1]]) 136 137 def _sms_test_mt(self, ads): 138 return self._sms_test([ads[1], ads[0]]) 139 140 def _mms_test_mo(self, ads): 141 return self._mms_test([ads[0], ads[1]]) 142 143 def _mms_test_mt(self, ads): 144 return self._mms_test([ads[1], ads[0]]) 145 146 def _mms_test_mo_after_call_hangup(self, ads): 147 return self._mms_test_after_call_hangup([ads[0], ads[1]]) 148 149 def _mms_test_mt_after_call_hangup(self, ads): 150 return self._mms_test_after_call_hangup([ads[1], ads[0]]) 151 152 def _mo_sms_in_3g_call(self, ads): 153 self.log.info("Begin In Call SMS Test.") 154 if not call_setup_teardown( 155 self.log, 156 ads[0], 157 ads[1], 158 ad_hangup=None, 159 verify_caller_func=is_phone_in_call_3g, 160 verify_callee_func=None): 161 return False 162 163 if not self._sms_test_mo(ads): 164 self.log.error("SMS test fail.") 165 return False 166 167 return True 168 169 def _mt_sms_in_3g_call(self, ads): 170 self.log.info("Begin In Call SMS Test.") 171 if not call_setup_teardown( 172 self.log, 173 ads[0], 174 ads[1], 175 ad_hangup=None, 176 verify_caller_func=is_phone_in_call_3g, 177 verify_callee_func=None): 178 return False 179 180 if not self._sms_test_mt(ads): 181 self.log.error("SMS test fail.") 182 return False 183 184 return True 185 186 def _mo_mms_in_3g_call(self, ads): 187 self.log.info("Begin In Call MMS Test.") 188 if not call_setup_teardown( 189 self.log, 190 ads[0], 191 ads[1], 192 ad_hangup=None, 193 verify_caller_func=is_phone_in_call_3g, 194 verify_callee_func=None): 195 return False 196 197 if not self._mms_test_mo(ads): 198 self.log.error("MMS test fail.") 199 return False 200 201 return True 202 203 def _mt_mms_in_3g_call(self, ads): 204 self.log.info("Begin In Call MMS Test.") 205 if not call_setup_teardown( 206 self.log, 207 ads[0], 208 ads[1], 209 ad_hangup=None, 210 verify_caller_func=is_phone_in_call_3g, 211 verify_callee_func=None): 212 return False 213 214 if not self._mms_test_mt(ads): 215 self.log.error("MMS test fail.") 216 return False 217 218 return True 219 220 def _mo_sms_in_2g_call(self, ads): 221 self.log.info("Begin In Call SMS Test.") 222 if not call_setup_teardown( 223 self.log, 224 ads[0], 225 ads[1], 226 ad_hangup=None, 227 verify_caller_func=is_phone_in_call_2g, 228 verify_callee_func=None): 229 return False 230 231 if not self._sms_test_mo(ads): 232 self.log.error("SMS test fail.") 233 return False 234 235 return True 236 237 def _mt_sms_in_2g_call(self, ads): 238 self.log.info("Begin In Call SMS Test.") 239 if not call_setup_teardown( 240 self.log, 241 ads[0], 242 ads[1], 243 ad_hangup=None, 244 verify_caller_func=is_phone_in_call_2g, 245 verify_callee_func=None): 246 return False 247 248 if not self._sms_test_mt(ads): 249 self.log.error("SMS test fail.") 250 return False 251 252 return True 253 254 def _mo_mms_in_2g_call(self, ads): 255 self.log.info("Begin In Call MMS Test.") 256 if not call_setup_teardown( 257 self.log, 258 ads[0], 259 ads[1], 260 ad_hangup=None, 261 verify_caller_func=is_phone_in_call_2g, 262 verify_callee_func=None): 263 return False 264 265 if not self._mms_test_mo(ads): 266 self.log.error("MMS test fail.") 267 return False 268 269 return True 270 271 def _mt_mms_in_2g_call(self, ads): 272 self.log.info("Begin In Call MMS Test.") 273 if not call_setup_teardown( 274 self.log, 275 ads[0], 276 ads[1], 277 ad_hangup=None, 278 verify_caller_func=is_phone_in_call_2g, 279 verify_callee_func=None): 280 return False 281 282 if not self._mms_test_mt(ads): 283 self.log.error("MMS test fail.") 284 return False 285 286 return True 287 288 @TelephonyBaseTest.tel_test_wrap 289 def test_sms_mo_general(self): 290 """Test SMS basic function between two phone. Phones in any network. 291 292 Airplane mode is off. 293 Send SMS from PhoneA to PhoneB. 294 Verify received message on PhoneB is correct. 295 296 Returns: 297 True if success. 298 False if failed. 299 """ 300 ads = self.android_devices 301 302 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 303 (phone_setup_voice_general, (self.log, ads[1]))] 304 if not multithread_func(self.log, tasks): 305 self.log.error("Phone Failed to Set Up Properly.") 306 return False 307 308 return self._sms_test_mo(ads) 309 310 @TelephonyBaseTest.tel_test_wrap 311 def test_sms_mt_general(self): 312 """Test SMS basic function between two phone. Phones in any network. 313 314 Airplane mode is off. 315 Send SMS from PhoneB to PhoneA. 316 Verify received message on PhoneA is correct. 317 318 Returns: 319 True if success. 320 False if failed. 321 """ 322 ads = self.android_devices 323 324 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 325 (phone_setup_voice_general, (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 return self._sms_test_mt(ads) 331 332 @TelephonyBaseTest.tel_test_wrap 333 def test_mms_mo_general(self): 334 """Test MMS basic function between two phone. Phones in any network. 335 336 Airplane mode is off. 337 Send MMS from PhoneA to PhoneB. 338 Verify received message on PhoneB is correct. 339 340 Returns: 341 True if success. 342 False if failed. 343 """ 344 ads = self.android_devices 345 346 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 347 (phone_setup_voice_general, (self.log, ads[1]))] 348 if not multithread_func(self.log, tasks): 349 self.log.error("Phone Failed to Set Up Properly.") 350 return False 351 352 return self._mms_test_mo(ads) 353 354 @TelephonyBaseTest.tel_test_wrap 355 def test_mms_mt_general(self): 356 """Test MMS basic function between two phone. Phones in any network. 357 358 Airplane mode is off. 359 Send MMS from PhoneB to PhoneA. 360 Verify received message on PhoneA is correct. 361 362 Returns: 363 True if success. 364 False if failed. 365 """ 366 ads = self.android_devices 367 368 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 369 (phone_setup_voice_general, (self.log, ads[1]))] 370 if not multithread_func(self.log, tasks): 371 self.log.error("Phone Failed to Set Up Properly.") 372 return False 373 374 return self._mms_test_mt(ads) 375 376 @TelephonyBaseTest.tel_test_wrap 377 def test_sms_mo_2g(self): 378 """Test SMS basic function between two phone. Phones in 3g network. 379 380 Airplane mode is off. 381 Send SMS from PhoneA to PhoneB. 382 Verify received message on PhoneB is correct. 383 384 Returns: 385 True if success. 386 False if failed. 387 """ 388 ads = self.android_devices 389 390 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 391 (phone_setup_voice_general, (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 return self._sms_test_mo(ads) 397 398 @TelephonyBaseTest.tel_test_wrap 399 def test_sms_mt_2g(self): 400 """Test SMS basic function between two phone. Phones in 3g network. 401 402 Airplane mode is off. 403 Send SMS from PhoneB to PhoneA. 404 Verify received message on PhoneA is correct. 405 406 Returns: 407 True if success. 408 False if failed. 409 """ 410 ads = self.android_devices 411 412 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 413 (phone_setup_voice_general, (self.log, ads[1]))] 414 if not multithread_func(self.log, tasks): 415 self.log.error("Phone Failed to Set Up Properly.") 416 return False 417 418 return self._sms_test_mt(ads) 419 420 @TelephonyBaseTest.tel_test_wrap 421 def test_mms_mo_2g(self): 422 """Test MMS basic function between two phone. Phones in 3g network. 423 424 Airplane mode is off. 425 Send MMS from PhoneA to PhoneB. 426 Verify received message on PhoneB is correct. 427 428 Returns: 429 True if success. 430 False if failed. 431 """ 432 ads = self.android_devices 433 434 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 435 (phone_setup_voice_general, (self.log, ads[1]))] 436 if not multithread_func(self.log, tasks): 437 self.log.error("Phone Failed to Set Up Properly.") 438 return False 439 440 return self._mms_test_mo(ads) 441 442 @TelephonyBaseTest.tel_test_wrap 443 def test_mms_mt_2g(self): 444 """Test MMS basic function between two phone. Phones in 3g network. 445 446 Airplane mode is off. 447 Send MMS from PhoneB to PhoneA. 448 Verify received message on PhoneA is correct. 449 450 Returns: 451 True if success. 452 False if failed. 453 """ 454 ads = self.android_devices 455 456 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 457 (phone_setup_voice_general, (self.log, ads[1]))] 458 if not multithread_func(self.log, tasks): 459 self.log.error("Phone Failed to Set Up Properly.") 460 return False 461 462 return self._mms_test_mt(ads) 463 464 @TelephonyBaseTest.tel_test_wrap 465 def test_sms_mo_3g(self): 466 """Test SMS basic function between two phone. Phones in 3g network. 467 468 Airplane mode is off. 469 Send SMS from PhoneA to PhoneB. 470 Verify received message on PhoneB is correct. 471 472 Returns: 473 True if success. 474 False if failed. 475 """ 476 477 ads = self.android_devices 478 479 tasks = [(phone_setup_3g, (self.log, ads[0])), 480 (phone_setup_voice_general, (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 self._sms_test_mo(ads) 486 487 @TelephonyBaseTest.tel_test_wrap 488 def test_sms_mt_3g(self): 489 """Test SMS basic function between two phone. Phones in 3g network. 490 491 Airplane mode is off. 492 Send SMS from PhoneB to PhoneA. 493 Verify received message on PhoneA is correct. 494 495 Returns: 496 True if success. 497 False if failed. 498 """ 499 500 ads = self.android_devices 501 502 tasks = [(phone_setup_3g, (self.log, ads[0])), 503 (phone_setup_voice_general, (self.log, ads[1]))] 504 if not multithread_func(self.log, tasks): 505 self.log.error("Phone Failed to Set Up Properly.") 506 return False 507 508 return self._sms_test_mt(ads) 509 510 @TelephonyBaseTest.tel_test_wrap 511 def test_mms_mo_3g(self): 512 """Test MMS basic function between two phone. Phones in 3g network. 513 514 Airplane mode is off. 515 Send MMS from PhoneA to PhoneB. 516 Verify received message on PhoneB is correct. 517 518 Returns: 519 True if success. 520 False if failed. 521 """ 522 523 ads = self.android_devices 524 525 tasks = [(phone_setup_3g, (self.log, ads[0])), 526 (phone_setup_voice_general, (self.log, ads[1]))] 527 if not multithread_func(self.log, tasks): 528 self.log.error("Phone Failed to Set Up Properly.") 529 return False 530 531 return self._mms_test_mo(ads) 532 533 @TelephonyBaseTest.tel_test_wrap 534 def test_mms_mt_3g(self): 535 """Test MMS basic function between two phone. Phones in 3g network. 536 537 Airplane mode is off. 538 Send MMS from PhoneB to PhoneA. 539 Verify received message on PhoneA is correct. 540 541 Returns: 542 True if success. 543 False if failed. 544 """ 545 546 ads = self.android_devices 547 548 tasks = [(phone_setup_3g, (self.log, ads[0])), 549 (phone_setup_voice_general, (self.log, ads[1]))] 550 if not multithread_func(self.log, tasks): 551 self.log.error("Phone Failed to Set Up Properly.") 552 return False 553 554 return self._mms_test_mt(ads) 555 556 @TelephonyBaseTest.tel_test_wrap 557 def test_sms_mo_4g(self): 558 """Test SMS basic function between two phone. Phones in LTE network. 559 560 Airplane mode is off. 561 Send SMS from PhoneA to PhoneB. 562 Verify received message on PhoneB is correct. 563 564 Returns: 565 True if success. 566 False if failed. 567 """ 568 569 ads = self.android_devices 570 if (not phone_setup_data_general(self.log, ads[1]) and 571 not phone_setup_voice_general(self.log, ads[1])): 572 self.log.error("Failed to setup PhoneB.") 573 return False 574 if not ensure_network_generation(self.log, ads[0], GEN_4G): 575 self.log.error("DUT Failed to Set Up Properly.") 576 return False 577 578 return self._sms_test_mo(ads) 579 580 @TelephonyBaseTest.tel_test_wrap 581 def test_sms_mt_4g(self): 582 """Test SMS basic function between two phone. Phones in LTE network. 583 584 Airplane mode is off. 585 Send SMS from PhoneB to PhoneA. 586 Verify received message on PhoneA is correct. 587 588 Returns: 589 True if success. 590 False if failed. 591 """ 592 593 ads = self.android_devices 594 595 if (not phone_setup_data_general(self.log, ads[1]) and 596 not phone_setup_voice_general(self.log, ads[1])): 597 self.log.error("Failed to setup PhoneB.") 598 return False 599 if not ensure_network_generation(self.log, ads[0], GEN_4G): 600 self.log.error("DUT Failed to Set Up Properly.") 601 return False 602 603 return self._sms_test_mt(ads) 604 605 @TelephonyBaseTest.tel_test_wrap 606 def test_mms_mo_4g(self): 607 """Test MMS text function between two phone. Phones in LTE network. 608 609 Airplane mode is off. 610 Send MMS from PhoneA to PhoneB. 611 Verify received message on PhoneB is correct. 612 613 Returns: 614 True if success. 615 False if failed. 616 """ 617 618 #self.log.error("Test Case is non-functional: b/21569494") 619 #return False 620 621 ads = self.android_devices 622 623 tasks = [(phone_setup_csfb, (self.log, ads[0])), 624 (phone_setup_voice_general, (self.log, ads[1]))] 625 if not multithread_func(self.log, tasks): 626 self.log.error("Phone Failed to Set Up Properly.") 627 return False 628 629 return self._mms_test_mo(ads) 630 631 @TelephonyBaseTest.tel_test_wrap 632 def test_mms_mt_4g(self): 633 """Test MMS text function between two phone. Phones in LTE network. 634 635 Airplane mode is off. 636 Send MMS from PhoneB to PhoneA. 637 Verify received message on PhoneA is correct. 638 639 Returns: 640 True if success. 641 False if failed. 642 """ 643 644 ads = self.android_devices 645 646 tasks = [(phone_setup_csfb, (self.log, ads[0])), 647 (phone_setup_voice_general, (self.log, ads[1]))] 648 if not multithread_func(self.log, tasks): 649 self.log.error("Phone Failed to Set Up Properly.") 650 return False 651 652 return self._mms_test_mt(ads) 653 654 @TelephonyBaseTest.tel_test_wrap 655 def test_sms_mo_in_call_volte(self): 656 """ Test MO SMS during a MO VoLTE call. 657 658 Make sure PhoneA is in LTE mode (with VoLTE). 659 Make sure PhoneB is able to make/receive call. 660 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 661 662 Returns: 663 True if pass; False if fail. 664 """ 665 ads = self.android_devices 666 667 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 668 (self.log, ads[1]))] 669 if not multithread_func(self.log, tasks): 670 self.log.error("Phone Failed to Set Up Properly.") 671 return False 672 673 self.log.info("Begin In Call SMS Test.") 674 if not call_setup_teardown( 675 self.log, 676 ads[0], 677 ads[1], 678 ad_hangup=None, 679 verify_caller_func=is_phone_in_call_volte, 680 verify_callee_func=None): 681 return False 682 683 if not self._sms_test_mo(ads): 684 self.log.error("SMS test fail.") 685 return False 686 687 return True 688 689 @TelephonyBaseTest.tel_test_wrap 690 def test_sms_mt_in_call_volte(self): 691 """ Test MT SMS during a MO VoLTE call. 692 693 Make sure PhoneA is in LTE mode (with VoLTE). 694 Make sure PhoneB is able to make/receive call. 695 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 696 697 Returns: 698 True if pass; False if fail. 699 """ 700 ads = self.android_devices 701 702 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 703 (self.log, ads[1]))] 704 if not multithread_func(self.log, tasks): 705 self.log.error("Phone Failed to Set Up Properly.") 706 return False 707 708 self.log.info("Begin In Call SMS Test.") 709 if not call_setup_teardown( 710 self.log, 711 ads[0], 712 ads[1], 713 ad_hangup=None, 714 verify_caller_func=is_phone_in_call_volte, 715 verify_callee_func=None): 716 return False 717 718 if not self._sms_test_mt(ads): 719 self.log.error("SMS test fail.") 720 return False 721 722 return True 723 724 @TelephonyBaseTest.tel_test_wrap 725 def test_mms_mo_in_call_volte(self): 726 """ Test MO MMS during a MO VoLTE call. 727 728 Make sure PhoneA is in LTE mode (with VoLTE). 729 Make sure PhoneB is able to make/receive call. 730 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA. 731 732 Returns: 733 True if pass; False if fail. 734 """ 735 ads = self.android_devices 736 737 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 738 (self.log, ads[1]))] 739 if not multithread_func(self.log, tasks): 740 self.log.error("Phone Failed to Set Up Properly.") 741 return False 742 743 self.log.info("Begin In Call SMS Test.") 744 if not call_setup_teardown( 745 self.log, 746 ads[0], 747 ads[1], 748 ad_hangup=None, 749 verify_caller_func=is_phone_in_call_volte, 750 verify_callee_func=None): 751 return False 752 753 if not self._mms_test_mo(ads): 754 self.log.error("MMS test fail.") 755 return False 756 757 return True 758 759 @TelephonyBaseTest.tel_test_wrap 760 def test_mms_mt_in_call_volte(self): 761 """ Test MT MMS during a MO VoLTE call. 762 763 Make sure PhoneA is in LTE mode (with VoLTE). 764 Make sure PhoneB is able to make/receive call. 765 Call from PhoneA to PhoneB, accept on PhoneB, receive MMS on PhoneA. 766 767 Returns: 768 True if pass; False if fail. 769 """ 770 ads = self.android_devices 771 772 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 773 (self.log, ads[1]))] 774 if not multithread_func(self.log, tasks): 775 self.log.error("Phone Failed to Set Up Properly.") 776 return False 777 778 self.log.info("Begin In Call MMS Test.") 779 if not call_setup_teardown( 780 self.log, 781 ads[0], 782 ads[1], 783 ad_hangup=None, 784 verify_caller_func=is_phone_in_call_volte, 785 verify_callee_func=None): 786 return False 787 788 if not self._mms_test_mt(ads): 789 self.log.error("MMS test fail.") 790 return False 791 792 return True 793 794 @TelephonyBaseTest.tel_test_wrap 795 def test_sms_mo_in_call_wcdma(self): 796 """ Test MO SMS during a MO wcdma call. 797 798 Make sure PhoneA is in wcdma mode. 799 Make sure PhoneB is able to make/receive call. 800 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 801 802 Returns: 803 True if pass; False if fail. 804 """ 805 ads = self.android_devices 806 # Make sure PhoneA is GSM phone before proceed. 807 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 808 self.log.error("Not GSM phone, abort this wcdma SMS test.") 809 return False 810 811 tasks = [(phone_setup_3g, (self.log, ads[0])), 812 (phone_setup_voice_general, (self.log, ads[1]))] 813 if not multithread_func(self.log, tasks): 814 self.log.error("Phone Failed to Set Up Properly.") 815 return False 816 817 return self._mo_sms_in_3g_call(ads) 818 819 @TelephonyBaseTest.tel_test_wrap 820 def test_sms_mt_in_call_wcdma(self): 821 """ Test MT SMS during a MO wcdma call. 822 823 Make sure PhoneA is in wcdma mode. 824 Make sure PhoneB is able to make/receive call. 825 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 826 827 Returns: 828 True if pass; False if fail. 829 """ 830 ads = self.android_devices 831 # Make sure PhoneA is GSM phone before proceed. 832 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 833 self.log.error("Not GSM phone, abort this wcdma SMS test.") 834 return False 835 836 tasks = [(phone_setup_3g, (self.log, ads[0])), 837 (phone_setup_voice_general, (self.log, ads[1]))] 838 if not multithread_func(self.log, tasks): 839 self.log.error("Phone Failed to Set Up Properly.") 840 return False 841 842 return self._mt_sms_in_3g_call(ads) 843 844 @TelephonyBaseTest.tel_test_wrap 845 def test_mms_mo_in_call_wcdma(self): 846 """ Test MO MMS during a MO wcdma call. 847 848 Make sure PhoneA is in wcdma mode. 849 Make sure PhoneB is able to make/receive call. 850 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA. 851 852 Returns: 853 True if pass; False if fail. 854 """ 855 ads = self.android_devices 856 # Make sure PhoneA is GSM phone before proceed. 857 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 858 self.log.error("Not GSM phone, abort this wcdma MMS test.") 859 return False 860 861 tasks = [(phone_setup_3g, (self.log, ads[0])), 862 (phone_setup_voice_general, (self.log, ads[1]))] 863 if not multithread_func(self.log, tasks): 864 self.log.error("Phone Failed to Set Up Properly.") 865 return False 866 867 return self._mo_mms_in_3g_call(ads) 868 869 @TelephonyBaseTest.tel_test_wrap 870 def test_mms_mt_in_call_wcdma(self): 871 """ Test MT MMS during a MO wcdma call. 872 873 Make sure PhoneA is in wcdma mode. 874 Make sure PhoneB is able to make/receive call. 875 Call from PhoneA to PhoneB, accept on PhoneB, receive MMS on PhoneA. 876 877 Returns: 878 True if pass; False if fail. 879 """ 880 ads = self.android_devices 881 # Make sure PhoneA is GSM phone before proceed. 882 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 883 self.log.error("Not GSM phone, abort this wcdma MMS test.") 884 return False 885 886 tasks = [(phone_setup_3g, (self.log, ads[0])), 887 (phone_setup_voice_general, (self.log, ads[1]))] 888 if not multithread_func(self.log, tasks): 889 self.log.error("Phone Failed to Set Up Properly.") 890 return False 891 892 return self._mt_mms_in_3g_call(ads) 893 894 @TelephonyBaseTest.tel_test_wrap 895 def test_sms_mo_in_call_csfb(self): 896 """ Test MO SMS during a MO csfb wcdma/gsm call. 897 898 Make sure PhoneA is in LTE mode (no VoLTE). 899 Make sure PhoneB is able to make/receive call. 900 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 901 902 Returns: 903 True if pass; False if fail. 904 """ 905 ads = self.android_devices 906 # Make sure PhoneA is GSM phone before proceed. 907 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 908 self.log.error("Not GSM phone, abort this csfb wcdma SMS test.") 909 return False 910 911 tasks = [(phone_setup_csfb, (self.log, ads[0])), 912 (phone_setup_voice_general, (self.log, ads[1]))] 913 if not multithread_func(self.log, tasks): 914 self.log.error("Phone Failed to Set Up Properly.") 915 return False 916 917 self.log.info("Begin In Call SMS Test.") 918 if not call_setup_teardown( 919 self.log, 920 ads[0], 921 ads[1], 922 ad_hangup=None, 923 verify_caller_func=is_phone_in_call_csfb, 924 verify_callee_func=None): 925 return False 926 927 if not self._sms_test_mo(ads): 928 self.log.error("SMS test fail.") 929 return False 930 931 return True 932 933 @TelephonyBaseTest.tel_test_wrap 934 def test_sms_mt_in_call_csfb(self): 935 """ Test MT SMS during a MO csfb wcdma/gsm call. 936 937 Make sure PhoneA is in LTE mode (no VoLTE). 938 Make sure PhoneB is able to make/receive call. 939 Call from PhoneA to PhoneB, accept on PhoneB, receive receive on PhoneA. 940 941 Returns: 942 True if pass; False if fail. 943 """ 944 ads = self.android_devices 945 # Make sure PhoneA is GSM phone before proceed. 946 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 947 self.log.error("Not GSM phone, abort this csfb wcdma SMS test.") 948 return False 949 950 tasks = [(phone_setup_csfb, (self.log, ads[0])), 951 (phone_setup_voice_general, (self.log, ads[1]))] 952 if not multithread_func(self.log, tasks): 953 self.log.error("Phone Failed to Set Up Properly.") 954 return False 955 956 self.log.info("Begin In Call SMS Test.") 957 if not call_setup_teardown( 958 self.log, 959 ads[0], 960 ads[1], 961 ad_hangup=None, 962 verify_caller_func=is_phone_in_call_csfb, 963 verify_callee_func=None): 964 return False 965 966 if not self._sms_test_mt(ads): 967 self.log.error("SMS test fail.") 968 return False 969 970 return True 971 972 @TelephonyBaseTest.tel_test_wrap 973 def test_mms_mo_in_call_csfb(self): 974 """ Test MO MMS during a MO csfb wcdma/gsm call. 975 976 Make sure PhoneA is in LTE mode (no VoLTE). 977 Make sure PhoneB is able to make/receive call. 978 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA. 979 980 Returns: 981 True if pass; False if fail. 982 """ 983 ads = self.android_devices 984 # Make sure PhoneA is GSM phone before proceed. 985 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 986 self.log.error("Not GSM phone, abort this csfb wcdma SMS test.") 987 return False 988 989 tasks = [(phone_setup_csfb, (self.log, ads[0])), 990 (phone_setup_voice_general, (self.log, ads[1]))] 991 if not multithread_func(self.log, tasks): 992 self.log.error("Phone Failed to Set Up Properly.") 993 return False 994 995 self.log.info("Begin In Call MMS Test.") 996 if not call_setup_teardown( 997 self.log, 998 ads[0], 999 ads[1], 1000 ad_hangup=None, 1001 verify_caller_func=is_phone_in_call_csfb, 1002 verify_callee_func=None): 1003 return False 1004 1005 if not self._mms_test_mo(ads): 1006 self.log.error("MMS test fail.") 1007 return False 1008 1009 return True 1010 1011 @TelephonyBaseTest.tel_test_wrap 1012 def test_mms_mt_in_call_csfb(self): 1013 """ Test MT MMS during a MO csfb wcdma/gsm call. 1014 1015 Make sure PhoneA is in LTE mode (no VoLTE). 1016 Make sure PhoneB is able to make/receive call. 1017 Call from PhoneA to PhoneB, accept on PhoneB, receive receive on PhoneA. 1018 1019 Returns: 1020 True if pass; False if fail. 1021 """ 1022 ads = self.android_devices 1023 # Make sure PhoneA is GSM phone before proceed. 1024 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 1025 self.log.error("Not GSM phone, abort this csfb wcdma MMS test.") 1026 return False 1027 1028 tasks = [(phone_setup_csfb, (self.log, ads[0])), 1029 (phone_setup_voice_general, (self.log, ads[1]))] 1030 if not multithread_func(self.log, tasks): 1031 self.log.error("Phone Failed to Set Up Properly.") 1032 return False 1033 1034 self.log.info("Begin In Call MMS Test.") 1035 if not call_setup_teardown( 1036 self.log, 1037 ads[0], 1038 ads[1], 1039 ad_hangup=None, 1040 verify_caller_func=is_phone_in_call_csfb, 1041 verify_callee_func=None): 1042 return False 1043 1044 if not self._mms_test_mt(ads): 1045 self.log.error("MMS test fail.") 1046 return False 1047 1048 return True 1049 1050 @TelephonyBaseTest.tel_test_wrap 1051 def test_sms_mo_in_call_1x(self): 1052 """ Test MO SMS during a MO 1x call. 1053 1054 Make sure PhoneA is in 1x mode. 1055 Make sure PhoneB is able to make/receive call. 1056 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 1057 1058 Returns: 1059 True if pass; False if fail. 1060 """ 1061 ads = self.android_devices 1062 # Make sure PhoneA is CDMA phone before proceed. 1063 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1064 self.log.error("Not CDMA phone, abort this 1x SMS test.") 1065 return False 1066 1067 tasks = [(phone_setup_3g, (self.log, ads[0])), 1068 (phone_setup_voice_general, (self.log, ads[1]))] 1069 if not multithread_func(self.log, tasks): 1070 self.log.error("Phone Failed to Set Up Properly.") 1071 return False 1072 1073 self.log.info("Begin In Call SMS Test.") 1074 if not call_setup_teardown( 1075 self.log, 1076 ads[0], 1077 ads[1], 1078 ad_hangup=None, 1079 verify_caller_func=is_phone_in_call_1x, 1080 verify_callee_func=None): 1081 return False 1082 1083 if not self._sms_test_mo(ads): 1084 self.log.error("SMS test fail.") 1085 return False 1086 1087 return True 1088 1089 @TelephonyBaseTest.tel_test_wrap 1090 def test_sms_mt_in_call_1x(self): 1091 """ Test MT SMS during a MO 1x call. 1092 1093 Make sure PhoneA is in 1x mode. 1094 Make sure PhoneB is able to make/receive call. 1095 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 1096 1097 Returns: 1098 True if pass; False if fail. 1099 """ 1100 ads = self.android_devices 1101 # Make sure PhoneA is CDMA phone before proceed. 1102 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1103 self.log.error("Not CDMA phone, abort this 1x SMS test.") 1104 return False 1105 1106 tasks = [(phone_setup_3g, (self.log, ads[0])), 1107 (phone_setup_voice_general, (self.log, ads[1]))] 1108 if not multithread_func(self.log, tasks): 1109 self.log.error("Phone Failed to Set Up Properly.") 1110 return False 1111 1112 self.log.info("Begin In Call SMS Test.") 1113 if not call_setup_teardown( 1114 self.log, 1115 ads[0], 1116 ads[1], 1117 ad_hangup=None, 1118 verify_caller_func=is_phone_in_call_1x, 1119 verify_callee_func=None): 1120 return False 1121 1122 if not self._sms_test_mt(ads): 1123 self.log.error("SMS test fail.") 1124 return False 1125 1126 return True 1127 1128 @TelephonyBaseTest.tel_test_wrap 1129 def test_mms_mo_in_call_1x(self): 1130 """ Test MO MMS during a MO 1x call. 1131 1132 Make sure PhoneA is in 1x mode. 1133 Make sure PhoneB is able to make/receive call. 1134 Call from PhoneA to PhoneB, accept on PhoneB. 1135 Send MMS on PhoneA during the call, MMS is send out after call is released. 1136 1137 Returns: 1138 True if pass; False if fail. 1139 """ 1140 ads = self.android_devices 1141 # Make sure PhoneA is CDMA phone before proceed. 1142 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1143 self.log.error("Not CDMA phone, abort this 1x MMS test.") 1144 return False 1145 1146 tasks = [(phone_setup_3g, (self.log, ads[0])), 1147 (phone_setup_voice_general, (self.log, ads[1]))] 1148 if not multithread_func(self.log, tasks): 1149 self.log.error("Phone Failed to Set Up Properly.") 1150 return False 1151 1152 self.log.info("Begin In Call MMS Test.") 1153 if not call_setup_teardown( 1154 self.log, 1155 ads[0], 1156 ads[1], 1157 ad_hangup=None, 1158 verify_caller_func=is_phone_in_call_1x, 1159 verify_callee_func=None): 1160 return False 1161 1162 return self._mms_test_mo_after_call_hangup(ads) 1163 1164 @TelephonyBaseTest.tel_test_wrap 1165 def test_mms_mt_in_call_1x(self): 1166 """ Test MT MMS during a MO 1x call. 1167 1168 Make sure PhoneA is in 1x mode. 1169 Make sure PhoneB is able to make/receive call. 1170 Call from PhoneA to PhoneB, accept on PhoneB, receive MMS on PhoneA. 1171 1172 Returns: 1173 True if pass; False if fail. 1174 """ 1175 ads = self.android_devices 1176 # Make sure PhoneA is CDMA phone before proceed. 1177 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1178 self.log.error("Not CDMA phone, abort this 1x MMS test.") 1179 return False 1180 1181 tasks = [(phone_setup_3g, (self.log, ads[0])), 1182 (phone_setup_voice_general, (self.log, ads[1]))] 1183 if not multithread_func(self.log, tasks): 1184 self.log.error("Phone Failed to Set Up Properly.") 1185 return False 1186 1187 self.log.info("Begin In Call MMS Test.") 1188 if not call_setup_teardown( 1189 self.log, 1190 ads[0], 1191 ads[1], 1192 ad_hangup=None, 1193 verify_caller_func=is_phone_in_call_1x, 1194 verify_callee_func=None): 1195 return False 1196 1197 return self._mms_test_mt_after_call_hangup(ads) 1198 1199 @TelephonyBaseTest.tel_test_wrap 1200 def test_sms_mo_in_call_csfb_1x(self): 1201 """ Test MO SMS during a MO csfb 1x call. 1202 1203 Make sure PhoneA is in LTE mode (no VoLTE). 1204 Make sure PhoneB is able to make/receive call. 1205 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 1206 1207 Returns: 1208 True if pass; False if fail. 1209 """ 1210 ads = self.android_devices 1211 # Make sure PhoneA is CDMA phone before proceed. 1212 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1213 self.log.error("Not CDMA phone, abort this csfb 1x SMS test.") 1214 return False 1215 1216 tasks = [(phone_setup_csfb, (self.log, ads[0])), 1217 (phone_setup_voice_general, (self.log, ads[1]))] 1218 if not multithread_func(self.log, tasks): 1219 self.log.error("Phone Failed to Set Up Properly.") 1220 return False 1221 1222 self.log.info("Begin In Call SMS Test.") 1223 if not call_setup_teardown( 1224 self.log, 1225 ads[0], 1226 ads[1], 1227 ad_hangup=None, 1228 verify_caller_func=is_phone_in_call_1x, 1229 verify_callee_func=None): 1230 return False 1231 1232 if not self._sms_test_mo(ads): 1233 self.log.error("SMS test fail.") 1234 return False 1235 1236 return True 1237 1238 @TelephonyBaseTest.tel_test_wrap 1239 def test_sms_mt_in_call_csfb_1x(self): 1240 """ Test MT SMS during a MO csfb 1x call. 1241 1242 Make sure PhoneA is in LTE mode (no VoLTE). 1243 Make sure PhoneB is able to make/receive call. 1244 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 1245 1246 Returns: 1247 True if pass; False if fail. 1248 """ 1249 ads = self.android_devices 1250 # Make sure PhoneA is CDMA phone before proceed. 1251 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1252 self.log.error("Not CDMA phone, abort this csfb 1x SMS test.") 1253 return False 1254 1255 tasks = [(phone_setup_csfb, (self.log, ads[0])), 1256 (phone_setup_voice_general, (self.log, ads[1]))] 1257 if not multithread_func(self.log, tasks): 1258 self.log.error("Phone Failed to Set Up Properly.") 1259 return False 1260 1261 self.log.info("Begin In Call SMS Test.") 1262 if not call_setup_teardown( 1263 self.log, 1264 ads[0], 1265 ads[1], 1266 ad_hangup=None, 1267 verify_caller_func=is_phone_in_call_1x, 1268 verify_callee_func=None): 1269 return False 1270 1271 if not self._sms_test_mt(ads): 1272 self.log.error("SMS test fail.") 1273 return False 1274 1275 return True 1276 1277 @TelephonyBaseTest.tel_test_wrap 1278 def test_mms_mo_in_call_csfb_1x(self): 1279 """ Test MO MMS during a MO csfb 1x call. 1280 1281 Make sure PhoneA is in LTE mode (no VoLTE). 1282 Make sure PhoneB is able to make/receive call. 1283 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA. 1284 1285 Returns: 1286 True if pass; False if fail. 1287 """ 1288 ads = self.android_devices 1289 # Make sure PhoneA is CDMA phone before proceed. 1290 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1291 self.log.error("Not CDMA phone, abort this csfb 1x SMS test.") 1292 return False 1293 1294 tasks = [(phone_setup_csfb, (self.log, ads[0])), 1295 (phone_setup_voice_general, (self.log, ads[1]))] 1296 if not multithread_func(self.log, tasks): 1297 self.log.error("Phone Failed to Set Up Properly.") 1298 return False 1299 1300 self.log.info("Begin In Call MMS Test.") 1301 if not call_setup_teardown( 1302 self.log, 1303 ads[0], 1304 ads[1], 1305 ad_hangup=None, 1306 verify_caller_func=is_phone_in_call_1x, 1307 verify_callee_func=None): 1308 return False 1309 1310 return self._mms_test_mo_after_call_hangup(ads) 1311 1312 @TelephonyBaseTest.tel_test_wrap 1313 def test_mms_mt_in_call_csfb_1x(self): 1314 """ Test MT MMS during a MO csfb 1x call. 1315 1316 Make sure PhoneA is in LTE mode (no VoLTE). 1317 Make sure PhoneB is able to make/receive call. 1318 Call from PhoneA to PhoneB, accept on PhoneB, receive MMS on PhoneA. 1319 1320 Returns: 1321 True if pass; False if fail. 1322 """ 1323 ads = self.android_devices 1324 # Make sure PhoneA is CDMA phone before proceed. 1325 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 1326 self.log.error("Not CDMA phone, abort this csfb 1x MMS test.") 1327 return False 1328 1329 tasks = [(phone_setup_csfb, (self.log, ads[0])), 1330 (phone_setup_voice_general, (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 self.log.info("Begin In Call MMS Test.") 1336 if not call_setup_teardown( 1337 self.log, 1338 ads[0], 1339 ads[1], 1340 ad_hangup=None, 1341 verify_caller_func=is_phone_in_call_1x, 1342 verify_callee_func=None): 1343 return False 1344 1345 return self._mms_test_mt_after_call_hangup(ads) 1346 1347 @TelephonyBaseTest.tel_test_wrap 1348 def test_sms_mo_iwlan(self): 1349 """ Test MO SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1350 1351 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1352 Make sure PhoneA report iwlan as data rat. 1353 Make sure PhoneB is able to make/receive call/sms. 1354 Send SMS on PhoneA. 1355 1356 Returns: 1357 True if pass; False if fail. 1358 """ 1359 1360 ads = self.android_devices 1361 1362 tasks = [(phone_setup_iwlan, 1363 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1364 self.wifi_network_ssid, self.wifi_network_pass)), 1365 (phone_setup_voice_general, (self.log, ads[1]))] 1366 if not multithread_func(self.log, tasks): 1367 self.log.error("Phone Failed to Set Up Properly.") 1368 return False 1369 1370 return self._sms_test_mo(ads) 1371 1372 @TelephonyBaseTest.tel_test_wrap 1373 def test_sms_mt_iwlan(self): 1374 """ Test MT SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1375 1376 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1377 Make sure PhoneA report iwlan as data rat. 1378 Make sure PhoneB is able to make/receive call/sms. 1379 Receive SMS on PhoneA. 1380 1381 Returns: 1382 True if pass; False if fail. 1383 """ 1384 1385 ads = self.android_devices 1386 1387 tasks = [(phone_setup_iwlan, 1388 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1389 self.wifi_network_ssid, self.wifi_network_pass)), 1390 (phone_setup_voice_general, (self.log, ads[1]))] 1391 if not multithread_func(self.log, tasks): 1392 self.log.error("Phone Failed to Set Up Properly.") 1393 return False 1394 1395 return self._sms_test_mt(ads) 1396 1397 @TelephonyBaseTest.tel_test_wrap 1398 def test_mms_mo_iwlan(self): 1399 """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1400 1401 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1402 Make sure PhoneA report iwlan as data rat. 1403 Make sure PhoneB is able to make/receive call/sms. 1404 Send MMS on PhoneA. 1405 1406 Returns: 1407 True if pass; False if fail. 1408 """ 1409 1410 ads = self.android_devices 1411 1412 tasks = [(phone_setup_iwlan, 1413 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1414 self.wifi_network_ssid, self.wifi_network_pass)), 1415 (phone_setup_voice_general, (self.log, ads[1]))] 1416 if not multithread_func(self.log, tasks): 1417 self.log.error("Phone Failed to Set Up Properly.") 1418 return False 1419 1420 return self._mms_test_mo(ads) 1421 1422 @TelephonyBaseTest.tel_test_wrap 1423 def test_mms_mt_iwlan(self): 1424 """ Test MT MMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1425 1426 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1427 Make sure PhoneA report iwlan as data rat. 1428 Make sure PhoneB is able to make/receive call/sms. 1429 Receive MMS on PhoneA. 1430 1431 Returns: 1432 True if pass; False if fail. 1433 """ 1434 1435 ads = self.android_devices 1436 1437 tasks = [(phone_setup_iwlan, 1438 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1439 self.wifi_network_ssid, self.wifi_network_pass)), 1440 (phone_setup_voice_general, (self.log, ads[1]))] 1441 if not multithread_func(self.log, tasks): 1442 self.log.error("Phone Failed to Set Up Properly.") 1443 return False 1444 1445 return self._mms_test_mt(ads) 1446 1447 @TelephonyBaseTest.tel_test_wrap 1448 def test_sms_mo_apm_wifi_wfc_off(self): 1449 """ Test MO SMS, Phone in APM, WiFi connected, WFC off. 1450 1451 Make sure PhoneA APM, WiFi connected, WFC off. 1452 Make sure PhoneB is able to make/receive call/sms. 1453 Send SMS on PhoneA. 1454 1455 Returns: 1456 True if pass; False if fail. 1457 """ 1458 1459 ads = self.android_devices 1460 phone_setup_voice_general(self.log, ads[0]) 1461 tasks = [(ensure_wifi_connected, ( 1462 self.log, ads[0], self.wifi_network_ssid, self.wifi_network_pass)), 1463 (phone_setup_voice_general, (self.log, ads[1]))] 1464 if not multithread_func(self.log, tasks): 1465 self.log.error("Phone Failed to Set Up Properly.") 1466 return False 1467 1468 return self._sms_test_mo(ads) 1469 1470 @TelephonyBaseTest.tel_test_wrap 1471 def test_sms_mt_apm_wifi_wfc_off(self): 1472 """ Test MT SMS, Phone in APM, WiFi connected, WFC off. 1473 1474 Make sure PhoneA APM, WiFi connected, WFC off. 1475 Make sure PhoneB is able to make/receive call/sms. 1476 Receive SMS on PhoneA. 1477 1478 Returns: 1479 True if pass; False if fail. 1480 """ 1481 1482 ads = self.android_devices 1483 phone_setup_voice_general(self.log, ads[0]) 1484 tasks = [(ensure_wifi_connected, ( 1485 self.log, ads[0], self.wifi_network_ssid, self.wifi_network_pass)), 1486 (phone_setup_voice_general, (self.log, ads[1]))] 1487 if not multithread_func(self.log, tasks): 1488 self.log.error("Phone Failed to Set Up Properly.") 1489 return False 1490 1491 return self._sms_test_mt(ads) 1492 1493 @TelephonyBaseTest.tel_test_wrap 1494 def test_mms_mo_apm_wifi_wfc_off(self): 1495 """ Test MO MMS, Phone in APM, WiFi connected, WFC off. 1496 1497 Make sure PhoneA APM, WiFi connected, WFC off. 1498 Make sure PhoneB is able to make/receive call/sms. 1499 Send MMS on PhoneA. 1500 1501 Returns: 1502 True if pass; False if fail. 1503 """ 1504 1505 ads = self.android_devices 1506 phone_setup_voice_general(self.log, ads[0]) 1507 tasks = [(ensure_wifi_connected, ( 1508 self.log, ads[0], self.wifi_network_ssid, self.wifi_network_pass)), 1509 (phone_setup_voice_general, (self.log, ads[1]))] 1510 if not multithread_func(self.log, tasks): 1511 self.log.error("Phone Failed to Set Up Properly.") 1512 return False 1513 1514 return self._mms_test_mo(ads) 1515 1516 @TelephonyBaseTest.tel_test_wrap 1517 def test_mms_mt_apm_wifi_wfc_off(self): 1518 """ Test MT MMS, Phone in APM, WiFi connected, WFC off. 1519 1520 Make sure PhoneA APM, WiFi connected, WFC off. 1521 Make sure PhoneB is able to make/receive call/sms. 1522 Receive MMS on PhoneA. 1523 1524 Returns: 1525 True if pass; False if fail. 1526 """ 1527 1528 ads = self.android_devices 1529 phone_setup_voice_general(self.log, ads[0]) 1530 tasks = [(ensure_wifi_connected, ( 1531 self.log, ads[0], self.wifi_network_ssid, self.wifi_network_pass)), 1532 (phone_setup_voice_general, (self.log, ads[1]))] 1533 if not multithread_func(self.log, tasks): 1534 self.log.error("Phone Failed to Set Up Properly.") 1535 return False 1536 1537 return self._mms_test_mt(ads) 1538 1539 @TelephonyBaseTest.tel_test_wrap 1540 def test_sms_mo_in_call_iwlan(self): 1541 """ Test MO SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1542 1543 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1544 Make sure PhoneA report iwlan as data rat. 1545 Make sure PhoneB is able to make/receive call/sms. 1546 Call from PhoneA to PhoneB, accept on PhoneB. 1547 Send SMS on PhoneA. 1548 1549 Returns: 1550 True if pass; False if fail. 1551 """ 1552 1553 ads = self.android_devices 1554 1555 tasks = [(phone_setup_iwlan, 1556 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1557 self.wifi_network_ssid, self.wifi_network_pass)), 1558 (phone_setup_voice_general, (self.log, ads[1]))] 1559 if not multithread_func(self.log, tasks): 1560 self.log.error("Phone Failed to Set Up Properly.") 1561 return False 1562 1563 self.log.info("Begin In Call SMS Test.") 1564 if not call_setup_teardown( 1565 self.log, 1566 ads[0], 1567 ads[1], 1568 ad_hangup=None, 1569 verify_caller_func=is_phone_in_call_iwlan, 1570 verify_callee_func=None): 1571 return False 1572 1573 return self._sms_test_mo(ads) 1574 1575 @TelephonyBaseTest.tel_test_wrap 1576 def test_sms_mt_in_call_iwlan(self): 1577 """ Test MT SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1578 1579 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1580 Make sure PhoneA report iwlan as data rat. 1581 Make sure PhoneB is able to make/receive call/sms. 1582 Call from PhoneA to PhoneB, accept on PhoneB. 1583 Receive SMS on PhoneA. 1584 1585 Returns: 1586 True if pass; False if fail. 1587 """ 1588 1589 ads = self.android_devices 1590 1591 tasks = [(phone_setup_iwlan, 1592 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1593 self.wifi_network_ssid, self.wifi_network_pass)), 1594 (phone_setup_voice_general, (self.log, ads[1]))] 1595 if not multithread_func(self.log, tasks): 1596 self.log.error("Phone Failed to Set Up Properly.") 1597 return False 1598 1599 self.log.info("Begin In Call SMS Test.") 1600 if not call_setup_teardown( 1601 self.log, 1602 ads[0], 1603 ads[1], 1604 ad_hangup=None, 1605 verify_caller_func=is_phone_in_call_iwlan, 1606 verify_callee_func=None): 1607 return False 1608 1609 return self._sms_test_mt(ads) 1610 1611 @TelephonyBaseTest.tel_test_wrap 1612 def test_mms_mo_in_call_iwlan(self): 1613 """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1614 1615 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1616 Make sure PhoneA report iwlan as data rat. 1617 Make sure PhoneB is able to make/receive call/sms. 1618 Call from PhoneA to PhoneB, accept on PhoneB. 1619 Send MMS on PhoneA. 1620 1621 Returns: 1622 True if pass; False if fail. 1623 """ 1624 1625 ads = self.android_devices 1626 1627 tasks = [(phone_setup_iwlan, 1628 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1629 self.wifi_network_ssid, self.wifi_network_pass)), 1630 (phone_setup_voice_general, (self.log, ads[1]))] 1631 if not multithread_func(self.log, tasks): 1632 self.log.error("Phone Failed to Set Up Properly.") 1633 return False 1634 1635 self.log.info("Begin In Call MMS Test.") 1636 if not call_setup_teardown( 1637 self.log, 1638 ads[0], 1639 ads[1], 1640 ad_hangup=None, 1641 verify_caller_func=is_phone_in_call_iwlan, 1642 verify_callee_func=None): 1643 return False 1644 1645 return self._mms_test_mo(ads) 1646 1647 @TelephonyBaseTest.tel_test_wrap 1648 def test_mms_mt_in_call_iwlan(self): 1649 """ Test MT MMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 1650 1651 Make sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 1652 Make sure PhoneA report iwlan as data rat. 1653 Make sure PhoneB is able to make/receive call/sms. 1654 Call from PhoneA to PhoneB, accept on PhoneB. 1655 Receive MMS on PhoneA. 1656 1657 Returns: 1658 True if pass; False if fail. 1659 """ 1660 1661 ads = self.android_devices 1662 1663 tasks = [(phone_setup_iwlan, 1664 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 1665 self.wifi_network_ssid, self.wifi_network_pass)), 1666 (phone_setup_voice_general, (self.log, ads[1]))] 1667 if not multithread_func(self.log, tasks): 1668 self.log.error("Phone Failed to Set Up Properly.") 1669 return False 1670 1671 self.log.info("Begin In Call MMS Test.") 1672 if not call_setup_teardown( 1673 self.log, 1674 ads[0], 1675 ads[1], 1676 ad_hangup=None, 1677 verify_caller_func=is_phone_in_call_iwlan, 1678 verify_callee_func=None): 1679 return False 1680 1681 return self._mms_test_mt(ads) 1682 1683 @TelephonyBaseTest.tel_test_wrap 1684 def test_sms_mo_in_call_vt(self): 1685 """ Test MO SMS, Phone in ongoing VT call. 1686 1687 Make sure PhoneA and PhoneB in LTE and can make VT call. 1688 Make Video Call from PhoneA to PhoneB, accept on PhoneB as Video Call. 1689 Send SMS on PhoneA. 1690 1691 Returns: 1692 True if pass; False if fail. 1693 """ 1694 ads = self.android_devices 1695 1696 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 1697 (self.log, ads[1]))] 1698 if not multithread_func(self.log, tasks): 1699 self.log.error("Phone Failed to Set Up Properly.") 1700 return False 1701 1702 if not video_call_setup_teardown( 1703 self.log, 1704 ads[0], 1705 ads[1], 1706 None, 1707 video_state=VT_STATE_BIDIRECTIONAL, 1708 verify_caller_func=is_phone_in_call_video_bidirectional, 1709 verify_callee_func=is_phone_in_call_video_bidirectional): 1710 self.log.error("Failed to setup a call") 1711 return False 1712 1713 return self._sms_test_mo(ads) 1714 1715 @TelephonyBaseTest.tel_test_wrap 1716 def test_sms_mt_in_call_vt(self): 1717 """ Test MT SMS, Phone in ongoing VT call. 1718 1719 Make sure PhoneA and PhoneB in LTE and can make VT call. 1720 Make Video Call from PhoneA to PhoneB, accept on PhoneB as Video Call. 1721 Receive SMS on PhoneA. 1722 1723 Returns: 1724 True if pass; False if fail. 1725 """ 1726 ads = self.android_devices 1727 1728 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 1729 (self.log, ads[1]))] 1730 if not multithread_func(self.log, tasks): 1731 self.log.error("Phone Failed to Set Up Properly.") 1732 return False 1733 1734 if not video_call_setup_teardown( 1735 self.log, 1736 ads[0], 1737 ads[1], 1738 None, 1739 video_state=VT_STATE_BIDIRECTIONAL, 1740 verify_caller_func=is_phone_in_call_video_bidirectional, 1741 verify_callee_func=is_phone_in_call_video_bidirectional): 1742 self.log.error("Failed to setup a call") 1743 return False 1744 1745 return self._sms_test_mt(ads) 1746 1747 @TelephonyBaseTest.tel_test_wrap 1748 def test_mms_mo_in_call_vt(self): 1749 """ Test MO MMS, Phone in ongoing VT call. 1750 1751 Make sure PhoneA and PhoneB in LTE and can make VT call. 1752 Make Video Call from PhoneA to PhoneB, accept on PhoneB as Video Call. 1753 Send MMS on PhoneA. 1754 1755 Returns: 1756 True if pass; False if fail. 1757 """ 1758 ads = self.android_devices 1759 1760 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 1761 (self.log, ads[1]))] 1762 if not multithread_func(self.log, tasks): 1763 self.log.error("Phone Failed to Set Up Properly.") 1764 return False 1765 1766 if not video_call_setup_teardown( 1767 self.log, 1768 ads[0], 1769 ads[1], 1770 None, 1771 video_state=VT_STATE_BIDIRECTIONAL, 1772 verify_caller_func=is_phone_in_call_video_bidirectional, 1773 verify_callee_func=is_phone_in_call_video_bidirectional): 1774 self.log.error("Failed to setup a call") 1775 return False 1776 1777 return self._mms_test_mo(ads) 1778 1779 @TelephonyBaseTest.tel_test_wrap 1780 def test_mms_mt_in_call_vt(self): 1781 """ Test MT MMS, Phone in ongoing VT call. 1782 1783 Make sure PhoneA and PhoneB in LTE and can make VT call. 1784 Make Video Call from PhoneA to PhoneB, accept on PhoneB as Video Call. 1785 Receive MMS on PhoneA. 1786 1787 Returns: 1788 True if pass; False if fail. 1789 """ 1790 ads = self.android_devices 1791 1792 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 1793 (self.log, ads[1]))] 1794 if not multithread_func(self.log, tasks): 1795 self.log.error("Phone Failed to Set Up Properly.") 1796 return False 1797 1798 if not video_call_setup_teardown( 1799 self.log, 1800 ads[0], 1801 ads[1], 1802 None, 1803 video_state=VT_STATE_BIDIRECTIONAL, 1804 verify_caller_func=is_phone_in_call_video_bidirectional, 1805 verify_callee_func=is_phone_in_call_video_bidirectional): 1806 self.log.error("Failed to setup a call") 1807 return False 1808 1809 return self._mms_test_mt(ads) 1810 1811 @TelephonyBaseTest.tel_test_wrap 1812 def test_sms_mo_in_call_gsm(self): 1813 """ Test MO SMS during a MO gsm call. 1814 1815 Make sure PhoneA is in gsm mode. 1816 Make sure PhoneB is able to make/receive call. 1817 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 1818 1819 Returns: 1820 True if pass; False if fail. 1821 """ 1822 ads = self.android_devices 1823 # Make sure PhoneA is GSM phone before proceed. 1824 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 1825 self.log.error("Not GSM phone, abort this gsm SMS test.") 1826 return False 1827 1828 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 1829 (phone_setup_voice_general, (self.log, ads[1]))] 1830 if not multithread_func(self.log, tasks): 1831 self.log.error("Phone Failed to Set Up Properly.") 1832 return False 1833 1834 self.log.info("Begin In Call SMS Test.") 1835 if not call_setup_teardown( 1836 self.log, 1837 ads[0], 1838 ads[1], 1839 ad_hangup=None, 1840 verify_caller_func=is_phone_in_call_2g, 1841 verify_callee_func=None): 1842 return False 1843 1844 if not self._sms_test_mo(ads): 1845 self.log.error("SMS test fail.") 1846 return False 1847 1848 return True 1849 1850 @TelephonyBaseTest.tel_test_wrap 1851 def test_sms_mt_in_call_gsm(self): 1852 """ Test MT SMS during a MO gsm call. 1853 1854 Make sure PhoneA is in gsm mode. 1855 Make sure PhoneB is able to make/receive call. 1856 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 1857 1858 Returns: 1859 True if pass; False if fail. 1860 """ 1861 ads = self.android_devices 1862 # Make sure PhoneA is GSM phone before proceed. 1863 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 1864 self.log.error("Not GSM phone, abort this gsm SMS test.") 1865 return False 1866 1867 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 1868 (phone_setup_voice_general, (self.log, ads[1]))] 1869 if not multithread_func(self.log, tasks): 1870 self.log.error("Phone Failed to Set Up Properly.") 1871 return False 1872 1873 self.log.info("Begin In Call SMS Test.") 1874 if not call_setup_teardown( 1875 self.log, 1876 ads[0], 1877 ads[1], 1878 ad_hangup=None, 1879 verify_caller_func=is_phone_in_call_2g, 1880 verify_callee_func=None): 1881 return False 1882 1883 if not self._sms_test_mt(ads): 1884 self.log.error("SMS test fail.") 1885 return False 1886 1887 return True 1888 1889 @TelephonyBaseTest.tel_test_wrap 1890 def test_mms_mo_in_call_gsm(self): 1891 """ Test MO MMS during a MO gsm call. 1892 1893 Make sure PhoneA is in gsm mode. 1894 Make sure PhoneB is able to make/receive call. 1895 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA. 1896 1897 Returns: 1898 True if pass; False if fail. 1899 """ 1900 ads = self.android_devices 1901 # Make sure PhoneA is GSM phone before proceed. 1902 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 1903 self.log.error("Not GSM phone, abort this gsm MMS test.") 1904 return False 1905 1906 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 1907 (phone_setup_voice_general, (self.log, ads[1]))] 1908 if not multithread_func(self.log, tasks): 1909 self.log.error("Phone Failed to Set Up Properly.") 1910 return False 1911 1912 self.log.info("Begin In Call MMS Test.") 1913 if not call_setup_teardown( 1914 self.log, 1915 ads[0], 1916 ads[1], 1917 ad_hangup=None, 1918 verify_caller_func=is_phone_in_call_2g, 1919 verify_callee_func=None): 1920 return False 1921 1922 if not self._mms_test_mo(ads): 1923 self.log.error("MMS test fail.") 1924 return False 1925 1926 return True 1927 1928 @TelephonyBaseTest.tel_test_wrap 1929 def test_mms_mt_in_call_gsm(self): 1930 """ Test MT MMS during a MO gsm call. 1931 1932 Make sure PhoneA is in gsm mode. 1933 Make sure PhoneB is able to make/receive call. 1934 Call from PhoneA to PhoneB, accept on PhoneB, receive MMS on PhoneA. 1935 1936 Returns: 1937 True if pass; False if fail. 1938 """ 1939 ads = self.android_devices 1940 # Make sure PhoneA is GSM phone before proceed. 1941 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 1942 self.log.error("Not GSM phone, abort this gsm MMS test.") 1943 return False 1944 1945 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 1946 (phone_setup_voice_general, (self.log, ads[1]))] 1947 if not multithread_func(self.log, tasks): 1948 self.log.error("Phone Failed to Set Up Properly.") 1949 return False 1950 1951 self.log.info("Begin In Call MMS Test.") 1952 if not call_setup_teardown( 1953 self.log, 1954 ads[0], 1955 ads[1], 1956 ad_hangup=None, 1957 verify_caller_func=is_phone_in_call_2g, 1958 verify_callee_func=None): 1959 return False 1960 1961 if not self._mms_test_mt(ads): 1962 self.log.error("MMS test fail.") 1963 return False 1964 1965 return True 1966