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 VT live call test 18""" 19 20import time 21from queue import Empty 22from acts import signals 23from acts.test_decorators import test_tracker_info 24from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 25from acts.test_utils.tel.tel_defines import AUDIO_ROUTE_EARPIECE 26from acts.test_utils.tel.tel_defines import AUDIO_ROUTE_SPEAKER 27from acts.test_utils.tel.tel_defines import CALL_STATE_ACTIVE 28from acts.test_utils.tel.tel_defines import CALL_STATE_HOLDING 29from acts.test_utils.tel.tel_defines import CALL_CAPABILITY_MANAGE_CONFERENCE 30from acts.test_utils.tel.tel_defines import CALL_CAPABILITY_MERGE_CONFERENCE 31from acts.test_utils.tel.tel_defines import CALL_CAPABILITY_SWAP_CONFERENCE 32from acts.test_utils.tel.tel_defines import CALL_PROPERTY_CONFERENCE 33from acts.test_utils.tel.tel_defines import CAPABILITY_VT 34from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_VIDEO_SESSION_EVENT 35from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_VOLTE_ENABLED 36from acts.test_utils.tel.tel_defines import VT_STATE_AUDIO_ONLY 37from acts.test_utils.tel.tel_defines import VT_STATE_BIDIRECTIONAL 38from acts.test_utils.tel.tel_defines import VT_STATE_BIDIRECTIONAL_PAUSED 39from acts.test_utils.tel.tel_defines import VT_VIDEO_QUALITY_DEFAULT 40from acts.test_utils.tel.tel_defines import VT_STATE_RX_ENABLED 41from acts.test_utils.tel.tel_defines import VT_STATE_TX_ENABLED 42from acts.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING 43from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL 44from acts.test_utils.tel.tel_defines import EVENT_VIDEO_SESSION_EVENT 45from acts.test_utils.tel.tel_defines import EventTelecomVideoCallSessionEvent 46from acts.test_utils.tel.tel_defines import SESSION_EVENT_RX_PAUSE 47from acts.test_utils.tel.tel_defines import SESSION_EVENT_RX_RESUME 48from acts.test_utils.tel.tel_lookup_tables import operator_capabilities 49from acts.test_utils.tel.tel_test_utils import call_setup_teardown 50from acts.test_utils.tel.tel_test_utils import disconnect_call_by_id 51from acts.test_utils.tel.tel_test_utils import get_model_name 52from acts.test_utils.tel.tel_test_utils import get_operator_name 53from acts.test_utils.tel.tel_test_utils import hangup_call 54from acts.test_utils.tel.tel_test_utils import multithread_func 55from acts.test_utils.tel.tel_test_utils import num_active_calls 56from acts.test_utils.tel.tel_test_utils import verify_internet_connection 57from acts.test_utils.tel.tel_test_utils import verify_incall_state 58from acts.test_utils.tel.tel_test_utils import wait_for_video_enabled 59from acts.test_utils.tel.tel_video_utils import get_call_id_in_video_state 60from acts.test_utils.tel.tel_video_utils import \ 61 is_phone_in_call_video_bidirectional 62from acts.test_utils.tel.tel_video_utils import is_phone_in_call_voice_hd 63from acts.test_utils.tel.tel_video_utils import phone_setup_video 64from acts.test_utils.tel.tel_video_utils import \ 65 verify_video_call_in_expected_state 66from acts.test_utils.tel.tel_video_utils import video_call_downgrade 67from acts.test_utils.tel.tel_video_utils import video_call_modify_video 68from acts.test_utils.tel.tel_video_utils import video_call_setup_teardown 69from acts.test_utils.tel.tel_voice_utils import get_audio_route 70from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_volte 71from acts.test_utils.tel.tel_voice_utils import phone_setup_volte 72from acts.test_utils.tel.tel_voice_utils import set_audio_route 73from acts.test_utils.tel.tel_voice_utils import get_cep_conference_call_id 74 75DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION = 1 * 60 * 60 # default 1 hour 76 77 78class TelLiveVideoTest(TelephonyBaseTest): 79 def __init__(self, controllers): 80 TelephonyBaseTest.__init__(self, controllers) 81 82 self.stress_test_number = self.get_stress_test_number() 83 84 self.long_duration_call_total_duration = self.user_params.get( 85 "long_duration_call_total_duration", 86 DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION) 87 88 def setup_class(self): 89 TelephonyBaseTest.setup_class(self) 90 for ad in self.android_devices: 91 if CAPABILITY_VT not in ad.telephony.get("capabilities", []): 92 ad.log.error("Video calling is not supported") 93 raise signals.TestAbortClass("Video calling is not supported") 94 95 """ Tests Begin """ 96 97 @test_tracker_info(uuid="9f0b7c98-b010-4f9b-bd80-9925fe1cb5f8") 98 @TelephonyBaseTest.tel_test_wrap 99 def test_call_video_to_video(self): 100 """ Test VT<->VT call functionality. 101 102 Make Sure PhoneA is in LTE mode (with Video Calling). 103 Make Sure PhoneB is in LTE mode (with Video Calling). 104 Call from PhoneA to PhoneB as Bi-Directional Video, 105 Accept on PhoneB as video call, hang up on PhoneA. 106 107 Returns: 108 True if pass; False if fail. 109 """ 110 ads = self.android_devices 111 self.number_of_devices = 2 112 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 113 (self.log, ads[1]))] 114 if not multithread_func(self.log, tasks): 115 self.log.error("Phone Failed to Set Up Properly.") 116 return False 117 118 if not video_call_setup_teardown( 119 self.log, 120 ads[0], 121 ads[1], 122 ads[0], 123 video_state=VT_STATE_BIDIRECTIONAL, 124 verify_caller_func=is_phone_in_call_video_bidirectional, 125 verify_callee_func=is_phone_in_call_video_bidirectional): 126 self.log.error("Failed to setup+teardown a call") 127 return False 128 129 return True 130 131 @test_tracker_info(uuid="8abebda7-6646-4180-a37d-2f0acca63b64") 132 @TelephonyBaseTest.tel_test_wrap 133 def test_call_video_to_video_long(self): 134 """ Test VT<->VT call functionality. 135 136 Make Sure PhoneA is in LTE mode (with Video Calling). 137 Make Sure PhoneB is in LTE mode (with Video Calling). 138 Call from PhoneA to PhoneB as Bi-Directional Video, 139 Accept on PhoneB as video call. 140 Keep the VT call ON for 60 mins. 141 Hang up on PhoneA. 142 143 Returns: 144 True if pass; False if fail. 145 """ 146 ads = self.android_devices 147 self.number_of_devices = 2 148 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 149 (self.log, ads[1]))] 150 if not multithread_func(self.log, tasks): 151 self.log.error("Phone Failed to Set Up Properly.") 152 return False 153 154 if not video_call_setup_teardown( 155 self.log, 156 ads[0], 157 ads[1], 158 ads[0], 159 video_state=VT_STATE_BIDIRECTIONAL, 160 verify_caller_func=is_phone_in_call_video_bidirectional, 161 verify_callee_func=is_phone_in_call_video_bidirectional, 162 wait_time_in_call=self.long_duration_call_total_duration): 163 self.log.error("Failed to setup+teardown long call") 164 return False 165 166 return True 167 168 @test_tracker_info(uuid="6eaef46f-dd73-4835-be9d-c9529fc0ad3d") 169 @TelephonyBaseTest.tel_test_wrap 170 def test_call_video_accept_as_voice(self): 171 """ Test VT<->VT call functionality. 172 173 Make Sure PhoneA is in LTE mode (with Video Calling). 174 Make Sure PhoneB is in LTE mode (with Video Calling). 175 Call from PhoneA to PhoneB as Bi-Directional Video, 176 Accept on PhoneB as audio only, hang up on PhoneA. 177 178 Returns: 179 True if pass; False if fail. 180 """ 181 ads = self.android_devices 182 self.number_of_devices = 2 183 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 184 (self.log, ads[1]))] 185 if not multithread_func(self.log, tasks): 186 self.log.error("Phone Failed to Set Up Properly.") 187 return False 188 189 if not video_call_setup_teardown( 190 self.log, 191 ads[0], 192 ads[1], 193 ads[0], 194 video_state=VT_STATE_AUDIO_ONLY, 195 verify_caller_func=is_phone_in_call_voice_hd, 196 verify_callee_func=is_phone_in_call_voice_hd): 197 self.log.error("Failed to setup+teardown a call") 198 return False 199 return True 200 201 @test_tracker_info(uuid="dcd43fd5-4c92-4f09-90f8-04ccce66d396") 202 @TelephonyBaseTest.tel_test_wrap 203 def test_call_video_to_video_mo_disable_camera(self): 204 """ Test VT<->VT call functionality. 205 206 Make Sure PhoneA is in LTE mode (with Video Calling). 207 Make Sure PhoneB is in LTE mode (with Video Calling). 208 Call from PhoneA to PhoneB as Bi-Directional Video, 209 Accept on PhoneB as video call. 210 On PhoneA disabled video transmission. 211 Verify PhoneA as RX_ENABLED and PhoneB as TX_ENABLED. 212 Hangup on PhoneA. 213 214 Returns: 215 True if pass; False if fail. 216 """ 217 ads = self.android_devices 218 self.number_of_devices = 2 219 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 220 (self.log, ads[1]))] 221 if not multithread_func(self.log, tasks): 222 self.log.error("Phone Failed to Set Up Properly.") 223 return False 224 225 if not video_call_setup_teardown( 226 self.log, 227 ads[0], 228 ads[1], 229 None, 230 video_state=VT_STATE_BIDIRECTIONAL, 231 verify_caller_func=is_phone_in_call_video_bidirectional, 232 verify_callee_func=is_phone_in_call_video_bidirectional): 233 self.log.error("Failed to setup a call") 234 return False 235 236 self.log.info("Disable video on PhoneA:{}".format(ads[0].serial)) 237 if not video_call_downgrade( 238 self.log, ads[0], 239 get_call_id_in_video_state(self.log, ads[0], 240 VT_STATE_BIDIRECTIONAL), ads[1], 241 get_call_id_in_video_state(self.log, ads[1], 242 VT_STATE_BIDIRECTIONAL)): 243 self.log.error("Failed to disable video on PhoneA.") 244 return False 245 return hangup_call(self.log, ads[0]) 246 247 @test_tracker_info(uuid="088c0590-ffd0-4337-9576-569f27c4c527") 248 @TelephonyBaseTest.tel_test_wrap 249 def test_call_video_to_video_mt_disable_camera(self): 250 """ Test VT<->VT call functionality. 251 252 Make Sure PhoneA is in LTE mode (with Video Calling). 253 Make Sure PhoneB is in LTE mode (with Video Calling). 254 Call from PhoneA to PhoneB as Bi-Directional Video, 255 Accept on PhoneB as video call. 256 On PhoneB disabled video transmission. 257 Verify PhoneB as RX_ENABLED and PhoneA as TX_ENABLED. 258 Hangup on PhoneA. 259 260 Returns: 261 True if pass; False if fail. 262 """ 263 ads = self.android_devices 264 self.number_of_devices = 2 265 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 266 (self.log, ads[1]))] 267 if not multithread_func(self.log, tasks): 268 self.log.error("Phone Failed to Set Up Properly.") 269 return False 270 271 if not video_call_setup_teardown( 272 self.log, 273 ads[0], 274 ads[1], 275 None, 276 video_state=VT_STATE_BIDIRECTIONAL, 277 verify_caller_func=is_phone_in_call_video_bidirectional, 278 verify_callee_func=is_phone_in_call_video_bidirectional): 279 self.log.error("Failed to setup a call") 280 return False 281 282 self.log.info("Disable video on PhoneB:{}".format(ads[1].serial)) 283 if not video_call_downgrade( 284 self.log, ads[1], 285 get_call_id_in_video_state(self.log, ads[1], 286 VT_STATE_BIDIRECTIONAL), ads[0], 287 get_call_id_in_video_state(self.log, ads[0], 288 VT_STATE_BIDIRECTIONAL)): 289 self.log.error("Failed to disable video on PhoneB.") 290 return False 291 return hangup_call(self.log, ads[0]) 292 293 @test_tracker_info(uuid="879579ac-7106-4c4b-a8d0-64695108f6f7") 294 @TelephonyBaseTest.tel_test_wrap 295 def test_call_video_to_video_mo_mt_disable_camera(self): 296 """ Test VT<->VT call functionality. 297 298 Make Sure PhoneA is in LTE mode (with Video Calling). 299 Make Sure PhoneB is in LTE mode (with Video Calling). 300 Call from PhoneA to PhoneB as Bi-Directional Video, 301 Accept on PhoneB as video call. 302 On PhoneA disabled video transmission. 303 Verify PhoneA as RX_ENABLED and PhoneB as TX_ENABLED. 304 On PhoneB disabled video transmission. 305 Verify PhoneA as AUDIO_ONLY and PhoneB as AUDIO_ONLY. 306 Hangup on PhoneA. 307 308 Returns: 309 True if pass; False if fail. 310 """ 311 ads = self.android_devices 312 self.number_of_devices = 2 313 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 314 (self.log, ads[1]))] 315 if not multithread_func(self.log, tasks): 316 self.log.error("Phone Failed to Set Up Properly.") 317 return False 318 319 if not video_call_setup_teardown( 320 self.log, 321 ads[0], 322 ads[1], 323 None, 324 video_state=VT_STATE_BIDIRECTIONAL, 325 verify_caller_func=is_phone_in_call_video_bidirectional, 326 verify_callee_func=is_phone_in_call_video_bidirectional): 327 self.log.error("Failed to setup a call") 328 return False 329 330 self.log.info("Disable video on PhoneA:{}".format(ads[0].serial)) 331 if not video_call_downgrade( 332 self.log, ads[0], 333 get_call_id_in_video_state(self.log, ads[0], 334 VT_STATE_BIDIRECTIONAL), ads[1], 335 get_call_id_in_video_state(self.log, ads[1], 336 VT_STATE_BIDIRECTIONAL)): 337 self.log.error("Failed to disable video on PhoneA.") 338 return False 339 340 self.log.info("Disable video on PhoneB:{}".format(ads[1].serial)) 341 if not video_call_downgrade( 342 self.log, ads[1], 343 get_call_id_in_video_state(self.log, ads[1], 344 VT_STATE_TX_ENABLED), ads[0], 345 get_call_id_in_video_state(self.log, ads[0], 346 VT_STATE_RX_ENABLED)): 347 self.log.error("Failed to disable video on PhoneB.") 348 return False 349 return hangup_call(self.log, ads[0]) 350 351 @test_tracker_info(uuid="13ff7df6-bf13-4f60-80a1-d9cbeae8e1df") 352 @TelephonyBaseTest.tel_test_wrap 353 def test_call_video_to_video_mt_mo_disable_camera(self): 354 """ Test VT<->VT call functionality. 355 356 Make Sure PhoneA is in LTE mode (with Video Calling). 357 Make Sure PhoneB is in LTE mode (with Video Calling). 358 Call from PhoneA to PhoneB as Bi-Directional Video, 359 Accept on PhoneB as video call. 360 On PhoneB disabled video transmission. 361 Verify PhoneB as RX_ENABLED and PhoneA as TX_ENABLED. 362 On PhoneA disabled video transmission. 363 Verify PhoneA as AUDIO_ONLY and PhoneB as AUDIO_ONLY. 364 Hangup on PhoneA. 365 366 Returns: 367 True if pass; False if fail. 368 """ 369 ads = self.android_devices 370 self.number_of_devices = 2 371 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 372 (self.log, ads[1]))] 373 if not multithread_func(self.log, tasks): 374 self.log.error("Phone Failed to Set Up Properly.") 375 return False 376 377 if not video_call_setup_teardown( 378 self.log, 379 ads[0], 380 ads[1], 381 None, 382 video_state=VT_STATE_BIDIRECTIONAL, 383 verify_caller_func=is_phone_in_call_video_bidirectional, 384 verify_callee_func=is_phone_in_call_video_bidirectional): 385 self.log.error("Failed to setup a call") 386 return False 387 388 self.log.info("Disable video on PhoneB:{}".format(ads[1].serial)) 389 if not video_call_downgrade( 390 self.log, ads[1], 391 get_call_id_in_video_state(self.log, ads[1], 392 VT_STATE_BIDIRECTIONAL), ads[0], 393 get_call_id_in_video_state(self.log, ads[0], 394 VT_STATE_BIDIRECTIONAL)): 395 self.log.error("Failed to disable video on PhoneB.") 396 return False 397 398 self.log.info("Disable video on PhoneA:{}".format(ads[0].serial)) 399 if not video_call_downgrade( 400 self.log, ads[0], 401 get_call_id_in_video_state(self.log, ads[0], 402 VT_STATE_TX_ENABLED), ads[1], 403 get_call_id_in_video_state(self.log, ads[1], 404 VT_STATE_RX_ENABLED)): 405 self.log.error("Failed to disable video on PhoneB.") 406 return False 407 return hangup_call(self.log, ads[0]) 408 409 def _mo_upgrade_bidirectional(self, ads): 410 """Send + accept an upgrade request from Phone A to B. 411 412 Returns: 413 True if pass; False if fail. 414 """ 415 call_id_requester = get_call_id_in_video_state(self.log, ads[0], 416 VT_STATE_AUDIO_ONLY) 417 418 call_id_responder = get_call_id_in_video_state(self.log, ads[1], 419 VT_STATE_AUDIO_ONLY) 420 421 if not call_id_requester or not call_id_responder: 422 self.log.error("Couldn't find a candidate call id {}:{}, {}:{}" 423 .format(ads[0].serial, call_id_requester, ads[1] 424 .serial, call_id_responder)) 425 return False 426 427 if not video_call_modify_video(self.log, ads[0], call_id_requester, 428 ads[1], call_id_responder, 429 VT_STATE_BIDIRECTIONAL): 430 self.log.error("Failed to upgrade video call!") 431 return False 432 433 #Wait for a completed upgrade and ensure the call is stable 434 time.sleep(WAIT_TIME_IN_CALL) 435 436 if not verify_incall_state(self.log, [ads[0], ads[1]], True): 437 self.log.error("_mo_upgrade_bidirectional: Call Drop!") 438 return False 439 440 if (get_call_id_in_video_state(self.log, ads[0], 441 VT_STATE_BIDIRECTIONAL) != 442 call_id_requester): 443 self.log.error("Caller not in correct state: {}".format( 444 VT_STATE_BIDIRECTIONAL)) 445 return False 446 447 if (get_call_id_in_video_state(self.log, ads[1], 448 VT_STATE_BIDIRECTIONAL) != 449 call_id_responder): 450 self.log.error("Callee not in correct state: {}".format( 451 VT_STATE_BIDIRECTIONAL)) 452 return False 453 454 return hangup_call(self.log, ads[0]) 455 456 @test_tracker_info(uuid="e56eea96-467c-49ce-a135-f82f12302369") 457 @TelephonyBaseTest.tel_test_wrap 458 def test_call_video_accept_as_voice_mo_upgrade_bidirectional(self): 459 """ Test Upgrading from VoLTE to Bi-Directional VT. 460 461 Make Sure PhoneA is in LTE mode (with Video Calling). 462 Make Sure PhoneB is in LTE mode (with Video Calling). 463 Call from PhoneA to PhoneB as Video, accept on PhoneB as audio only. 464 Send + accept an upgrade request from Phone A to B. 465 466 Returns: 467 True if pass; False if fail. 468 """ 469 470 ads = self.android_devices 471 self.number_of_devices = 2 472 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 473 (self.log, ads[1]))] 474 if not multithread_func(self.log, tasks): 475 self.log.error("Phone Failed to Set Up Properly.") 476 return False 477 if not video_call_setup_teardown( 478 self.log, 479 ads[0], 480 ads[1], 481 None, 482 video_state=VT_STATE_AUDIO_ONLY, 483 verify_caller_func=is_phone_in_call_volte, 484 verify_callee_func=is_phone_in_call_volte): 485 self.log.error("Failed to setup a call") 486 return False 487 488 return self._mo_upgrade_bidirectional(ads) 489 490 @test_tracker_info(uuid="c1f58f4a-28aa-4cd0-9835-f294cdcff854") 491 @TelephonyBaseTest.tel_test_wrap 492 def test_call_volte_to_volte_mo_upgrade_bidirectional(self): 493 """ Test Upgrading from VoLTE to Bi-Directional VT. 494 495 Make Sure PhoneA is in LTE mode (with Video Calling). 496 Make Sure PhoneB is in LTE mode (with Video Calling). 497 Call from PhoneA to PhoneB as VoLTE, accept on PhoneB. 498 Send + accept an upgrade request from Phone A to B. 499 500 Returns: 501 True if pass; False if fail. 502 """ 503 504 ads = self.android_devices 505 self.number_of_devices = 2 506 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 507 (self.log, ads[1]))] 508 if not multithread_func(self.log, tasks): 509 self.log.error("Phone Failed to Set Up Properly.") 510 return False 511 if not call_setup_teardown(self.log, ads[0], ads[1], None, 512 is_phone_in_call_volte, 513 is_phone_in_call_volte): 514 self.log.error("Failed to setup a call") 515 return False 516 517 return self._mo_upgrade_bidirectional(ads) 518 519 def _mo_upgrade_reject(self, ads): 520 """Send + reject an upgrade request from Phone A to B. 521 522 Returns: 523 True if pass; False if fail. 524 """ 525 call_id_requester = get_call_id_in_video_state(self.log, ads[0], 526 VT_STATE_AUDIO_ONLY) 527 528 call_id_responder = get_call_id_in_video_state(self.log, ads[1], 529 VT_STATE_AUDIO_ONLY) 530 531 if not call_id_requester or not call_id_responder: 532 self.log.error("Couldn't find a candidate call id {}:{}, {}:{}" 533 .format(ads[0].serial, call_id_requester, ads[1] 534 .serial, call_id_responder)) 535 return False 536 537 if not video_call_modify_video( 538 self.log, ads[0], call_id_requester, ads[1], call_id_responder, 539 VT_STATE_BIDIRECTIONAL, VT_VIDEO_QUALITY_DEFAULT, 540 VT_STATE_AUDIO_ONLY, VT_VIDEO_QUALITY_DEFAULT): 541 self.log.error("Failed to upgrade video call!") 542 return False 543 544 time.sleep(WAIT_TIME_IN_CALL) 545 546 if not is_phone_in_call_voice_hd(self.log, ads[0]): 547 self.log.error("PhoneA not in correct state.") 548 return False 549 if not is_phone_in_call_voice_hd(self.log, ads[1]): 550 self.log.error("PhoneB not in correct state.") 551 return False 552 553 return hangup_call(self.log, ads[0]) 554 555 @test_tracker_info(uuid="427b0906-f082-4f6d-9d94-4f9c4d5005a5") 556 @TelephonyBaseTest.tel_test_wrap 557 def test_call_volte_to_volte_mo_upgrade_reject(self): 558 """ Test Upgrading from VoLTE to Bi-Directional VT and reject. 559 560 Make Sure PhoneA is in LTE mode (with Video Calling). 561 Make Sure PhoneB is in LTE mode (with Video Calling). 562 Call from PhoneA to PhoneB as VoLTE, accept on PhoneB. 563 Send an upgrade request from Phone A to PhoneB. 564 Reject on PhoneB. Verify PhoneA and PhoneB ad AUDIO_ONLY. 565 Verify call continues. 566 Hangup on PhoneA. 567 568 Returns: 569 True if pass; False if fail. 570 """ 571 ads = self.android_devices 572 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 573 (self.log, ads[1]))] 574 if not multithread_func(self.log, tasks): 575 self.log.error("Phone Failed to Set Up Properly.") 576 return False 577 if not call_setup_teardown(self.log, ads[0], ads[1], None, 578 is_phone_in_call_volte, 579 is_phone_in_call_volte): 580 self.log.error("Failed to setup a call") 581 return False 582 583 return self._mo_upgrade_reject(ads) 584 585 @test_tracker_info(uuid="f733f694-c0c2-4da0-b3c2-ff21df026426") 586 @TelephonyBaseTest.tel_test_wrap 587 def test_call_video_accept_as_voice_mo_upgrade_reject(self): 588 """ Test Upgrading from VoLTE to Bi-Directional VT and reject. 589 590 Make Sure PhoneA is in LTE mode (with Video Calling). 591 Make Sure PhoneB is in LTE mode (with Video Calling). 592 Call from PhoneA to PhoneB as Video, accept on PhoneB as audio only. 593 Send an upgrade request from Phone A to PhoneB. 594 Reject on PhoneB. Verify PhoneA and PhoneB ad AUDIO_ONLY. 595 Verify call continues. 596 Hangup on PhoneA. 597 598 Returns: 599 True if pass; False if fail. 600 """ 601 ads = self.android_devices 602 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 603 (self.log, ads[1]))] 604 if not multithread_func(self.log, tasks): 605 self.log.error("Phone Failed to Set Up Properly.") 606 return False 607 if not video_call_setup_teardown( 608 self.log, 609 ads[0], 610 ads[1], 611 None, 612 video_state=VT_STATE_AUDIO_ONLY, 613 verify_caller_func=is_phone_in_call_volte, 614 verify_callee_func=is_phone_in_call_volte): 615 self.log.error("Failed to setup a call") 616 return False 617 618 return self._mo_upgrade_reject(ads) 619 620 def _test_put_call_to_backgroundpause_and_foregroundresume( 621 self, ad_requester, ad_responder): 622 call_id_requester = get_call_id_in_video_state(self.log, ad_requester, 623 VT_STATE_BIDIRECTIONAL) 624 call_id_responder = get_call_id_in_video_state(self.log, ad_responder, 625 VT_STATE_BIDIRECTIONAL) 626 ad_requester.droid.telecomCallVideoStartListeningForEvent( 627 call_id_requester, EVENT_VIDEO_SESSION_EVENT) 628 ad_responder.droid.telecomCallVideoStartListeningForEvent( 629 call_id_responder, EVENT_VIDEO_SESSION_EVENT) 630 self.log.info("Put In-Call UI on {} to background.".format( 631 ad_requester.serial)) 632 ad_requester.droid.showHomeScreen() 633 try: 634 event_on_responder = ad_responder.ed.pop_event( 635 EventTelecomVideoCallSessionEvent, 636 MAX_WAIT_TIME_VIDEO_SESSION_EVENT) 637 event_on_requester = ad_requester.ed.pop_event( 638 EventTelecomVideoCallSessionEvent, 639 MAX_WAIT_TIME_VIDEO_SESSION_EVENT) 640 if event_on_responder['data']['Event'] != SESSION_EVENT_RX_PAUSE: 641 self.log.error( 642 "Event not correct. event_on_responder: {}. Expected :{}". 643 format(event_on_responder, SESSION_EVENT_RX_PAUSE)) 644 return False 645 if event_on_requester['data']['Event'] != SESSION_EVENT_RX_PAUSE: 646 self.log.error( 647 "Event not correct. event_on_requester: {}. Expected :{}". 648 format(event_on_requester, SESSION_EVENT_RX_PAUSE)) 649 return False 650 except Empty: 651 self.log.error("Expected event not received.") 652 return False 653 finally: 654 ad_requester.droid.telecomCallVideoStopListeningForEvent( 655 call_id_requester, EVENT_VIDEO_SESSION_EVENT) 656 ad_responder.droid.telecomCallVideoStopListeningForEvent( 657 call_id_responder, EVENT_VIDEO_SESSION_EVENT) 658 time.sleep(WAIT_TIME_IN_CALL) 659 660 if not verify_video_call_in_expected_state( 661 self.log, ad_requester, call_id_requester, 662 VT_STATE_BIDIRECTIONAL_PAUSED, CALL_STATE_ACTIVE): 663 return False 664 if not verify_video_call_in_expected_state( 665 self.log, ad_responder, call_id_responder, 666 VT_STATE_BIDIRECTIONAL_PAUSED, CALL_STATE_ACTIVE): 667 return False 668 669 self.log.info("Put In-Call UI on {} to foreground.".format( 670 ad_requester.serial)) 671 ad_requester.droid.telecomCallVideoStartListeningForEvent( 672 call_id_requester, EVENT_VIDEO_SESSION_EVENT) 673 ad_responder.droid.telecomCallVideoStartListeningForEvent( 674 call_id_responder, EVENT_VIDEO_SESSION_EVENT) 675 ad_requester.droid.telecomShowInCallScreen() 676 try: 677 event_on_responder = ad_responder.ed.pop_event( 678 EventTelecomVideoCallSessionEvent, 679 MAX_WAIT_TIME_VIDEO_SESSION_EVENT) 680 event_on_requester = ad_requester.ed.pop_event( 681 EventTelecomVideoCallSessionEvent, 682 MAX_WAIT_TIME_VIDEO_SESSION_EVENT) 683 if event_on_responder['data']['Event'] != SESSION_EVENT_RX_RESUME: 684 self.log.error( 685 "Event not correct. event_on_responder: {}. Expected :{}". 686 format(event_on_responder, SESSION_EVENT_RX_RESUME)) 687 return False 688 if event_on_requester['data']['Event'] != SESSION_EVENT_RX_RESUME: 689 self.log.error( 690 "Event not correct. event_on_requester: {}. Expected :{}". 691 format(event_on_requester, SESSION_EVENT_RX_RESUME)) 692 return False 693 except Empty: 694 self.log.error("Expected event not received.") 695 return False 696 finally: 697 ad_requester.droid.telecomCallVideoStopListeningForEvent( 698 call_id_requester, EVENT_VIDEO_SESSION_EVENT) 699 ad_responder.droid.telecomCallVideoStopListeningForEvent( 700 call_id_responder, EVENT_VIDEO_SESSION_EVENT) 701 time.sleep(WAIT_TIME_IN_CALL) 702 self.log.info("Verify both calls are in bi-directional/active state.") 703 if not verify_video_call_in_expected_state( 704 self.log, ad_requester, call_id_requester, 705 VT_STATE_BIDIRECTIONAL, CALL_STATE_ACTIVE): 706 return False 707 if not verify_video_call_in_expected_state( 708 self.log, ad_responder, call_id_responder, 709 VT_STATE_BIDIRECTIONAL, CALL_STATE_ACTIVE): 710 return False 711 712 return True 713 714 @test_tracker_info(uuid="f78b40a4-3be7-46f2-882f-0333f733e334") 715 @TelephonyBaseTest.tel_test_wrap 716 def test_call_video_to_video_mo_to_backgroundpause_foregroundresume(self): 717 ads = self.android_devices 718 self.number_of_devices = 2 719 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 720 (self.log, ads[1]))] 721 if not multithread_func(self.log, tasks): 722 self.log.error("Phone Failed to Set Up Properly.") 723 return False 724 725 if not video_call_setup_teardown( 726 self.log, 727 ads[0], 728 ads[1], 729 None, 730 video_state=VT_STATE_BIDIRECTIONAL, 731 verify_caller_func=is_phone_in_call_video_bidirectional, 732 verify_callee_func=is_phone_in_call_video_bidirectional): 733 self.log.error("Failed to setup a call") 734 return False 735 736 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 737 738 return self._test_put_call_to_backgroundpause_and_foregroundresume( 739 ads[0], ads[1]) 740 741 @test_tracker_info(uuid="9aafdf6a-6535-4137-a801-4fbb67fdb281") 742 @TelephonyBaseTest.tel_test_wrap 743 def test_call_video_to_video_mt_to_backgroundpause_foregroundresume(self): 744 ads = self.android_devices 745 self.number_of_devices = 2 746 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 747 (self.log, ads[1]))] 748 if not multithread_func(self.log, tasks): 749 self.log.error("Phone Failed to Set Up Properly.") 750 return False 751 752 if not video_call_setup_teardown( 753 self.log, 754 ads[0], 755 ads[1], 756 None, 757 video_state=VT_STATE_BIDIRECTIONAL, 758 verify_caller_func=is_phone_in_call_video_bidirectional, 759 verify_callee_func=is_phone_in_call_video_bidirectional): 760 self.log.error("Failed to setup a call") 761 return False 762 763 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 764 765 return self._test_put_call_to_backgroundpause_and_foregroundresume( 766 ads[1], ads[0]) 767 768 def _vt_test_multi_call_hangup(self, ads): 769 """private function to hangup calls for VT tests. 770 771 Hangup on PhoneB. 772 Verify PhoneA and PhoneC still in call. 773 Hangup on PhoneC. 774 Verify all phones not in call. 775 """ 776 self.number_of_devices = 3 777 if not hangup_call(self.log, ads[1]): 778 return False 779 time.sleep(WAIT_TIME_IN_CALL) 780 if not verify_incall_state(self.log, [ads[0], ads[2]], True): 781 return False 782 if not hangup_call(self.log, ads[2]): 783 return False 784 time.sleep(WAIT_TIME_IN_CALL) 785 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False): 786 return False 787 return True 788 789 @test_tracker_info(uuid="cde91e7d-dbc5-40f5-937d-36840c77667e") 790 @TelephonyBaseTest.tel_test_wrap 791 def test_call_video_add_mo_voice(self): 792 """ 793 From Phone_A, Initiate a Bi-Directional Video Call to Phone_B 794 Accept the call on Phone_B as Bi-Directional Video 795 From Phone_A, add a voice call to Phone_C 796 Accept the call on Phone_C 797 Verify both calls remain active. 798 """ 799 self.number_of_devices = 3 800 # This test case is not supported by VZW. 801 ads = self.android_devices 802 tasks = [(phone_setup_video, (self.log, ads[0])), 803 (phone_setup_video, (self.log, ads[1])), (phone_setup_volte, 804 (self.log, ads[2]))] 805 if not multithread_func(self.log, tasks): 806 self.log.error("Phone Failed to Set Up Properly.") 807 return False 808 809 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 810 if not video_call_setup_teardown( 811 self.log, 812 ads[0], 813 ads[1], 814 None, 815 video_state=VT_STATE_BIDIRECTIONAL, 816 verify_caller_func=is_phone_in_call_video_bidirectional, 817 verify_callee_func=is_phone_in_call_video_bidirectional): 818 self.log.error("Failed to setup a call") 819 return False 820 call_id_video = get_call_id_in_video_state(self.log, ads[0], 821 VT_STATE_BIDIRECTIONAL) 822 if call_id_video is None: 823 self.log.error("No active video call in PhoneA.") 824 return False 825 826 self.log.info("Step2: Initiate Voice Call PhoneA->PhoneC.") 827 if not call_setup_teardown( 828 self.log, 829 ads[0], 830 ads[2], 831 None, 832 verify_caller_func=None, 833 verify_callee_func=is_phone_in_call_volte): 834 self.log.error("Failed to setup a call") 835 return False 836 837 self.log.info( 838 "Step3: Verify PhoneA's video/voice call in correct state.") 839 calls = ads[0].droid.telecomCallGetCallIds() 840 self.log.info("Calls in PhoneA{}".format(calls)) 841 if num_active_calls(self.log, ads[0]) != 2: 842 self.log.error("Active call numbers in PhoneA is not 2.") 843 return False 844 for call in calls: 845 if call != call_id_video: 846 call_id_voice = call 847 848 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 849 return False 850 if not verify_video_call_in_expected_state( 851 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL, 852 CALL_STATE_HOLDING): 853 return False 854 if not verify_video_call_in_expected_state( 855 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 856 CALL_STATE_ACTIVE): 857 return False 858 859 return self._vt_test_multi_call_hangup(ads) 860 861 @test_tracker_info(uuid="60511b22-7004-4539-9164-1331220e4d18") 862 @TelephonyBaseTest.tel_test_wrap 863 def test_call_video_add_mt_voice(self): 864 """ 865 From Phone_A, Initiate a Bi-Directional Video Call to Phone_B 866 Accept the call on Phone_B as Bi-Directional Video 867 From Phone_C, add a voice call to Phone_A 868 Accept the call on Phone_A 869 Verify both calls remain active. 870 """ 871 self.number_of_devices = 3 872 ads = self.android_devices 873 tasks = [(phone_setup_video, (self.log, ads[0])), 874 (phone_setup_video, (self.log, ads[1])), (phone_setup_volte, 875 (self.log, ads[2]))] 876 if not multithread_func(self.log, tasks): 877 self.log.error("Phone Failed to Set Up Properly.") 878 return False 879 880 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 881 if not video_call_setup_teardown( 882 self.log, 883 ads[0], 884 ads[1], 885 None, 886 video_state=VT_STATE_BIDIRECTIONAL, 887 verify_caller_func=is_phone_in_call_video_bidirectional, 888 verify_callee_func=is_phone_in_call_video_bidirectional): 889 self.log.error("Failed to setup a call") 890 return False 891 call_id_video = get_call_id_in_video_state(self.log, ads[0], 892 VT_STATE_BIDIRECTIONAL) 893 if call_id_video is None: 894 self.log.error("No active video call in PhoneA.") 895 return False 896 897 self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.") 898 if not call_setup_teardown( 899 self.log, 900 ads[2], 901 ads[0], 902 None, 903 verify_caller_func=is_phone_in_call_volte, 904 verify_callee_func=None): 905 self.log.error("Failed to setup a call") 906 return False 907 908 self.log.info( 909 "Step3: Verify PhoneA's video/voice call in correct state.") 910 calls = ads[0].droid.telecomCallGetCallIds() 911 self.log.info("Calls in PhoneA{}".format(calls)) 912 if num_active_calls(self.log, ads[0]) != 2: 913 self.log.error("Active call numbers in PhoneA is not 2.") 914 return False 915 for call in calls: 916 if call != call_id_video: 917 call_id_voice = call 918 919 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 920 return False 921 if not verify_video_call_in_expected_state( 922 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL_PAUSED, 923 CALL_STATE_HOLDING): 924 return False 925 926 if not verify_video_call_in_expected_state( 927 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 928 CALL_STATE_ACTIVE): 929 return False 930 931 return self._vt_test_multi_call_hangup(ads) 932 933 @test_tracker_info(uuid="782847f4-8eab-42db-a036-ebf8de28eb23") 934 @TelephonyBaseTest.tel_test_wrap 935 def test_call_volte_add_mo_video(self): 936 """ 937 From Phone_A, Initiate a VoLTE Call to Phone_B 938 Accept the call on Phone_B 939 From Phone_A, add a Video call to Phone_C 940 Accept the call on Phone_C as Video 941 Verify both calls remain active. 942 """ 943 # This test case is not supported by VZW. 944 ads = self.android_devices 945 self.number_of_devices = 3 946 tasks = [(phone_setup_video, (self.log, ads[0])), 947 (phone_setup_volte, (self.log, ads[1])), (phone_setup_video, 948 (self.log, ads[2]))] 949 if not multithread_func(self.log, tasks): 950 self.log.error("Phone Failed to Set Up Properly.") 951 return False 952 953 self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.") 954 if not call_setup_teardown( 955 self.log, 956 ads[0], 957 ads[1], 958 None, 959 verify_caller_func=is_phone_in_call_volte, 960 verify_callee_func=is_phone_in_call_volte): 961 self.log.error("Failed to setup a call") 962 return False 963 calls = ads[0].droid.telecomCallGetCallIds() 964 self.log.info("Calls in PhoneA{}".format(calls)) 965 if num_active_calls(self.log, ads[0]) != 1: 966 self.log.error("Active call numbers in PhoneA is not 1.") 967 return False 968 call_id_voice = calls[0] 969 970 self.log.info("Step2: Initiate Video Call PhoneA->PhoneC.") 971 if not video_call_setup_teardown( 972 self.log, 973 ads[0], 974 ads[2], 975 None, 976 video_state=VT_STATE_BIDIRECTIONAL, 977 verify_caller_func=is_phone_in_call_video_bidirectional, 978 verify_callee_func=is_phone_in_call_video_bidirectional): 979 self.log.error("Failed to setup a call") 980 return False 981 call_id_video = get_call_id_in_video_state(self.log, ads[0], 982 VT_STATE_BIDIRECTIONAL) 983 if call_id_video is None: 984 self.log.error("No active video call in PhoneA.") 985 return False 986 987 self.log.info( 988 "Step3: Verify PhoneA's video/voice call in correct state.") 989 calls = ads[0].droid.telecomCallGetCallIds() 990 self.log.info("Calls in PhoneA{}".format(calls)) 991 if num_active_calls(self.log, ads[0]) != 2: 992 self.log.error("Active call numbers in PhoneA is not 2.") 993 return False 994 995 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 996 return False 997 if not verify_video_call_in_expected_state( 998 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL, 999 CALL_STATE_ACTIVE): 1000 return False 1001 if not verify_video_call_in_expected_state( 1002 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 1003 CALL_STATE_HOLDING): 1004 return False 1005 1006 return self._vt_test_multi_call_hangup(ads) 1007 1008 @test_tracker_info(uuid="bc3ac5b0-4bf7-4068-9bd0-2f8301c2ad05") 1009 @TelephonyBaseTest.tel_test_wrap 1010 def test_call_volte_add_mt_video(self): 1011 """ 1012 From Phone_A, Initiate a VoLTE Call to Phone_B 1013 Accept the call on Phone_B 1014 From Phone_C, add a Video call to Phone_A 1015 Accept the call on Phone_A as Video 1016 Verify both calls remain active. 1017 """ 1018 # TODO (b/21437650): 1019 # Test will fail. After established 2nd call ~15s, Phone C will drop call. 1020 ads = self.android_devices 1021 self.number_of_devices = 3 1022 tasks = [(phone_setup_video, (self.log, ads[0])), 1023 (phone_setup_volte, (self.log, ads[1])), (phone_setup_video, 1024 (self.log, ads[2]))] 1025 if not multithread_func(self.log, tasks): 1026 self.log.error("Phone Failed to Set Up Properly.") 1027 return False 1028 1029 self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.") 1030 if not call_setup_teardown( 1031 self.log, 1032 ads[0], 1033 ads[1], 1034 None, 1035 verify_caller_func=is_phone_in_call_volte, 1036 verify_callee_func=is_phone_in_call_volte): 1037 self.log.error("Failed to setup a call") 1038 return False 1039 calls = ads[0].droid.telecomCallGetCallIds() 1040 self.log.info("Calls in PhoneA{}".format(calls)) 1041 if num_active_calls(self.log, ads[0]) != 1: 1042 self.log.error("Active call numbers in PhoneA is not 1.") 1043 return False 1044 call_id_voice = calls[0] 1045 1046 self.log.info("Step2: Initiate Video Call PhoneC->PhoneA.") 1047 if not video_call_setup_teardown( 1048 self.log, 1049 ads[2], 1050 ads[0], 1051 None, 1052 video_state=VT_STATE_BIDIRECTIONAL, 1053 verify_caller_func=is_phone_in_call_video_bidirectional, 1054 verify_callee_func=is_phone_in_call_video_bidirectional): 1055 self.log.error("Failed to setup a call") 1056 return False 1057 1058 call_id_video = get_call_id_in_video_state(self.log, ads[0], 1059 VT_STATE_BIDIRECTIONAL) 1060 if call_id_video is None: 1061 self.log.error("No active video call in PhoneA.") 1062 return False 1063 1064 self.log.info( 1065 "Step3: Verify PhoneA's video/voice call in correct state.") 1066 calls = ads[0].droid.telecomCallGetCallIds() 1067 self.log.info("Calls in PhoneA{}".format(calls)) 1068 if num_active_calls(self.log, ads[0]) != 2: 1069 self.log.error("Active call numbers in PhoneA is not 2.") 1070 return False 1071 1072 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1073 return False 1074 if not verify_video_call_in_expected_state( 1075 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL, 1076 CALL_STATE_ACTIVE): 1077 return False 1078 if not verify_video_call_in_expected_state( 1079 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 1080 CALL_STATE_HOLDING): 1081 return False 1082 1083 return self._vt_test_multi_call_hangup(ads) 1084 1085 @test_tracker_info(uuid="97c7f5c3-c994-477b-839e-cea1d450d4e7") 1086 @TelephonyBaseTest.tel_test_wrap 1087 def test_call_video_add_mt_voice_swap_once_local_drop(self): 1088 """ 1089 From Phone_A, Initiate a Bi-Directional Video Call to Phone_B 1090 Accept the call on Phone_B as Bi-Directional Video 1091 From Phone_C, add a voice call to Phone_A 1092 Accept the call on Phone_A 1093 Verify both calls remain active. 1094 Swap calls on PhoneA. 1095 End Video call on PhoneA. 1096 End Voice call on PhoneA. 1097 """ 1098 ads = self.android_devices 1099 self.number_of_devices = 3 1100 tasks = [(phone_setup_video, (self.log, ads[0])), 1101 (phone_setup_video, (self.log, ads[1])), (phone_setup_volte, 1102 (self.log, ads[2]))] 1103 if not multithread_func(self.log, tasks): 1104 self.log.error("Phone Failed to Set Up Properly.") 1105 return False 1106 1107 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 1108 if not video_call_setup_teardown( 1109 self.log, 1110 ads[0], 1111 ads[1], 1112 None, 1113 video_state=VT_STATE_BIDIRECTIONAL, 1114 verify_caller_func=is_phone_in_call_video_bidirectional, 1115 verify_callee_func=is_phone_in_call_video_bidirectional): 1116 self.log.error("Failed to setup a call") 1117 return False 1118 call_id_video = get_call_id_in_video_state(self.log, ads[0], 1119 VT_STATE_BIDIRECTIONAL) 1120 if call_id_video is None: 1121 self.log.error("No active video call in PhoneA.") 1122 return False 1123 1124 self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.") 1125 if not call_setup_teardown( 1126 self.log, 1127 ads[2], 1128 ads[0], 1129 None, 1130 verify_caller_func=is_phone_in_call_volte, 1131 verify_callee_func=None): 1132 self.log.error("Failed to setup a call") 1133 return False 1134 1135 self.log.info( 1136 "Step3: Verify PhoneA's video/voice call in correct state.") 1137 calls = ads[0].droid.telecomCallGetCallIds() 1138 self.log.info("Calls in PhoneA{}".format(calls)) 1139 if num_active_calls(self.log, ads[0]) != 2: 1140 self.log.error("Active call numbers in PhoneA is not 2.") 1141 return False 1142 for call in calls: 1143 if call != call_id_video: 1144 call_id_voice = call 1145 1146 if not verify_video_call_in_expected_state( 1147 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL_PAUSED, 1148 CALL_STATE_HOLDING): 1149 return False 1150 1151 if not verify_video_call_in_expected_state( 1152 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 1153 CALL_STATE_ACTIVE): 1154 return False 1155 self.log.info("Step4: Verify all phones remain in-call.") 1156 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1157 return False 1158 1159 self.log.info( 1160 "Step5: Swap calls on PhoneA and verify call state correct.") 1161 ads[0].droid.telecomCallHold(call_id_voice) 1162 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 1163 for ad in [ads[0], ads[1]]: 1164 if get_audio_route(self.log, ad) != AUDIO_ROUTE_SPEAKER: 1165 self.log.error("{} Audio is not on speaker.".format(ad.serial)) 1166 # TODO: b/26337892 Define expected audio route behavior. 1167 1168 set_audio_route(self.log, ad, AUDIO_ROUTE_EARPIECE) 1169 1170 time.sleep(WAIT_TIME_IN_CALL) 1171 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1172 return False 1173 if not verify_video_call_in_expected_state( 1174 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL, 1175 CALL_STATE_ACTIVE): 1176 return False 1177 if not verify_video_call_in_expected_state( 1178 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 1179 CALL_STATE_HOLDING): 1180 return False 1181 1182 self.log.info("Step6: Drop Video Call on PhoneA.") 1183 disconnect_call_by_id(self.log, ads[0], call_id_video) 1184 time.sleep(WAIT_TIME_IN_CALL) 1185 if not verify_incall_state(self.log, [ads[0], ads[2]], True): 1186 return False 1187 disconnect_call_by_id(self.log, ads[0], call_id_voice) 1188 time.sleep(WAIT_TIME_IN_CALL) 1189 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False): 1190 return False 1191 return True 1192 1193 @test_tracker_info(uuid="6b2c8701-eb65-47cd-a190-a074bc60ebfa") 1194 @TelephonyBaseTest.tel_test_wrap 1195 def test_call_video_add_mt_voice_swap_twice_remote_drop_voice_unhold_video( 1196 self): 1197 """ 1198 From Phone_A, Initiate a Bi-Directional Video Call to Phone_B 1199 Accept the call on Phone_B as Bi-Directional Video 1200 From Phone_C, add a voice call to Phone_A 1201 Accept the call on Phone_A 1202 Verify both calls remain active. 1203 Swap calls on PhoneA. 1204 Swap calls on PhoneA. 1205 End Voice call on PhoneC. 1206 Unhold Video call on PhoneA. 1207 End Video call on PhoneA. 1208 """ 1209 1210 ads = self.android_devices 1211 self.number_of_devices = 3 1212 tasks = [(phone_setup_video, (self.log, ads[0])), 1213 (phone_setup_video, (self.log, ads[1])), (phone_setup_volte, 1214 (self.log, ads[2]))] 1215 if not multithread_func(self.log, tasks): 1216 self.log.error("Phone Failed to Set Up Properly.") 1217 return False 1218 1219 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 1220 if not video_call_setup_teardown( 1221 self.log, 1222 ads[0], 1223 ads[1], 1224 None, 1225 video_state=VT_STATE_BIDIRECTIONAL, 1226 verify_caller_func=is_phone_in_call_video_bidirectional, 1227 verify_callee_func=is_phone_in_call_video_bidirectional): 1228 self.log.error("Failed to setup a call") 1229 return False 1230 call_id_video = get_call_id_in_video_state(self.log, ads[0], 1231 VT_STATE_BIDIRECTIONAL) 1232 if call_id_video is None: 1233 self.log.error("No active video call in PhoneA.") 1234 return False 1235 1236 self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.") 1237 if not call_setup_teardown( 1238 self.log, 1239 ads[2], 1240 ads[0], 1241 None, 1242 verify_caller_func=is_phone_in_call_volte, 1243 verify_callee_func=None): 1244 self.log.error("Failed to setup a call") 1245 return False 1246 1247 self.log.info( 1248 "Step3: Verify PhoneA's video/voice call in correct state.") 1249 calls = ads[0].droid.telecomCallGetCallIds() 1250 self.log.info("Calls in PhoneA{}".format(calls)) 1251 if num_active_calls(self.log, ads[0]) != 2: 1252 self.log.error("Active call numbers in PhoneA is not 2.") 1253 return False 1254 for call in calls: 1255 if call != call_id_video: 1256 call_id_voice = call 1257 1258 if not verify_video_call_in_expected_state( 1259 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL_PAUSED, 1260 CALL_STATE_HOLDING): 1261 return False 1262 1263 if not verify_video_call_in_expected_state( 1264 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 1265 CALL_STATE_ACTIVE): 1266 return False 1267 self.log.info("Step4: Verify all phones remain in-call.") 1268 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1269 return False 1270 1271 self.log.info( 1272 "Step5: Swap calls on PhoneA and verify call state correct.") 1273 ads[0].droid.telecomCallHold(call_id_voice) 1274 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 1275 for ad in [ads[0], ads[1]]: 1276 if get_audio_route(self.log, ad) != AUDIO_ROUTE_EARPIECE: 1277 self.log.error("{} Audio is not on earpiece.".format( 1278 ad.serial)) 1279 # TODO: b/26337892 Define expected audio route behavior. 1280 1281 time.sleep(WAIT_TIME_IN_CALL) 1282 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1283 return False 1284 if not verify_video_call_in_expected_state( 1285 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL, 1286 CALL_STATE_ACTIVE): 1287 return False 1288 if not verify_video_call_in_expected_state( 1289 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 1290 CALL_STATE_HOLDING): 1291 return False 1292 1293 self.log.info( 1294 "Step6: Swap calls on PhoneA and verify call state correct.") 1295 ads[0].droid.telecomCallHold(call_id_video) 1296 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 1297 # Audio will goto earpiece in here 1298 for ad in [ads[0], ads[1]]: 1299 if get_audio_route(self.log, ad) != AUDIO_ROUTE_EARPIECE: 1300 self.log.error("{} Audio is not on EARPIECE.".format( 1301 ad.serial)) 1302 # TODO: b/26337892 Define expected audio route behavior. 1303 1304 time.sleep(WAIT_TIME_IN_CALL) 1305 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1306 return False 1307 if not verify_video_call_in_expected_state( 1308 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL, 1309 CALL_STATE_HOLDING): 1310 return False 1311 if not verify_video_call_in_expected_state( 1312 self.log, ads[0], call_id_voice, VT_STATE_AUDIO_ONLY, 1313 CALL_STATE_ACTIVE): 1314 return False 1315 1316 self.log.info("Step7: Drop Voice Call on PhoneC.") 1317 hangup_call(self.log, ads[2]) 1318 time.sleep(WAIT_TIME_IN_CALL) 1319 if not verify_incall_state(self.log, [ads[0], ads[1]], True): 1320 return False 1321 1322 self.log.info( 1323 "Step8: Unhold Video call on PhoneA and verify call state.") 1324 ads[0].droid.telecomCallUnhold(call_id_video) 1325 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 1326 # Audio will goto earpiece in here 1327 for ad in [ads[0], ads[1]]: 1328 if get_audio_route(self.log, ad) != AUDIO_ROUTE_EARPIECE: 1329 self.log.error("{} Audio is not on EARPIECE.".format( 1330 ad.serial)) 1331 # TODO: b/26337892 Define expected audio route behavior. 1332 1333 time.sleep(WAIT_TIME_IN_CALL) 1334 if not verify_video_call_in_expected_state( 1335 self.log, ads[0], call_id_video, VT_STATE_BIDIRECTIONAL, 1336 CALL_STATE_ACTIVE): 1337 return False 1338 1339 self.log.info("Step9: Drop Video Call on PhoneA.") 1340 disconnect_call_by_id(self.log, ads[0], call_id_video) 1341 time.sleep(WAIT_TIME_IN_CALL) 1342 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False): 1343 return False 1344 return True 1345 1346 @test_tracker_info(uuid="9d897505-efed-4b04-b5c8-3f9ba9d26861") 1347 @TelephonyBaseTest.tel_test_wrap 1348 def test_call_video_add_mo_video(self): 1349 """ 1350 From Phone_A, Initiate a Bi-Directional Video Call to Phone_B 1351 Accept the call on Phone_B as Bi-Directional Video 1352 From Phone_A, add a Bi-Directional Video Call to Phone_C 1353 Accept the call on Phone_C 1354 Verify both calls remain active. 1355 """ 1356 # This test case is not supported by VZW. 1357 ads = self.android_devices 1358 self.number_of_devices = 3 1359 tasks = [(phone_setup_video, (self.log, ads[0])), 1360 (phone_setup_video, (self.log, ads[1])), (phone_setup_video, 1361 (self.log, ads[2]))] 1362 if not multithread_func(self.log, tasks): 1363 self.log.error("Phone Failed to Set Up Properly.") 1364 return False 1365 1366 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 1367 if not video_call_setup_teardown( 1368 self.log, 1369 ads[0], 1370 ads[1], 1371 None, 1372 video_state=VT_STATE_BIDIRECTIONAL, 1373 verify_caller_func=is_phone_in_call_video_bidirectional, 1374 verify_callee_func=is_phone_in_call_video_bidirectional): 1375 self.log.error("Failed to setup a call") 1376 return False 1377 call_id_video_ab = get_call_id_in_video_state(self.log, ads[0], 1378 VT_STATE_BIDIRECTIONAL) 1379 if call_id_video_ab is None: 1380 self.log.error("No active video call in PhoneA.") 1381 return False 1382 1383 self.log.info("Step2: Initiate Video Call PhoneA->PhoneC.") 1384 if not video_call_setup_teardown( 1385 self.log, 1386 ads[0], 1387 ads[2], 1388 None, 1389 video_state=VT_STATE_BIDIRECTIONAL, 1390 verify_caller_func=is_phone_in_call_video_bidirectional, 1391 verify_callee_func=is_phone_in_call_video_bidirectional): 1392 self.log.error("Failed to setup a call") 1393 return False 1394 1395 self.log.info("Step3: Verify PhoneA's video calls in correct state.") 1396 calls = ads[0].droid.telecomCallGetCallIds() 1397 self.log.info("Calls in PhoneA{}".format(calls)) 1398 if num_active_calls(self.log, ads[0]) != 2: 1399 self.log.error("Active call numbers in PhoneA is not 2.") 1400 return False 1401 for call in calls: 1402 if call != call_id_video_ab: 1403 call_id_video_ac = call 1404 1405 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1406 return False 1407 if not verify_video_call_in_expected_state( 1408 self.log, ads[0], call_id_video_ab, VT_STATE_BIDIRECTIONAL, 1409 CALL_STATE_HOLDING): 1410 return False 1411 if not verify_video_call_in_expected_state( 1412 self.log, ads[0], call_id_video_ac, VT_STATE_BIDIRECTIONAL, 1413 CALL_STATE_ACTIVE): 1414 return False 1415 1416 return self._vt_test_multi_call_hangup(ads) 1417 1418 @test_tracker_info(uuid="d501a744-fda7-4a0c-a25d-a1ed4e7a356e") 1419 @TelephonyBaseTest.tel_test_wrap 1420 def test_call_video_add_mt_video(self): 1421 """ 1422 From Phone_A, Initiate a Bi-Directional Video Call to Phone_B 1423 Accept the call on Phone_B as Bi-Directional Video 1424 From Phone_C, add a Bi-Directional Video Call to Phone_A 1425 Accept the call on Phone_A 1426 Verify both calls remain active. 1427 Hang up on PhoneC. 1428 Hang up on PhoneA. 1429 """ 1430 # TODO: b/21437650 Test will fail. After established 2nd call ~15s, 1431 # Phone C will drop call. 1432 ads = self.android_devices 1433 self.number_of_devices = 3 1434 tasks = [(phone_setup_video, (self.log, ads[0])), 1435 (phone_setup_video, (self.log, ads[1])), (phone_setup_video, 1436 (self.log, ads[2]))] 1437 if not multithread_func(self.log, tasks): 1438 self.log.error("Phone Failed to Set Up Properly.") 1439 return False 1440 1441 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 1442 if not video_call_setup_teardown( 1443 self.log, 1444 ads[0], 1445 ads[1], 1446 None, 1447 video_state=VT_STATE_BIDIRECTIONAL, 1448 verify_caller_func=is_phone_in_call_video_bidirectional, 1449 verify_callee_func=is_phone_in_call_video_bidirectional): 1450 self.log.error("Failed to setup a call") 1451 return False 1452 call_id_video_ab = get_call_id_in_video_state(self.log, ads[0], 1453 VT_STATE_BIDIRECTIONAL) 1454 if call_id_video_ab is None: 1455 self.log.error("No active video call in PhoneA.") 1456 return False 1457 1458 self.log.info("Step2: Initiate Video Call PhoneC->PhoneA.") 1459 if not video_call_setup_teardown( 1460 self.log, 1461 ads[2], 1462 ads[0], 1463 None, 1464 video_state=VT_STATE_BIDIRECTIONAL, 1465 verify_caller_func=is_phone_in_call_video_bidirectional, 1466 verify_callee_func=is_phone_in_call_video_bidirectional): 1467 self.log.error("Failed to setup a call") 1468 return False 1469 1470 self.log.info("Step3: Verify PhoneA's video calls in correct state.") 1471 calls = ads[0].droid.telecomCallGetCallIds() 1472 self.log.info("Calls in PhoneA{}".format(calls)) 1473 if num_active_calls(self.log, ads[0]) != 2: 1474 self.log.error("Active call numbers in PhoneA is not 2.") 1475 return False 1476 for call in calls: 1477 if call != call_id_video_ab: 1478 call_id_video_ac = call 1479 1480 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1481 return False 1482 if not verify_video_call_in_expected_state( 1483 self.log, ads[0], call_id_video_ab, 1484 VT_STATE_BIDIRECTIONAL_PAUSED, CALL_STATE_HOLDING): 1485 return False 1486 if not verify_video_call_in_expected_state( 1487 self.log, ads[0], call_id_video_ac, VT_STATE_BIDIRECTIONAL, 1488 CALL_STATE_ACTIVE): 1489 return False 1490 1491 self.log.info("Step4: Hangup on PhoneC.") 1492 if not hangup_call(self.log, ads[2]): 1493 return False 1494 time.sleep(WAIT_TIME_IN_CALL) 1495 if not verify_incall_state(self.log, [ads[0], ads[1]], True): 1496 return False 1497 self.log.info("Step4: Hangup on PhoneA.") 1498 if not hangup_call(self.log, ads[0]): 1499 return False 1500 time.sleep(WAIT_TIME_IN_CALL) 1501 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False): 1502 return False 1503 return True 1504 1505 @test_tracker_info(uuid="26c9c6f6-b68e-492a-b188-ce8109a4ba34") 1506 @TelephonyBaseTest.tel_test_wrap 1507 def test_call_mt_video_add_mt_video(self): 1508 """ 1509 From Phone_B, Initiate a Bi-Directional Video Call to Phone_A 1510 Accept the call on Phone_A as Bi-Directional Video 1511 From Phone_C, add a Bi-Directional Video Call to Phone_A 1512 Accept the call on Phone_A 1513 Verify both calls remain active. 1514 Hang up on PhoneC. 1515 Hang up on PhoneA. 1516 """ 1517 # TODO: b/21437650 Test will fail. After established 2nd call ~15s, 1518 # Phone C will drop call. 1519 ads = self.android_devices 1520 self.number_of_devices = 3 1521 tasks = [(phone_setup_video, (self.log, ads[0])), 1522 (phone_setup_video, (self.log, ads[1])), (phone_setup_video, 1523 (self.log, ads[2]))] 1524 if not multithread_func(self.log, tasks): 1525 self.log.error("Phone Failed to Set Up Properly.") 1526 return False 1527 1528 self.log.info("Step1: Initiate Video Call PhoneB->PhoneA.") 1529 if not video_call_setup_teardown( 1530 self.log, 1531 ads[1], 1532 ads[0], 1533 None, 1534 video_state=VT_STATE_BIDIRECTIONAL, 1535 verify_caller_func=is_phone_in_call_video_bidirectional, 1536 verify_callee_func=is_phone_in_call_video_bidirectional): 1537 self.log.error("Failed to setup a call") 1538 return False 1539 call_id_video_ab = get_call_id_in_video_state(self.log, ads[0], 1540 VT_STATE_BIDIRECTIONAL) 1541 if call_id_video_ab is None: 1542 self.log.error("No active video call in PhoneA.") 1543 return False 1544 1545 self.log.info("Step2: Initiate Video Call PhoneC->PhoneA.") 1546 if not video_call_setup_teardown( 1547 self.log, 1548 ads[2], 1549 ads[0], 1550 None, 1551 video_state=VT_STATE_BIDIRECTIONAL, 1552 verify_caller_func=is_phone_in_call_video_bidirectional, 1553 verify_callee_func=is_phone_in_call_video_bidirectional): 1554 self.log.error("Failed to setup a call") 1555 return False 1556 1557 self.log.info("Step3: Verify PhoneA's video calls in correct state.") 1558 calls = ads[0].droid.telecomCallGetCallIds() 1559 self.log.info("Calls in PhoneA{}".format(calls)) 1560 if num_active_calls(self.log, ads[0]) != 2: 1561 self.log.error("Active call numbers in PhoneA is not 2.") 1562 return False 1563 for call in calls: 1564 if call != call_id_video_ab: 1565 call_id_video_ac = call 1566 1567 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1568 return False 1569 if not verify_video_call_in_expected_state( 1570 self.log, ads[0], call_id_video_ab, 1571 VT_STATE_BIDIRECTIONAL_PAUSED, CALL_STATE_HOLDING): 1572 return False 1573 if not verify_video_call_in_expected_state( 1574 self.log, ads[0], call_id_video_ac, VT_STATE_BIDIRECTIONAL, 1575 CALL_STATE_ACTIVE): 1576 return False 1577 1578 self.log.info("Step4: Hangup on PhoneC.") 1579 if not hangup_call(self.log, ads[2]): 1580 return False 1581 time.sleep(WAIT_TIME_IN_CALL) 1582 if not verify_incall_state(self.log, [ads[0], ads[1]], True): 1583 return False 1584 self.log.info("Step4: Hangup on PhoneA.") 1585 if not hangup_call(self.log, ads[0]): 1586 return False 1587 time.sleep(WAIT_TIME_IN_CALL) 1588 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False): 1589 return False 1590 return True 1591 1592 @test_tracker_info(uuid="5ceb6eb2-c128-405e-8ba4-69a4646842a0") 1593 @TelephonyBaseTest.tel_test_wrap 1594 def test_call_mt_video_add_mo_video(self): 1595 """ 1596 From Phone_B, Initiate a Bi-Directional Video Call to Phone_A 1597 Accept the call on Phone_A as Bi-Directional Video 1598 From Phone_A, add a Bi-Directional Video Call to Phone_C 1599 Accept the call on Phone_C 1600 Verify both calls remain active. 1601 """ 1602 # This test case is not supported by VZW. 1603 ads = self.android_devices 1604 self.number_of_devices = 3 1605 tasks = [(phone_setup_video, (self.log, ads[0])), 1606 (phone_setup_video, (self.log, ads[1])), (phone_setup_video, 1607 (self.log, ads[2]))] 1608 if not multithread_func(self.log, tasks): 1609 self.log.error("Phone Failed to Set Up Properly.") 1610 return False 1611 1612 self.log.info("Step1: Initiate Video Call PhoneB->PhoneA.") 1613 if not video_call_setup_teardown( 1614 self.log, 1615 ads[1], 1616 ads[0], 1617 None, 1618 video_state=VT_STATE_BIDIRECTIONAL, 1619 verify_caller_func=is_phone_in_call_video_bidirectional, 1620 verify_callee_func=is_phone_in_call_video_bidirectional): 1621 self.log.error("Failed to setup a call") 1622 return False 1623 call_id_video_ab = get_call_id_in_video_state(self.log, ads[0], 1624 VT_STATE_BIDIRECTIONAL) 1625 if call_id_video_ab is None: 1626 self.log.error("No active video call in PhoneA.") 1627 return False 1628 1629 self.log.info("Step2: Initiate Video Call PhoneA->PhoneC.") 1630 if not video_call_setup_teardown( 1631 self.log, 1632 ads[0], 1633 ads[2], 1634 None, 1635 video_state=VT_STATE_BIDIRECTIONAL, 1636 verify_caller_func=is_phone_in_call_video_bidirectional, 1637 verify_callee_func=is_phone_in_call_video_bidirectional): 1638 self.log.error("Failed to setup a call") 1639 return False 1640 1641 self.log.info("Step3: Verify PhoneA's video calls in correct state.") 1642 calls = ads[0].droid.telecomCallGetCallIds() 1643 self.log.info("Calls in PhoneA{}".format(calls)) 1644 if num_active_calls(self.log, ads[0]) != 2: 1645 self.log.error("Active call numbers in PhoneA is not 2.") 1646 return False 1647 for call in calls: 1648 if call != call_id_video_ab: 1649 call_id_video_ac = call 1650 1651 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1652 return False 1653 if not verify_video_call_in_expected_state( 1654 self.log, ads[0], call_id_video_ab, VT_STATE_BIDIRECTIONAL, 1655 CALL_STATE_HOLDING): 1656 return False 1657 if not verify_video_call_in_expected_state( 1658 self.log, ads[0], call_id_video_ac, VT_STATE_BIDIRECTIONAL, 1659 CALL_STATE_ACTIVE): 1660 return False 1661 1662 return self._vt_test_multi_call_hangup(ads) 1663 1664 def _test_vt_conference_merge_drop(self, ads, call_ab_id, call_ac_id): 1665 """Test conference merge and drop for VT call test. 1666 1667 PhoneA in call with PhoneB. 1668 PhoneA in call with PhoneC. 1669 Merge calls to conference on PhoneA. 1670 Hangup on PhoneB, check call continues between AC. 1671 Hangup on PhoneC. 1672 Hangup on PhoneA. 1673 1674 Args: 1675 call_ab_id: call id for call_AB on PhoneA. 1676 call_ac_id: call id for call_AC on PhoneA. 1677 1678 Returns: 1679 True if succeed; 1680 False if failed. 1681 """ 1682 self.number_of_devices = 3 1683 self.log.info( 1684 "Merge - Step1: Merge to Conf Call and verify Conf Call.") 1685 ads[0].droid.telecomCallJoinCallsInConf(call_ab_id, call_ac_id) 1686 time.sleep(WAIT_TIME_IN_CALL) 1687 calls = ads[0].droid.telecomCallGetCallIds() 1688 self.log.info("Calls in PhoneA{}".format(calls)) 1689 if num_active_calls(self.log, ads[0]) != 1: 1690 self.log.error("Total number of call ids in {} is not 1.".format( 1691 ads[0].serial)) 1692 return False 1693 call_conf_id = None 1694 for call_id in calls: 1695 if call_id != call_ab_id and call_id != call_ac_id: 1696 call_conf_id = call_id 1697 if not call_conf_id: 1698 self.log.error("Merge call fail, no new conference call id.") 1699 return False 1700 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1701 return False 1702 1703 # Check if Conf Call is currently active 1704 if ads[0].droid.telecomCallGetCallState( 1705 call_conf_id) != CALL_STATE_ACTIVE: 1706 self.log.error( 1707 "Call_id:{}, state:{}, expected: STATE_ACTIVE".format( 1708 call_conf_id, 1709 ads[0].droid.telecomCallGetCallState(call_conf_id))) 1710 return False 1711 1712 self.log.info( 1713 "Merge - Step2: End call on PhoneB and verify call continues.") 1714 if not hangup_call(self.log, ads[1]): 1715 self.log.error("Failed to end the call on PhoneB") 1716 return False 1717 time.sleep(WAIT_TIME_IN_CALL) 1718 calls = ads[0].droid.telecomCallGetCallIds() 1719 self.log.info("Calls in PhoneA{}".format(calls)) 1720 if not verify_incall_state(self.log, [ads[0], ads[2]], True): 1721 return False 1722 if not verify_incall_state(self.log, [ads[1]], False): 1723 return False 1724 1725 if not (hangup_call(self.log, ads[2]) 1726 and hangup_call(self.log, ads[0])): 1727 self.log.error("Failed to clean up remaining calls") 1728 return False 1729 return True 1730 1731 def _test_vt_conference_merge_drop_cep(self, ads, call_ab_id, call_ac_id): 1732 """Merge CEP conference call. 1733 1734 PhoneA in IMS (VoLTE or WiFi Calling) call with PhoneB. 1735 PhoneA in IMS (VoLTE or WiFi Calling) call with PhoneC. 1736 Merge calls to conference on PhoneA (CEP enabled IMS conference). 1737 1738 Args: 1739 call_ab_id: call id for call_AB on PhoneA. 1740 call_ac_id: call id for call_AC on PhoneA. 1741 1742 Returns: 1743 call_id for conference 1744 """ 1745 1746 self.number_of_devices = 2 1747 self.log.info("Step4: Merge to Conf Call and verify Conf Call.") 1748 ads[0].droid.telecomCallJoinCallsInConf(call_ab_id, call_ac_id) 1749 time.sleep(WAIT_TIME_IN_CALL) 1750 calls = ads[0].droid.telecomCallGetCallIds() 1751 self.log.info("Calls in PhoneA{}".format(calls)) 1752 1753 call_conf_id = get_cep_conference_call_id(ads[0]) 1754 if call_conf_id is None: 1755 self.log.error( 1756 "No call with children. Probably CEP not enabled or merge failed." 1757 ) 1758 return False 1759 calls.remove(call_conf_id) 1760 if (set(ads[0].droid.telecomCallGetCallChildren(call_conf_id)) != 1761 set(calls)): 1762 self.log.error( 1763 "Children list<{}> for conference call is not correct.".format( 1764 ads[0].droid.telecomCallGetCallChildren(call_conf_id))) 1765 return False 1766 1767 if (CALL_PROPERTY_CONFERENCE not in ads[0] 1768 .droid.telecomCallGetProperties(call_conf_id)): 1769 self.log.error("Conf call id properties wrong: {}".format( 1770 ads[0].droid.telecomCallGetProperties(call_conf_id))) 1771 return False 1772 1773 if (CALL_CAPABILITY_MANAGE_CONFERENCE not in ads[0] 1774 .droid.telecomCallGetCapabilities(call_conf_id)): 1775 self.log.error("Conf call id capabilities wrong: {}".format( 1776 ads[0].droid.telecomCallGetCapabilities(call_conf_id))) 1777 return False 1778 1779 if (call_ab_id in calls) or (call_ac_id in calls): 1780 self.log.error( 1781 "Previous call ids should not in new call list after merge.") 1782 return False 1783 1784 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1785 return False 1786 1787 # Check if Conf Call is currently active 1788 if ads[0].droid.telecomCallGetCallState( 1789 call_conf_id) != CALL_STATE_ACTIVE: 1790 self.log.error( 1791 "Call_id:{}, state:{}, expected: STATE_ACTIVE".format( 1792 call_conf_id, 1793 ads[0].droid.telecomCallGetCallState(call_conf_id))) 1794 return False 1795 1796 if not hangup_call(self.log, ads[1]): 1797 self.log.error("Failed to end call on PhoneB") 1798 return False 1799 time.sleep(WAIT_TIME_IN_CALL) 1800 calls = ads[0].droid.telecomCallGetCallIds() 1801 self.log.info("Calls in PhoneA{}".format(calls)) 1802 if not verify_incall_state(self.log, [ads[0], ads[2]], True): 1803 return False 1804 if not verify_incall_state(self.log, [ads[1]], False): 1805 return False 1806 1807 if not (hangup_call(self.log, ads[2]) 1808 and hangup_call(self.log, ads[0])): 1809 self.log.error("Failed to clean up remaining calls") 1810 return False 1811 1812 return True 1813 1814 @test_tracker_info(uuid="51731afc-e278-4f72-a5e1-590d49ba348d") 1815 @TelephonyBaseTest.tel_test_wrap 1816 def test_call_volte_add_mo_video_accept_as_voice_merge_drop(self): 1817 """Conference call 1818 1819 Make Sure PhoneA is in LTE mode (with Video Calling). 1820 Make Sure PhoneB is in LTE mode (with VoLTE). 1821 Make Sure PhoneC is in LTE mode (with Video Calling). 1822 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 1823 PhoneA add a Bi-Directional Video call to PhoneC. 1824 PhoneC accept as voice. 1825 Merge call on PhoneA. 1826 Hang up on PhoneB. 1827 Hang up on PhoneC. 1828 """ 1829 return self._test_call_volte_add_mo_video_accept_as_voice_merge_drop( 1830 False) 1831 1832 @test_tracker_info(uuid="23e3a071-5453-48da-8439-bd75bc79547f") 1833 @TelephonyBaseTest.tel_test_wrap 1834 def test_call_volte_add_mo_video_accept_as_voice_merge_drop_cep(self): 1835 """Conference call 1836 1837 Make Sure PhoneA is in LTE mode (with Video Calling). 1838 Make Sure PhoneB is in LTE mode (with VoLTE). 1839 Make Sure PhoneC is in LTE mode (with Video Calling). 1840 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 1841 PhoneA add a Bi-Directional Video call to PhoneC. 1842 PhoneC accept as voice. 1843 Merge call on PhoneA. 1844 Hang up on PhoneB. 1845 Hang up on PhoneC. 1846 """ 1847 return self._test_call_volte_add_mo_video_accept_as_voice_merge_drop( 1848 True) 1849 1850 def _test_call_volte_add_mo_video_accept_as_voice_merge_drop( 1851 self, use_cep=False): 1852 # This test case is not supported by VZW. 1853 ads = self.android_devices 1854 self.number_of_devices = 3 1855 tasks = [(phone_setup_video, (self.log, ads[0])), 1856 (phone_setup_volte, (self.log, ads[1])), (phone_setup_video, 1857 (self.log, ads[2]))] 1858 if not multithread_func(self.log, tasks): 1859 self.log.error("Phone Failed to Set Up Properly.") 1860 return False 1861 self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.") 1862 if not call_setup_teardown(self.log, ads[0], ads[1], None, 1863 is_phone_in_call_volte, 1864 is_phone_in_call_volte): 1865 self.log.error("Failed to setup a call") 1866 return False 1867 calls = ads[0].droid.telecomCallGetCallIds() 1868 self.log.info("Calls in PhoneA{}".format(calls)) 1869 if num_active_calls(self.log, ads[0]) != 1: 1870 self.log.error("Active call numbers in PhoneA is not 1.") 1871 return False 1872 call_ab_id = calls[0] 1873 1874 self.log.info( 1875 "Step2: Initiate Video Call PhoneA->PhoneC and accept as voice.") 1876 if not video_call_setup_teardown( 1877 self.log, 1878 ads[0], 1879 ads[2], 1880 None, 1881 video_state=VT_STATE_AUDIO_ONLY, 1882 verify_caller_func=is_phone_in_call_voice_hd, 1883 verify_callee_func=is_phone_in_call_voice_hd): 1884 self.log.error("Failed to setup a call") 1885 return False 1886 calls = ads[0].droid.telecomCallGetCallIds() 1887 self.log.info("Calls in PhoneA{}".format(calls)) 1888 if num_active_calls(self.log, ads[0]) != 2: 1889 self.log.error("Active call numbers in PhoneA is not 2.") 1890 return False 1891 for call in calls: 1892 if call != call_ab_id: 1893 call_ac_id = call 1894 1895 self.log.info("Step3: Verify calls in correct state.") 1896 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1897 return False 1898 if not verify_video_call_in_expected_state( 1899 self.log, ads[0], call_ab_id, VT_STATE_AUDIO_ONLY, 1900 CALL_STATE_HOLDING): 1901 return False 1902 if not verify_video_call_in_expected_state( 1903 self.log, ads[0], call_ac_id, VT_STATE_AUDIO_ONLY, 1904 CALL_STATE_ACTIVE): 1905 return False 1906 1907 return { 1908 False: self._test_vt_conference_merge_drop, 1909 True: self._test_vt_conference_merge_drop_cep 1910 }[use_cep](ads, call_ab_id, call_ac_id) 1911 1912 @test_tracker_info(uuid="5ac216a6-4ce3-4bd6-a132-8b1294e461a7") 1913 @TelephonyBaseTest.tel_test_wrap 1914 def test_call_volte_add_mt_video_accept_as_voice_merge_drop(self): 1915 """Conference call 1916 1917 Make Sure PhoneA is in LTE mode (with Video Calling). 1918 Make Sure PhoneB is in LTE mode (with VoLTE). 1919 Make Sure PhoneC is in LTE mode (with Video Calling). 1920 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 1921 PhoneC add a Bi-Directional Video call to PhoneA. 1922 PhoneA accept as voice. 1923 Merge call on PhoneA. 1924 Hang up on PhoneB. 1925 Hang up on PhoneC. 1926 """ 1927 return self._test_call_volte_add_mt_video_accept_as_voice_merge_drop( 1928 False) 1929 1930 @test_tracker_info(uuid="be1d2337-ed0d-4293-afe8-0fa677b6bee1") 1931 @TelephonyBaseTest.tel_test_wrap 1932 def test_call_volte_add_mt_video_accept_as_voice_merge_drop_cep(self): 1933 """Conference call 1934 1935 Make Sure PhoneA is in LTE mode (with Video Calling). 1936 Make Sure PhoneB is in LTE mode (with VoLTE). 1937 Make Sure PhoneC is in LTE mode (with Video Calling). 1938 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 1939 PhoneC add a Bi-Directional Video call to PhoneA. 1940 PhoneA accept as voice. 1941 Merge call on PhoneA. 1942 Hang up on PhoneB. 1943 Hang up on PhoneC. 1944 """ 1945 return self._test_call_volte_add_mt_video_accept_as_voice_merge_drop( 1946 True) 1947 1948 def _test_call_volte_add_mt_video_accept_as_voice_merge_drop( 1949 self, use_cep=False): 1950 ads = self.android_devices 1951 self.number_of_devices = 3 1952 tasks = [(phone_setup_video, (self.log, ads[0])), 1953 (phone_setup_volte, (self.log, ads[1])), (phone_setup_video, 1954 (self.log, ads[2]))] 1955 if not multithread_func(self.log, tasks): 1956 self.log.error("Phone Failed to Set Up Properly.") 1957 return False 1958 self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.") 1959 if not call_setup_teardown(self.log, ads[0], ads[1], None, 1960 is_phone_in_call_volte, 1961 is_phone_in_call_volte): 1962 self.log.error("Failed to setup a call") 1963 return False 1964 calls = ads[0].droid.telecomCallGetCallIds() 1965 self.log.info("Calls in PhoneA{}".format(calls)) 1966 if num_active_calls(self.log, ads[0]) != 1: 1967 self.log.error("Active call numbers in PhoneA is not 1.") 1968 return False 1969 call_ab_id = calls[0] 1970 1971 self.log.info( 1972 "Step2: Initiate Video Call PhoneC->PhoneA and accept as voice.") 1973 if not video_call_setup_teardown( 1974 self.log, 1975 ads[2], 1976 ads[0], 1977 None, 1978 video_state=VT_STATE_AUDIO_ONLY, 1979 verify_caller_func=is_phone_in_call_voice_hd, 1980 verify_callee_func=is_phone_in_call_voice_hd): 1981 self.log.error("Failed to setup a call") 1982 return False 1983 calls = ads[0].droid.telecomCallGetCallIds() 1984 self.log.info("Calls in PhoneA{}".format(calls)) 1985 if num_active_calls(self.log, ads[0]) != 2: 1986 self.log.error("Active call numbers in PhoneA is not 2.") 1987 return False 1988 for call in calls: 1989 if call != call_ab_id: 1990 call_ac_id = call 1991 1992 self.log.info("Step3: Verify calls in correct state.") 1993 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 1994 return False 1995 if not verify_video_call_in_expected_state( 1996 self.log, ads[0], call_ab_id, VT_STATE_AUDIO_ONLY, 1997 CALL_STATE_HOLDING): 1998 return False 1999 if not verify_video_call_in_expected_state( 2000 self.log, ads[0], call_ac_id, VT_STATE_AUDIO_ONLY, 2001 CALL_STATE_ACTIVE): 2002 return False 2003 2004 return { 2005 False: self._test_vt_conference_merge_drop, 2006 True: self._test_vt_conference_merge_drop_cep 2007 }[use_cep](ads, call_ab_id, call_ac_id) 2008 2009 @test_tracker_info(uuid="ead8b199-2703-4e6c-b55b-57c5280b52e8") 2010 @TelephonyBaseTest.tel_test_wrap 2011 def test_call_video_add_mo_voice_swap_downgrade_merge_drop(self): 2012 """Conference call 2013 2014 Make Sure PhoneA is in LTE mode (with Video Calling). 2015 Make Sure PhoneB is in LTE mode (with Video Calling). 2016 Make Sure PhoneC is in LTE mode (with VoLTE). 2017 PhoneA add a Bi-Directional Video call to PhoneB. 2018 PhoneB accept as Video. 2019 PhoneA VoLTE call to PhoneC. Accept on PhoneC. 2020 Swap Active call on PhoneA. 2021 Downgrade Video call on PhoneA and PhoneB to audio only. 2022 Merge call on PhoneA. 2023 Hang up on PhoneB. 2024 Hang up on PhoneC. 2025 """ 2026 return self._test_call_video_add_mo_voice_swap_downgrade_merge_drop( 2027 False) 2028 2029 @test_tracker_info(uuid="fb52dc54-0b11-46d4-a619-412eda2df390") 2030 @TelephonyBaseTest.tel_test_wrap 2031 def test_call_video_add_mo_voice_swap_downgrade_merge_drop_cep(self): 2032 """Conference call 2033 2034 Make Sure PhoneA is in LTE mode (with Video Calling). 2035 Make Sure PhoneB is in LTE mode (with Video Calling). 2036 Make Sure PhoneC is in LTE mode (with VoLTE). 2037 PhoneA add a Bi-Directional Video call to PhoneB. 2038 PhoneB accept as Video. 2039 PhoneA VoLTE call to PhoneC. Accept on PhoneC. 2040 Swap Active call on PhoneA. 2041 Downgrade Video call on PhoneA and PhoneB to audio only. 2042 Merge call on PhoneA. 2043 Hang up on PhoneB. 2044 Hang up on PhoneC. 2045 """ 2046 return self._test_call_video_add_mo_voice_swap_downgrade_merge_drop( 2047 True) 2048 2049 def _test_call_video_add_mo_voice_swap_downgrade_merge_drop(self, use_cep): 2050 ads = self.android_devices 2051 self.number_of_devices = 3 2052 tasks = [(phone_setup_video, (self.log, ads[0])), 2053 (phone_setup_video, (self.log, ads[1])), (phone_setup_volte, 2054 (self.log, ads[2]))] 2055 if not multithread_func(self.log, tasks): 2056 self.log.error("Phone Failed to Set Up Properly.") 2057 return False 2058 2059 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 2060 if not video_call_setup_teardown( 2061 self.log, 2062 ads[0], 2063 ads[1], 2064 None, 2065 video_state=VT_STATE_BIDIRECTIONAL, 2066 verify_caller_func=is_phone_in_call_video_bidirectional, 2067 verify_callee_func=is_phone_in_call_video_bidirectional): 2068 self.log.error("Failed to setup a call") 2069 return False 2070 call_id_video_ab = get_call_id_in_video_state(self.log, ads[0], 2071 VT_STATE_BIDIRECTIONAL) 2072 if call_id_video_ab is None: 2073 self.log.error("No active video call in PhoneA.") 2074 return False 2075 2076 self.log.info("Step2: Initiate Voice Call PhoneA->PhoneC.") 2077 if not call_setup_teardown( 2078 self.log, 2079 ads[0], 2080 ads[2], 2081 None, 2082 verify_caller_func=None, 2083 verify_callee_func=is_phone_in_call_volte): 2084 self.log.error("Failed to setup a call") 2085 return False 2086 2087 self.log.info( 2088 "Step3: Verify PhoneA's video/voice call in correct state.") 2089 calls = ads[0].droid.telecomCallGetCallIds() 2090 self.log.info("Calls in PhoneA{}".format(calls)) 2091 if num_active_calls(self.log, ads[0]) != 2: 2092 self.log.error("Active call numbers in PhoneA is not 2.") 2093 return False 2094 for call in calls: 2095 if call != call_id_video_ab: 2096 call_id_voice_ac = call 2097 2098 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2099 return False 2100 if not verify_video_call_in_expected_state( 2101 self.log, ads[0], call_id_video_ab, VT_STATE_BIDIRECTIONAL, 2102 CALL_STATE_HOLDING): 2103 return False 2104 if not verify_video_call_in_expected_state( 2105 self.log, ads[0], call_id_voice_ac, VT_STATE_AUDIO_ONLY, 2106 CALL_STATE_ACTIVE): 2107 return False 2108 2109 self.log.info( 2110 "Step4: Swap calls on PhoneA and verify call state correct.") 2111 ads[0].droid.telecomCallHold(call_id_voice_ac) 2112 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 2113 for ad in [ads[0], ads[1]]: 2114 self.log.info("{} audio: {}".format(ad.serial, 2115 get_audio_route(self.log, ad))) 2116 set_audio_route(self.log, ad, AUDIO_ROUTE_EARPIECE) 2117 2118 time.sleep(WAIT_TIME_IN_CALL) 2119 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2120 return False 2121 if not verify_video_call_in_expected_state( 2122 self.log, ads[0], call_id_video_ab, VT_STATE_BIDIRECTIONAL, 2123 CALL_STATE_ACTIVE): 2124 return False 2125 if not verify_video_call_in_expected_state( 2126 self.log, ads[0], call_id_voice_ac, VT_STATE_AUDIO_ONLY, 2127 CALL_STATE_HOLDING): 2128 return False 2129 2130 self.log.info("Step5: Disable camera on PhoneA and PhoneB.") 2131 if not video_call_downgrade(self.log, ads[0], call_id_video_ab, ads[1], 2132 get_call_id_in_video_state( 2133 self.log, ads[1], 2134 VT_STATE_BIDIRECTIONAL)): 2135 self.log.error("Failed to disable video on PhoneA.") 2136 return False 2137 if not video_call_downgrade(self.log, ads[1], 2138 get_call_id_in_video_state( 2139 self.log, ads[1], VT_STATE_TX_ENABLED), 2140 ads[0], call_id_video_ab): 2141 self.log.error("Failed to disable video on PhoneB.") 2142 return False 2143 2144 self.log.info("Step6: Verify calls in correct state.") 2145 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2146 return False 2147 if not verify_video_call_in_expected_state( 2148 self.log, ads[0], call_id_video_ab, VT_STATE_AUDIO_ONLY, 2149 CALL_STATE_ACTIVE): 2150 return False 2151 if not verify_video_call_in_expected_state( 2152 self.log, ads[0], call_id_voice_ac, VT_STATE_AUDIO_ONLY, 2153 CALL_STATE_HOLDING): 2154 return False 2155 2156 return { 2157 False: self._test_vt_conference_merge_drop, 2158 True: self._test_vt_conference_merge_drop_cep 2159 }[use_cep](ads, call_id_video_ab, call_id_voice_ac) 2160 2161 @test_tracker_info(uuid="cd051485-80be-47a3-b249-e09bf786a012") 2162 @TelephonyBaseTest.tel_test_wrap 2163 def test_call_video_add_mt_voice_swap_downgrade_merge_drop(self): 2164 """Conference call 2165 2166 Make Sure PhoneA is in LTE mode (with Video Calling). 2167 Make Sure PhoneB is in LTE mode (with Video Calling). 2168 Make Sure PhoneC is in LTE mode (with VoLTE). 2169 PhoneA add a Bi-Directional Video call to PhoneB. 2170 PhoneB accept as Video. 2171 PhoneC VoLTE call to PhoneA. Accept on PhoneA. 2172 Swap Active call on PhoneA. 2173 Downgrade Video call on PhoneA and PhoneB to audio only. 2174 Merge call on PhoneA. 2175 Hang up on PhoneB. 2176 Hang up on PhoneC. 2177 """ 2178 return self._test_call_video_add_mt_voice_swap_downgrade_merge_drop( 2179 False) 2180 2181 @test_tracker_info(uuid="3e171185-7bfc-4db3-8b0b-f0f1a1b79698") 2182 @TelephonyBaseTest.tel_test_wrap 2183 def test_call_video_add_mt_voice_swap_downgrade_merge_drop_cep(self): 2184 """Conference call 2185 2186 Make Sure PhoneA is in LTE mode (with Video Calling). 2187 Make Sure PhoneB is in LTE mode (with Video Calling). 2188 Make Sure PhoneC is in LTE mode (with VoLTE). 2189 PhoneA add a Bi-Directional Video call to PhoneB. 2190 PhoneB accept as Video. 2191 PhoneC VoLTE call to PhoneA. Accept on PhoneA. 2192 Swap Active call on PhoneA. 2193 Downgrade Video call on PhoneA and PhoneB to audio only. 2194 Merge call on PhoneA. 2195 Hang up on PhoneB. 2196 Hang up on PhoneC. 2197 """ 2198 return self._test_call_video_add_mt_voice_swap_downgrade_merge_drop( 2199 True) 2200 2201 def _test_call_video_add_mt_voice_swap_downgrade_merge_drop( 2202 self, use_cep=False): 2203 ads = self.android_devices 2204 self.number_of_devices = 3 2205 tasks = [(phone_setup_video, (self.log, ads[0])), 2206 (phone_setup_video, (self.log, ads[1])), (phone_setup_volte, 2207 (self.log, ads[2]))] 2208 if not multithread_func(self.log, tasks): 2209 self.log.error("Phone Failed to Set Up Properly.") 2210 return False 2211 2212 self.log.info("Step1: Initiate Video Call PhoneA->PhoneB.") 2213 if not video_call_setup_teardown( 2214 self.log, 2215 ads[0], 2216 ads[1], 2217 None, 2218 video_state=VT_STATE_BIDIRECTIONAL, 2219 verify_caller_func=is_phone_in_call_video_bidirectional, 2220 verify_callee_func=is_phone_in_call_video_bidirectional): 2221 self.log.error("Failed to setup a call") 2222 return False 2223 call_id_video_ab = get_call_id_in_video_state(self.log, ads[0], 2224 VT_STATE_BIDIRECTIONAL) 2225 if call_id_video_ab is None: 2226 self.log.error("No active video call in PhoneA.") 2227 return False 2228 2229 self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.") 2230 if not call_setup_teardown( 2231 self.log, 2232 ads[2], 2233 ads[0], 2234 None, 2235 verify_caller_func=is_phone_in_call_volte, 2236 verify_callee_func=None): 2237 self.log.error("Failed to setup a call") 2238 return False 2239 2240 self.log.info( 2241 "Step3: Verify PhoneA's video/voice call in correct state.") 2242 calls = ads[0].droid.telecomCallGetCallIds() 2243 self.log.info("Calls in PhoneA{}".format(calls)) 2244 if num_active_calls(self.log, ads[0]) != 2: 2245 self.log.error("Active call numbers in PhoneA is not 2.") 2246 return False 2247 for call in calls: 2248 if call != call_id_video_ab: 2249 call_id_voice_ac = call 2250 2251 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2252 return False 2253 if not verify_video_call_in_expected_state( 2254 self.log, ads[0], call_id_video_ab, 2255 VT_STATE_BIDIRECTIONAL_PAUSED, CALL_STATE_HOLDING): 2256 return False 2257 if not verify_video_call_in_expected_state( 2258 self.log, ads[0], call_id_voice_ac, VT_STATE_AUDIO_ONLY, 2259 CALL_STATE_ACTIVE): 2260 return False 2261 2262 self.log.info( 2263 "Step4: Swap calls on PhoneA and verify call state correct.") 2264 ads[0].droid.telecomCallHold(call_id_voice_ac) 2265 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) 2266 for ad in [ads[0], ads[1]]: 2267 if get_audio_route(self.log, ad) != AUDIO_ROUTE_SPEAKER: 2268 self.log.error("{} Audio is not on speaker.".format(ad.serial)) 2269 # TODO: b/26337892 Define expected audio route behavior. 2270 set_audio_route(self.log, ad, AUDIO_ROUTE_EARPIECE) 2271 2272 time.sleep(WAIT_TIME_IN_CALL) 2273 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2274 return False 2275 if not verify_video_call_in_expected_state( 2276 self.log, ads[0], call_id_video_ab, VT_STATE_BIDIRECTIONAL, 2277 CALL_STATE_ACTIVE): 2278 return False 2279 if not verify_video_call_in_expected_state( 2280 self.log, ads[0], call_id_voice_ac, VT_STATE_AUDIO_ONLY, 2281 CALL_STATE_HOLDING): 2282 return False 2283 2284 self.log.info("Step5: Disable camera on PhoneA and PhoneB.") 2285 if not video_call_downgrade(self.log, ads[0], call_id_video_ab, ads[1], 2286 get_call_id_in_video_state( 2287 self.log, ads[1], 2288 VT_STATE_BIDIRECTIONAL)): 2289 self.log.error("Failed to disable video on PhoneA.") 2290 return False 2291 if not video_call_downgrade(self.log, ads[1], 2292 get_call_id_in_video_state( 2293 self.log, ads[1], VT_STATE_TX_ENABLED), 2294 ads[0], call_id_video_ab): 2295 self.log.error("Failed to disable video on PhoneB.") 2296 return False 2297 2298 self.log.info("Step6: Verify calls in correct state.") 2299 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2300 return False 2301 if not verify_video_call_in_expected_state( 2302 self.log, ads[0], call_id_video_ab, VT_STATE_AUDIO_ONLY, 2303 CALL_STATE_ACTIVE): 2304 return False 2305 if not verify_video_call_in_expected_state( 2306 self.log, ads[0], call_id_voice_ac, VT_STATE_AUDIO_ONLY, 2307 CALL_STATE_HOLDING): 2308 return False 2309 2310 return { 2311 False: self._test_vt_conference_merge_drop, 2312 True: self._test_vt_conference_merge_drop_cep 2313 }[use_cep](ads, call_id_video_ab, call_id_voice_ac) 2314 2315 @test_tracker_info(uuid="3dd68dee-87ca-4e9b-8de8-dba6dc8f5725") 2316 @TelephonyBaseTest.tel_test_wrap 2317 def test_call_volte_add_mo_video_downgrade_merge_drop(self): 2318 """Conference call 2319 2320 Make Sure PhoneA is in LTE mode (with Video Calling). 2321 Make Sure PhoneB is in LTE mode (with VoLTE). 2322 Make Sure PhoneC is in LTE mode (with Video Calling). 2323 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 2324 PhoneA add a Bi-Directional Video call to PhoneC. 2325 PhoneC accept as Video. 2326 Downgrade Video call on PhoneA and PhoneC to audio only. 2327 Merge call on PhoneA. 2328 Hang up on PhoneB. 2329 Hang up on PhoneC. 2330 """ 2331 return self._test_call_volte_add_mo_video_downgrade_merge_drop(False) 2332 2333 @test_tracker_info(uuid="823f9b6a-7812-4f17-9534-e784a623e7e2") 2334 @TelephonyBaseTest.tel_test_wrap 2335 def test_call_volte_add_mo_video_downgrade_merge_drop_cep(self): 2336 """Conference call 2337 2338 Make Sure PhoneA is in LTE mode (with Video Calling). 2339 Make Sure PhoneB is in LTE mode (with VoLTE). 2340 Make Sure PhoneC is in LTE mode (with Video Calling). 2341 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 2342 PhoneA add a Bi-Directional Video call to PhoneC. 2343 PhoneC accept as Video. 2344 Downgrade Video call on PhoneA and PhoneC to audio only. 2345 Merge call on PhoneA. 2346 Hang up on PhoneB. 2347 Hang up on PhoneC. 2348 """ 2349 return self._test_call_volte_add_mo_video_downgrade_merge_drop(True) 2350 2351 def _test_call_volte_add_mo_video_downgrade_merge_drop(self, use_cep): 2352 ads = self.android_devices 2353 self.number_of_devices = 3 2354 tasks = [(phone_setup_video, (self.log, ads[0])), 2355 (phone_setup_volte, (self.log, ads[1])), (phone_setup_video, 2356 (self.log, ads[2]))] 2357 if not multithread_func(self.log, tasks): 2358 self.log.error("Phone Failed to Set Up Properly.") 2359 return False 2360 2361 self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.") 2362 if not call_setup_teardown( 2363 self.log, 2364 ads[0], 2365 ads[1], 2366 None, 2367 verify_caller_func=is_phone_in_call_volte, 2368 verify_callee_func=is_phone_in_call_volte): 2369 self.log.error("Failed to setup a call") 2370 return False 2371 calls = ads[0].droid.telecomCallGetCallIds() 2372 self.log.info("Calls in PhoneA{}".format(calls)) 2373 if num_active_calls(self.log, ads[0]) != 1: 2374 self.log.error("Active call numbers in PhoneA is not 1.") 2375 return False 2376 call_id_voice_ab = calls[0] 2377 2378 self.log.info("Step2: Initiate Video Call PhoneA->PhoneC.") 2379 if not video_call_setup_teardown( 2380 self.log, 2381 ads[0], 2382 ads[2], 2383 None, 2384 video_state=VT_STATE_BIDIRECTIONAL, 2385 verify_caller_func=is_phone_in_call_video_bidirectional, 2386 verify_callee_func=is_phone_in_call_video_bidirectional): 2387 self.log.error("Failed to setup a call") 2388 return False 2389 call_id_video_ac = get_call_id_in_video_state(self.log, ads[0], 2390 VT_STATE_BIDIRECTIONAL) 2391 if call_id_video_ac is None: 2392 self.log.error("No active video call in PhoneA.") 2393 return False 2394 2395 self.log.info( 2396 "Step3: Verify PhoneA's video/voice call in correct state.") 2397 calls = ads[0].droid.telecomCallGetCallIds() 2398 self.log.info("Calls in PhoneA{}".format(calls)) 2399 if num_active_calls(self.log, ads[0]) != 2: 2400 self.log.error("Active call numbers in PhoneA is not 2.") 2401 return False 2402 2403 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2404 return False 2405 if not verify_video_call_in_expected_state( 2406 self.log, ads[0], call_id_video_ac, VT_STATE_BIDIRECTIONAL, 2407 CALL_STATE_ACTIVE): 2408 return False 2409 if not verify_video_call_in_expected_state( 2410 self.log, ads[0], call_id_voice_ab, VT_STATE_AUDIO_ONLY, 2411 CALL_STATE_HOLDING): 2412 return False 2413 2414 self.log.info("Step4: Disable camera on PhoneA and PhoneC.") 2415 if not video_call_downgrade(self.log, ads[0], call_id_video_ac, ads[2], 2416 get_call_id_in_video_state( 2417 self.log, ads[2], 2418 VT_STATE_BIDIRECTIONAL)): 2419 self.log.error("Failed to disable video on PhoneA.") 2420 return False 2421 if not video_call_downgrade(self.log, ads[2], 2422 get_call_id_in_video_state( 2423 self.log, ads[2], VT_STATE_TX_ENABLED), 2424 ads[0], call_id_video_ac): 2425 self.log.error("Failed to disable video on PhoneB.") 2426 return False 2427 2428 self.log.info("Step6: Verify calls in correct state.") 2429 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2430 return False 2431 if not verify_video_call_in_expected_state( 2432 self.log, ads[0], call_id_video_ac, VT_STATE_AUDIO_ONLY, 2433 CALL_STATE_ACTIVE): 2434 return False 2435 if not verify_video_call_in_expected_state( 2436 self.log, ads[0], call_id_voice_ab, VT_STATE_AUDIO_ONLY, 2437 CALL_STATE_HOLDING): 2438 return False 2439 2440 return { 2441 False: self._test_vt_conference_merge_drop, 2442 True: self._test_vt_conference_merge_drop_cep 2443 }[use_cep](ads, call_id_video_ac, call_id_voice_ab) 2444 2445 @test_tracker_info(uuid="9926fb63-8230-461a-8c8c-1a9556fbb2a9") 2446 @TelephonyBaseTest.tel_test_wrap 2447 def test_call_volte_add_mt_video_downgrade_merge_drop(self): 2448 """Conference call 2449 2450 Make Sure PhoneA is in LTE mode (with Video Calling). 2451 Make Sure PhoneB is in LTE mode (with VoLTE). 2452 Make Sure PhoneC is in LTE mode (with Video Calling). 2453 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 2454 PhoneC add a Bi-Directional Video call to PhoneA. 2455 PhoneA accept as Video. 2456 Downgrade Video call on PhoneA and PhoneC to audio only. 2457 Merge call on PhoneA. 2458 Hang up on PhoneB. 2459 Hang up on PhoneC. 2460 """ 2461 return self._test_call_volte_add_mt_video_downgrade_merge_drop(False) 2462 2463 @test_tracker_info(uuid="26b72fda-1a25-47fb-8acb-6f750be8237a") 2464 @TelephonyBaseTest.tel_test_wrap 2465 def test_call_volte_add_mt_video_downgrade_merge_drop_cep(self): 2466 """Conference call 2467 2468 Make Sure PhoneA is in LTE mode (with Video Calling). 2469 Make Sure PhoneB is in LTE mode (with VoLTE). 2470 Make Sure PhoneC is in LTE mode (with Video Calling). 2471 PhoneA VoLTE call to PhoneB. Accept on PhoneB. 2472 PhoneC add a Bi-Directional Video call to PhoneA. 2473 PhoneA accept as Video. 2474 Downgrade Video call on PhoneA and PhoneC to audio only. 2475 Merge call on PhoneA. 2476 Hang up on PhoneB. 2477 Hang up on PhoneC. 2478 """ 2479 return self._test_call_volte_add_mt_video_downgrade_merge_drop(True) 2480 2481 def _test_call_volte_add_mt_video_downgrade_merge_drop(self, use_cep): 2482 # TODO: b/21437650 Test will fail. After established 2nd call ~15s, 2483 # Phone C will drop call. 2484 ads = self.android_devices 2485 self.number_of_devices = 3 2486 tasks = [(phone_setup_video, (self.log, ads[0])), 2487 (phone_setup_volte, (self.log, ads[1])), (phone_setup_video, 2488 (self.log, ads[2]))] 2489 if not multithread_func(self.log, tasks): 2490 self.log.error("Phone Failed to Set Up Properly.") 2491 return False 2492 2493 self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.") 2494 if not call_setup_teardown( 2495 self.log, 2496 ads[0], 2497 ads[1], 2498 None, 2499 verify_caller_func=is_phone_in_call_volte, 2500 verify_callee_func=is_phone_in_call_volte): 2501 self.log.error("Failed to setup a call") 2502 return False 2503 calls = ads[0].droid.telecomCallGetCallIds() 2504 self.log.info("Calls in PhoneA{}".format(calls)) 2505 if num_active_calls(self.log, ads[0]) != 1: 2506 self.log.error("Active call numbers in PhoneA is not 1.") 2507 return False 2508 call_id_voice_ab = calls[0] 2509 2510 self.log.info("Step2: Initiate Video Call PhoneC->PhoneA.") 2511 if not video_call_setup_teardown( 2512 self.log, 2513 ads[2], 2514 ads[0], 2515 None, 2516 video_state=VT_STATE_BIDIRECTIONAL, 2517 verify_caller_func=is_phone_in_call_video_bidirectional, 2518 verify_callee_func=is_phone_in_call_video_bidirectional): 2519 self.log.error("Failed to setup a call") 2520 return False 2521 call_id_video_ac = get_call_id_in_video_state(self.log, ads[0], 2522 VT_STATE_BIDIRECTIONAL) 2523 if call_id_video_ac is None: 2524 self.log.error("No active video call in PhoneA.") 2525 return False 2526 2527 self.log.info( 2528 "Step3: Verify PhoneA's video/voice call in correct state.") 2529 calls = ads[0].droid.telecomCallGetCallIds() 2530 self.log.info("Calls in PhoneA{}".format(calls)) 2531 if num_active_calls(self.log, ads[0]) != 2: 2532 self.log.error("Active call numbers in PhoneA is not 2.") 2533 return False 2534 2535 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2536 return False 2537 if not verify_video_call_in_expected_state( 2538 self.log, ads[0], call_id_video_ac, VT_STATE_BIDIRECTIONAL, 2539 CALL_STATE_ACTIVE): 2540 return False 2541 if not verify_video_call_in_expected_state( 2542 self.log, ads[0], call_id_voice_ab, VT_STATE_AUDIO_ONLY, 2543 CALL_STATE_HOLDING): 2544 return False 2545 2546 self.log.info("Step4: Disable camera on PhoneA and PhoneC.") 2547 if not video_call_downgrade(self.log, ads[0], call_id_video_ac, ads[2], 2548 get_call_id_in_video_state( 2549 self.log, ads[2], 2550 VT_STATE_BIDIRECTIONAL)): 2551 self.log.error("Failed to disable video on PhoneA.") 2552 return False 2553 if not video_call_downgrade(self.log, ads[2], 2554 get_call_id_in_video_state( 2555 self.log, ads[2], VT_STATE_TX_ENABLED), 2556 ads[0], call_id_video_ac): 2557 self.log.error("Failed to disable video on PhoneB.") 2558 return False 2559 2560 self.log.info("Step6: Verify calls in correct state.") 2561 if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True): 2562 return False 2563 if not verify_video_call_in_expected_state( 2564 self.log, ads[0], call_id_video_ac, VT_STATE_AUDIO_ONLY, 2565 CALL_STATE_ACTIVE): 2566 return False 2567 if not verify_video_call_in_expected_state( 2568 self.log, ads[0], call_id_voice_ab, VT_STATE_AUDIO_ONLY, 2569 CALL_STATE_HOLDING): 2570 return False 2571 2572 return { 2573 False: self._test_vt_conference_merge_drop, 2574 True: self._test_vt_conference_merge_drop_cep 2575 }[use_cep](ads, call_id_video_ac, call_id_voice_ab) 2576 2577 @test_tracker_info(uuid="4031040c-d077-4bf1-8a86-82f484693e64") 2578 @TelephonyBaseTest.tel_test_wrap 2579 def test_disable_data_vt_unavailable(self): 2580 """Disable Data, phone should no be able to make VT call. 2581 2582 Make sure PhoneA and PhoneB can make VT call. 2583 Disable Data on PhoneA. 2584 Make sure phoneA report vt_enabled as false. 2585 Attempt to make a VT call from PhoneA to PhoneB, 2586 Verify the call succeed as Voice call. 2587 """ 2588 2589 self.log.info("Step1 Make sure Phones are able make VT call") 2590 ads = self.android_devices 2591 ads[0], ads[1] = ads[1], ads[0] 2592 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 2593 (self.log, ads[1]))] 2594 if not multithread_func(self.log, tasks): 2595 self.log.error("Phone Failed to Set Up Properly.") 2596 return False 2597 2598 try: 2599 self.log.info("Step2 Turn off data and verify not connected.") 2600 ads[0].droid.telephonyToggleDataConnection(False) 2601 if verify_internet_connection(self.log, ads[0]): 2602 self.log.error("Internet Accessible when Disabled") 2603 return False 2604 2605 self.log.info("Step3 Verify vt_enabled return false.") 2606 if wait_for_video_enabled(self.log, ads[0], 2607 MAX_WAIT_TIME_VOLTE_ENABLED): 2608 self.log.error( 2609 "{} failed to <report vt enabled false> for {}s.".format( 2610 ads[0].serial, MAX_WAIT_TIME_VOLTE_ENABLED)) 2611 return False 2612 self.log.info( 2613 "Step4 Attempt to make VT call, verify call is AUDIO_ONLY.") 2614 if not video_call_setup_teardown( 2615 self.log, 2616 ads[0], 2617 ads[1], 2618 ads[0], 2619 video_state=VT_STATE_BIDIRECTIONAL, 2620 verify_caller_func=is_phone_in_call_voice_hd, 2621 verify_callee_func=is_phone_in_call_voice_hd): 2622 self.log.error("Call failed or is not AUDIO_ONLY") 2623 return False 2624 2625 finally: 2626 ads[0].droid.telephonyToggleDataConnection(True) 2627 2628 return True 2629 2630 2631""" Tests End """ 2632