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 import time 18 from acts.test_utils.tel.tel_defines import CALL_PROPERTY_HIGH_DEF_AUDIO 19 from acts.test_utils.tel.tel_defines import CALL_STATE_ACTIVE 20 from acts.test_utils.tel.tel_defines import CALL_STATE_HOLDING 21 from acts.test_utils.tel.tel_defines import GEN_2G 22 from acts.test_utils.tel.tel_defines import GEN_3G 23 from acts.test_utils.tel.tel_defines import GEN_4G 24 from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_NW_SELECTION 25 from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_VOLTE_ENABLED 26 from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_WFC_ENABLED 27 from acts.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA 28 from acts.test_utils.tel.tel_defines import NETWORK_SERVICE_VOICE 29 from acts.test_utils.tel.tel_defines import RAT_FAMILY_CDMA2000 30 from acts.test_utils.tel.tel_defines import RAT_FAMILY_LTE 31 from acts.test_utils.tel.tel_defines import RAT_FAMILY_GSM 32 from acts.test_utils.tel.tel_defines import RAT_FAMILY_WCDMA 33 from acts.test_utils.tel.tel_defines import RAT_FAMILY_WLAN 34 from acts.test_utils.tel.tel_defines import RAT_1XRTT 35 from acts.test_utils.tel.tel_defines import RAT_IWLAN 36 from acts.test_utils.tel.tel_defines import RAT_LTE 37 from acts.test_utils.tel.tel_defines import RAT_UMTS 38 from acts.test_utils.tel.tel_defines import WAIT_TIME_BETWEEN_REG_AND_CALL 39 from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL 40 from acts.test_utils.tel.tel_defines import WAIT_TIME_LEAVE_VOICE_MAIL 41 from acts.test_utils.tel.tel_defines import WFC_MODE_DISABLED 42 from acts.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED 43 from acts.test_utils.tel.tel_defines import NETWORK_MODE_CDMA 44 from acts.test_utils.tel.tel_defines import NETWORK_MODE_GSM_ONLY 45 from acts.test_utils.tel.tel_defines import NETWORK_MODE_GSM_UMTS 46 from acts.test_utils.tel.tel_defines import NETWORK_MODE_LTE_CDMA_EVDO 47 from acts.test_utils.tel.tel_defines import NETWORK_MODE_LTE_GSM_WCDMA 48 from acts.test_utils.tel.tel_subscription_utils import get_outgoing_voice_sub_id 49 from acts.test_utils.tel.tel_subscription_utils import get_default_data_sub_id 50 from acts.test_utils.tel.tel_test_utils import call_reject_leave_message 51 from acts.test_utils.tel.tel_test_utils import call_setup_teardown 52 from acts.test_utils.tel.tel_test_utils import ensure_network_generation 53 from acts.test_utils.tel.tel_test_utils import \ 54 ensure_network_generation_for_subscription 55 from acts.test_utils.tel.tel_test_utils import \ 56 ensure_network_rat_for_subscription 57 from acts.test_utils.tel.tel_test_utils import ensure_phones_idle 58 from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected 59 from acts.test_utils.tel.tel_test_utils import get_network_gen_for_subscription 60 from acts.test_utils.tel.tel_test_utils import get_network_rat 61 from acts.test_utils.tel.tel_test_utils import get_network_rat_for_subscription 62 from acts.test_utils.tel.tel_test_utils import get_telephony_signal_strength 63 from acts.test_utils.tel.tel_test_utils import is_wfc_enabled 64 from acts.test_utils.tel.tel_test_utils import \ 65 reset_preferred_network_type_to_allowable_range 66 from acts.test_utils.tel.tel_test_utils import set_wfc_mode 67 from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode 68 from acts.test_utils.tel.tel_test_utils import toggle_volte 69 from acts.test_utils.tel.tel_test_utils import toggle_volte_for_subscription 70 from acts.test_utils.tel.tel_test_utils import verify_incall_state 71 from acts.test_utils.tel.tel_test_utils import \ 72 wait_for_data_attach_for_subscription 73 from acts.test_utils.tel.tel_test_utils import wait_for_network_generation 74 from acts.test_utils.tel.tel_test_utils import \ 75 wait_for_network_generation_for_subscription 76 from acts.test_utils.tel.tel_test_utils import wait_for_not_network_rat 77 from acts.test_utils.tel.tel_test_utils import wait_for_network_rat 78 from acts.test_utils.tel.tel_test_utils import \ 79 wait_for_network_rat_for_subscription 80 from acts.test_utils.tel.tel_test_utils import \ 81 wait_for_not_network_rat_for_subscription 82 from acts.test_utils.tel.tel_test_utils import wait_for_volte_enabled 83 from acts.test_utils.tel.tel_test_utils import \ 84 wait_for_voice_attach_for_subscription 85 from acts.test_utils.tel.tel_test_utils import wait_for_wfc_enabled 86 from acts.test_utils.tel.tel_test_utils import wait_for_wfc_disabled 87 88 89 def two_phone_call_leave_voice_mail( 90 log, 91 caller, 92 caller_idle_func, 93 caller_in_call_check_func, 94 callee, 95 callee_idle_func, 96 wait_time_in_call=WAIT_TIME_LEAVE_VOICE_MAIL): 97 """Call from caller to callee, reject on callee, caller leave a voice mail. 98 99 1. Caller call Callee. 100 2. Callee reject incoming call. 101 3. Caller leave a voice mail. 102 4. Verify callee received the voice mail notification. 103 104 Args: 105 caller: caller android device object. 106 caller_idle_func: function to check caller's idle state. 107 caller_in_call_check_func: function to check caller's in-call state. 108 callee: callee android device object. 109 callee_idle_func: function to check callee's idle state. 110 wait_time_in_call: time to wait when leaving a voice mail. 111 This is optional, default is WAIT_TIME_LEAVE_VOICE_MAIL 112 113 Returns: 114 True: if voice message is received on callee successfully. 115 False: for errors 116 """ 117 118 ads = [caller, callee] 119 120 # Make sure phones are idle. 121 ensure_phones_idle(log, ads) 122 if caller_idle_func and not caller_idle_func(log, caller): 123 caller.log.error("Caller Failed to Reselect") 124 return False 125 if callee_idle_func and not callee_idle_func(log, callee): 126 callee.log.error("Callee Failed to Reselect") 127 return False 128 129 # TODO: b/26337871 Need to use proper API to check phone registered. 130 time.sleep(WAIT_TIME_BETWEEN_REG_AND_CALL) 131 132 # Make call and leave a message. 133 if not call_reject_leave_message( 134 log, caller, callee, caller_in_call_check_func, wait_time_in_call): 135 log.error("make a call and leave a message failed.") 136 return False 137 return True 138 139 140 def two_phone_call_short_seq(log, 141 phone_a, 142 phone_a_idle_func, 143 phone_a_in_call_check_func, 144 phone_b, 145 phone_b_idle_func, 146 phone_b_in_call_check_func, 147 call_sequence_func=None, 148 wait_time_in_call=WAIT_TIME_IN_CALL): 149 """Call process short sequence. 150 1. Ensure phone idle and in idle_func check return True. 151 2. Call from PhoneA to PhoneB, accept on PhoneB. 152 3. Check phone state, hangup on PhoneA. 153 4. Ensure phone idle and in idle_func check return True. 154 5. Call from PhoneA to PhoneB, accept on PhoneB. 155 6. Check phone state, hangup on PhoneB. 156 157 Args: 158 phone_a: PhoneA's android device object. 159 phone_a_idle_func: function to check PhoneA's idle state. 160 phone_a_in_call_check_func: function to check PhoneA's in-call state. 161 phone_b: PhoneB's android device object. 162 phone_b_idle_func: function to check PhoneB's idle state. 163 phone_b_in_call_check_func: function to check PhoneB's in-call state. 164 call_sequence_func: default parameter, not implemented. 165 wait_time_in_call: time to wait in call. 166 This is optional, default is WAIT_TIME_IN_CALL 167 168 Returns: 169 True: if call sequence succeed. 170 False: for errors 171 """ 172 ads = [phone_a, phone_b] 173 174 call_params = [ 175 (ads[0], ads[1], ads[0], phone_a_in_call_check_func, 176 phone_b_in_call_check_func), 177 (ads[0], ads[1], ads[1], phone_a_in_call_check_func, 178 phone_b_in_call_check_func), 179 ] 180 181 for param in call_params: 182 # Make sure phones are idle. 183 ensure_phones_idle(log, ads) 184 if phone_a_idle_func and not phone_a_idle_func(log, phone_a): 185 phone_a.log.error("Phone A Failed to Reselect") 186 return False 187 if phone_b_idle_func and not phone_b_idle_func(log, phone_b): 188 phone_b.log.error("Phone B Failed to Reselect") 189 return False 190 191 # TODO: b/26337871 Need to use proper API to check phone registered. 192 time.sleep(WAIT_TIME_BETWEEN_REG_AND_CALL) 193 194 # Make call. 195 log.info("---> Call test: %s to %s <---", param[0].serial, 196 param[1].serial) 197 if not call_setup_teardown( 198 log, *param, wait_time_in_call=wait_time_in_call): 199 log.error("Call Iteration Failed") 200 return False 201 202 return True 203 204 205 def two_phone_call_long_seq(log, 206 phone_a, 207 phone_a_idle_func, 208 phone_a_in_call_check_func, 209 phone_b, 210 phone_b_idle_func, 211 phone_b_in_call_check_func, 212 call_sequence_func=None, 213 wait_time_in_call=WAIT_TIME_IN_CALL): 214 """Call process long sequence. 215 1. Ensure phone idle and in idle_func check return True. 216 2. Call from PhoneA to PhoneB, accept on PhoneB. 217 3. Check phone state, hangup on PhoneA. 218 4. Ensure phone idle and in idle_func check return True. 219 5. Call from PhoneA to PhoneB, accept on PhoneB. 220 6. Check phone state, hangup on PhoneB. 221 7. Ensure phone idle and in idle_func check return True. 222 8. Call from PhoneB to PhoneA, accept on PhoneA. 223 9. Check phone state, hangup on PhoneA. 224 10. Ensure phone idle and in idle_func check return True. 225 11. Call from PhoneB to PhoneA, accept on PhoneA. 226 12. Check phone state, hangup on PhoneB. 227 228 Args: 229 phone_a: PhoneA's android device object. 230 phone_a_idle_func: function to check PhoneA's idle state. 231 phone_a_in_call_check_func: function to check PhoneA's in-call state. 232 phone_b: PhoneB's android device object. 233 phone_b_idle_func: function to check PhoneB's idle state. 234 phone_b_in_call_check_func: function to check PhoneB's in-call state. 235 call_sequence_func: default parameter, not implemented. 236 wait_time_in_call: time to wait in call. 237 This is optional, default is WAIT_TIME_IN_CALL 238 239 Returns: 240 True: if call sequence succeed. 241 False: for errors 242 """ 243 ads = [phone_a, phone_b] 244 245 call_params = [ 246 (ads[0], ads[1], ads[0], phone_a_in_call_check_func, 247 phone_b_in_call_check_func), 248 (ads[0], ads[1], ads[1], phone_a_in_call_check_func, 249 phone_b_in_call_check_func), 250 (ads[1], ads[0], ads[0], phone_b_in_call_check_func, 251 phone_a_in_call_check_func), 252 (ads[1], ads[0], ads[1], phone_b_in_call_check_func, 253 phone_a_in_call_check_func), 254 ] 255 256 for param in call_params: 257 # Make sure phones are idle. 258 ensure_phones_idle(log, ads) 259 if phone_a_idle_func and not phone_a_idle_func(log, phone_a): 260 phone_a.log.error("Phone A Failed to Reselect") 261 return False 262 if phone_b_idle_func and not phone_b_idle_func(log, phone_b): 263 phone_b.log.error("Phone B Failed to Reselect") 264 return False 265 266 # TODO: b/26337871 Need to use proper API to check phone registered. 267 time.sleep(WAIT_TIME_BETWEEN_REG_AND_CALL) 268 269 # Make call. 270 log.info("---> Call test: %s to %s <---", param[0].serial, 271 param[1].serial) 272 if not call_setup_teardown( 273 log, *param, wait_time_in_call=wait_time_in_call): 274 log.error("Call Iteration Failed") 275 return False 276 277 return True 278 279 280 def phone_setup_iwlan(log, 281 ad, 282 is_airplane_mode, 283 wfc_mode, 284 wifi_ssid=None, 285 wifi_pwd=None): 286 """Phone setup function for epdg call test. 287 Set WFC mode according to wfc_mode. 288 Set airplane mode according to is_airplane_mode. 289 Make sure phone connect to WiFi. (If wifi_ssid is not None.) 290 Wait for phone to be in iwlan data network type. 291 Wait for phone to report wfc enabled flag to be true. 292 293 Args: 294 log: Log object. 295 ad: Android device object. 296 is_airplane_mode: True to turn on airplane mode. False to turn off airplane mode. 297 wfc_mode: WFC mode to set to. 298 wifi_ssid: WiFi network SSID. This is optional. 299 If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. 300 wifi_pwd: WiFi network password. This is optional. 301 302 Returns: 303 True if success. False if fail. 304 """ 305 return phone_setup_iwlan_for_subscription(log, ad, 306 get_outgoing_voice_sub_id(ad), 307 is_airplane_mode, wfc_mode, 308 wifi_ssid, wifi_pwd) 309 310 311 def phone_setup_iwlan_for_subscription(log, 312 ad, 313 sub_id, 314 is_airplane_mode, 315 wfc_mode, 316 wifi_ssid=None, 317 wifi_pwd=None): 318 """Phone setup function for epdg call test for subscription id. 319 Set WFC mode according to wfc_mode. 320 Set airplane mode according to is_airplane_mode. 321 Make sure phone connect to WiFi. (If wifi_ssid is not None.) 322 Wait for phone to be in iwlan data network type. 323 Wait for phone to report wfc enabled flag to be true. 324 325 Args: 326 log: Log object. 327 ad: Android device object. 328 sub_id: subscription id. 329 is_airplane_mode: True to turn on airplane mode. False to turn off airplane mode. 330 wfc_mode: WFC mode to set to. 331 wifi_ssid: WiFi network SSID. This is optional. 332 If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. 333 wifi_pwd: WiFi network password. This is optional. 334 335 Returns: 336 True if success. False if fail. 337 """ 338 toggle_airplane_mode(log, ad, is_airplane_mode, strict_checking=False) 339 340 # check if WFC supported phones 341 if wfc_mode != WFC_MODE_DISABLED and not ad.droid.imsIsWfcEnabledByPlatform( 342 ): 343 ad.log.error("WFC is not enabled on this device by checking " 344 "ImsManager.isWfcEnabledByPlatform") 345 return False 346 347 if wifi_ssid is not None: 348 if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd): 349 ad.log.error("Fail to connect to WiFi %s.", wifi_ssid) 350 return False 351 352 if not set_wfc_mode(log, ad, wfc_mode): 353 ad.log.error("Unable to set WFC mode to %s.", wfc_mode) 354 return False 355 356 if not wait_for_wfc_enabled(log, ad, max_time=MAX_WAIT_TIME_WFC_ENABLED): 357 ad.log.error("WFC is not enabled") 358 return False 359 360 if wait_for_network_rat_for_subscription( 361 log, ad, sub_id, RAT_FAMILY_WLAN, 362 voice_or_data=NETWORK_SERVICE_DATA): 363 ad.log.info( 364 "Data rat is in iwlan mode successfully with APM %s WFC %s", 365 is_airplane_mode, wfc_mode) 366 return True 367 else: 368 ad.log.error( 369 "Unable to bring data rat in iwlan mode with APM %s WFC %s", 370 is_airplane_mode, wfc_mode) 371 return False 372 373 374 def phone_setup_iwlan_cellular_preferred(log, 375 ad, 376 wifi_ssid=None, 377 wifi_pwd=None): 378 """Phone setup function for iwlan Non-APM CELLULAR_PREFERRED test. 379 Set WFC mode according to CELLULAR_PREFERRED. 380 Set airplane mode according to False. 381 Make sure phone connect to WiFi. (If wifi_ssid is not None.) 382 Make sure phone don't report iwlan data network type. 383 Make sure phone don't report wfc enabled flag to be true. 384 385 Args: 386 log: Log object. 387 ad: Android device object. 388 wifi_ssid: WiFi network SSID. This is optional. 389 If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. 390 wifi_pwd: WiFi network password. This is optional. 391 392 Returns: 393 True if success. False if fail. 394 """ 395 toggle_airplane_mode(log, ad, False, strict_checking=False) 396 try: 397 toggle_volte(log, ad, True) 398 if not wait_for_network_generation( 399 log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 400 if not ensure_network_generation( 401 log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 402 ad.log.error("Fail to ensure data in 4G") 403 return False 404 except Exception as e: 405 ad.log.error(e) 406 ad.droid.telephonyToggleDataConnection(True) 407 if not set_wfc_mode(log, ad, WFC_MODE_CELLULAR_PREFERRED): 408 ad.log.error("Set WFC mode failed.") 409 return False 410 if wifi_ssid is not None: 411 if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd): 412 ad.log.error("Connect to WiFi failed.") 413 return False 414 if not wait_for_not_network_rat( 415 log, ad, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA): 416 ad.log.error("Data rat in iwlan mode.") 417 return False 418 elif not wait_for_wfc_disabled(log, ad, MAX_WAIT_TIME_WFC_ENABLED): 419 ad.log.error("Should report wifi calling disabled within %s.", 420 MAX_WAIT_TIME_WFC_ENABLED) 421 return False 422 return True 423 424 425 def phone_setup_data_for_subscription(log, ad, sub_id, network_generation): 426 """Setup Phone <sub_id> Data to <network_generation> 427 428 Args: 429 log: log object 430 ad: android device object 431 sub_id: subscription id 432 network_generation: network generation, e.g. GEN_2G, GEN_3G, GEN_4G 433 434 Returns: 435 True if success, False if fail. 436 """ 437 toggle_airplane_mode(log, ad, False, strict_checking=False) 438 if not set_wfc_mode(log, ad, WFC_MODE_DISABLED): 439 ad.log.error("Disable WFC failed.") 440 return False 441 if not ensure_network_generation_for_subscription( 442 log, 443 ad, 444 sub_id, 445 network_generation, 446 voice_or_data=NETWORK_SERVICE_DATA): 447 get_telephony_signal_strength(ad) 448 return False 449 return True 450 451 452 def phone_setup_4g(log, ad): 453 """Setup Phone default data sub_id data to 4G. 454 455 Args: 456 log: log object 457 ad: android device object 458 459 Returns: 460 True if success, False if fail. 461 """ 462 return phone_setup_4g_for_subscription(log, ad, 463 get_default_data_sub_id(ad)) 464 465 466 def phone_setup_4g_for_subscription(log, ad, sub_id): 467 """Setup Phone <sub_id> Data to 4G. 468 469 Args: 470 log: log object 471 ad: android device object 472 sub_id: subscription id 473 474 Returns: 475 True if success, False if fail. 476 """ 477 return phone_setup_data_for_subscription(log, ad, sub_id, GEN_4G) 478 479 480 def phone_setup_3g(log, ad): 481 """Setup Phone default data sub_id data to 3G. 482 483 Args: 484 log: log object 485 ad: android device object 486 487 Returns: 488 True if success, False if fail. 489 """ 490 return phone_setup_3g_for_subscription(log, ad, 491 get_default_data_sub_id(ad)) 492 493 494 def phone_setup_3g_for_subscription(log, ad, sub_id): 495 """Setup Phone <sub_id> Data to 3G. 496 497 Args: 498 log: log object 499 ad: android device object 500 sub_id: subscription id 501 502 Returns: 503 True if success, False if fail. 504 """ 505 return phone_setup_data_for_subscription(log, ad, sub_id, GEN_3G) 506 507 508 def phone_setup_2g(log, ad): 509 """Setup Phone default data sub_id data to 2G. 510 511 Args: 512 log: log object 513 ad: android device object 514 515 Returns: 516 True if success, False if fail. 517 """ 518 return phone_setup_2g_for_subscription(log, ad, 519 get_default_data_sub_id(ad)) 520 521 522 def phone_setup_2g_for_subscription(log, ad, sub_id): 523 """Setup Phone <sub_id> Data to 3G. 524 525 Args: 526 log: log object 527 ad: android device object 528 sub_id: subscription id 529 530 Returns: 531 True if success, False if fail. 532 """ 533 return phone_setup_data_for_subscription(log, ad, sub_id, GEN_2G) 534 535 536 def phone_setup_csfb(log, ad): 537 """Setup phone for CSFB call test. 538 539 Setup Phone to be in 4G mode. 540 Disabled VoLTE. 541 542 Args: 543 log: log object 544 ad: Android device object. 545 546 Returns: 547 True if setup successfully. 548 False for errors. 549 """ 550 return phone_setup_csfb_for_subscription(log, ad, 551 get_outgoing_voice_sub_id(ad)) 552 553 554 def phone_setup_csfb_for_subscription(log, ad, sub_id): 555 """Setup phone for CSFB call test for subscription id. 556 557 Setup Phone to be in 4G mode. 558 Disabled VoLTE. 559 560 Args: 561 log: log object 562 ad: Android device object. 563 sub_id: subscription id. 564 565 Returns: 566 True if setup successfully. 567 False for errors. 568 """ 569 if not phone_setup_4g_for_subscription(log, ad, sub_id): 570 ad.log.error("Failed to set to 4G data.") 571 return False 572 if ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform(): 573 toggle_volte(log, ad, False) 574 if not ensure_network_generation_for_subscription( 575 log, ad, sub_id, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 576 return False 577 578 if not wait_for_voice_attach_for_subscription(log, ad, sub_id, 579 MAX_WAIT_TIME_NW_SELECTION): 580 return False 581 582 return phone_idle_csfb_for_subscription(log, ad, sub_id) 583 584 585 def phone_setup_volte(log, ad): 586 """Setup VoLTE enable. 587 588 Args: 589 log: log object 590 ad: android device object. 591 592 Returns: 593 True: if VoLTE is enabled successfully. 594 False: for errors 595 """ 596 return phone_setup_volte_for_subscription(log, ad, 597 get_outgoing_voice_sub_id(ad)) 598 599 600 def phone_setup_volte_for_subscription(log, ad, sub_id): 601 """Setup VoLTE enable for subscription id. 602 603 Args: 604 log: log object 605 ad: android device object. 606 sub_id: subscription id. 607 608 Returns: 609 True: if VoLTE is enabled successfully. 610 False: for errors 611 """ 612 if not phone_setup_4g_for_subscription(log, ad, sub_id): 613 ad.log.error("Failed to set to 4G data.") 614 return False 615 toggle_volte_for_subscription(log, ad, sub_id, True) 616 return phone_idle_volte_for_subscription(log, ad, sub_id) 617 618 619 def phone_setup_voice_3g(log, ad): 620 """Setup phone voice to 3G. 621 622 Args: 623 log: log object 624 ad: Android device object. 625 626 Returns: 627 True if setup successfully. 628 False for errors. 629 """ 630 return phone_setup_voice_3g_for_subscription(log, ad, 631 get_outgoing_voice_sub_id(ad)) 632 633 634 def phone_setup_voice_3g_for_subscription(log, ad, sub_id): 635 """Setup phone voice to 3G for subscription id. 636 637 Args: 638 log: log object 639 ad: Android device object. 640 sub_id: subscription id. 641 642 Returns: 643 True if setup successfully. 644 False for errors. 645 """ 646 if not phone_setup_3g_for_subscription(log, ad, sub_id): 647 ad.log.error("Failed to set to 3G data.") 648 return False 649 if not wait_for_voice_attach_for_subscription(log, ad, sub_id, 650 MAX_WAIT_TIME_NW_SELECTION): 651 return False 652 return phone_idle_3g_for_subscription(log, ad, sub_id) 653 654 655 def phone_setup_voice_2g(log, ad): 656 """Setup phone voice to 2G. 657 658 Args: 659 log: log object 660 ad: Android device object. 661 662 Returns: 663 True if setup successfully. 664 False for errors. 665 """ 666 return phone_setup_voice_2g_for_subscription(log, ad, 667 get_outgoing_voice_sub_id(ad)) 668 669 670 def phone_setup_voice_2g_for_subscription(log, ad, sub_id): 671 """Setup phone voice to 2G for subscription id. 672 673 Args: 674 log: log object 675 ad: Android device object. 676 sub_id: subscription id. 677 678 Returns: 679 True if setup successfully. 680 False for errors. 681 """ 682 if not phone_setup_2g_for_subscription(log, ad, sub_id): 683 ad.log.error("Failed to set to 2G data.") 684 return False 685 if not wait_for_voice_attach_for_subscription(log, ad, sub_id, 686 MAX_WAIT_TIME_NW_SELECTION): 687 return False 688 return phone_idle_2g_for_subscription(log, ad, sub_id) 689 690 691 def phone_setup_voice_general(log, ad): 692 """Setup phone for voice general call test. 693 694 Make sure phone attached to voice. 695 Make necessary delay. 696 697 Args: 698 ad: Android device object. 699 700 Returns: 701 True if setup successfully. 702 False for errors. 703 """ 704 return phone_setup_voice_general_for_subscription( 705 log, ad, get_outgoing_voice_sub_id(ad)) 706 707 708 def phone_setup_voice_general_for_subscription(log, ad, sub_id): 709 """Setup phone for voice general call test for subscription id. 710 711 Make sure phone attached to voice. 712 Make necessary delay. 713 714 Args: 715 ad: Android device object. 716 sub_id: subscription id. 717 718 Returns: 719 True if setup successfully. 720 False for errors. 721 """ 722 toggle_airplane_mode(log, ad, False, strict_checking=False) 723 if not wait_for_voice_attach_for_subscription(log, ad, sub_id, 724 MAX_WAIT_TIME_NW_SELECTION): 725 # if phone can not attach voice, try phone_setup_voice_3g 726 return phone_setup_voice_3g_for_subscription(log, ad, sub_id) 727 return True 728 729 730 def phone_setup_data_general(log, ad): 731 """Setup phone for data general test. 732 733 Make sure phone attached to data. 734 Make necessary delay. 735 736 Args: 737 ad: Android device object. 738 739 Returns: 740 True if setup successfully. 741 False for errors. 742 """ 743 return phone_setup_data_general_for_subscription( 744 log, ad, ad.droid.subscriptionGetDefaultDataSubId()) 745 746 747 def phone_setup_data_general_for_subscription(log, ad, sub_id): 748 """Setup phone for data general test for subscription id. 749 750 Make sure phone attached to data. 751 Make necessary delay. 752 753 Args: 754 ad: Android device object. 755 sub_id: subscription id. 756 757 Returns: 758 True if setup successfully. 759 False for errors. 760 """ 761 toggle_airplane_mode(log, ad, False, strict_checking=False) 762 if not wait_for_data_attach_for_subscription(log, ad, sub_id, 763 MAX_WAIT_TIME_NW_SELECTION): 764 # if phone can not attach data, try reset network preference settings 765 reset_preferred_network_type_to_allowable_range(log, ad) 766 767 return wait_for_data_attach_for_subscription(log, ad, sub_id, 768 MAX_WAIT_TIME_NW_SELECTION) 769 770 771 def phone_setup_rat_for_subscription(log, ad, sub_id, network_preference, 772 rat_family): 773 toggle_airplane_mode(log, ad, False, strict_checking=False) 774 if not set_wfc_mode(log, ad, WFC_MODE_DISABLED): 775 ad.log.error("Disable WFC failed.") 776 return False 777 return ensure_network_rat_for_subscription(log, ad, sub_id, 778 network_preference, rat_family) 779 780 781 def phone_setup_lte_gsm_wcdma(log, ad): 782 return phone_setup_lte_gsm_wcdma_for_subscription( 783 log, ad, ad.droid.subscriptionGetDefaultSubId()) 784 785 786 def phone_setup_lte_gsm_wcdma_for_subscription(log, ad, sub_id): 787 return phone_setup_rat_for_subscription( 788 log, ad, sub_id, NETWORK_MODE_LTE_GSM_WCDMA, RAT_FAMILY_LTE) 789 790 791 def phone_setup_gsm_umts(log, ad): 792 return phone_setup_gsm_umts_for_subscription( 793 log, ad, ad.droid.subscriptionGetDefaultSubId()) 794 795 796 def phone_setup_gsm_umts_for_subscription(log, ad, sub_id): 797 return phone_setup_rat_for_subscription( 798 log, ad, sub_id, NETWORK_MODE_GSM_UMTS, RAT_FAMILY_WCDMA) 799 800 801 def phone_setup_gsm_only(log, ad): 802 return phone_setup_gsm_only_for_subscription( 803 log, ad, ad.droid.subscriptionGetDefaultSubId()) 804 805 806 def phone_setup_gsm_only_for_subscription(log, ad, sub_id): 807 return phone_setup_rat_for_subscription( 808 log, ad, sub_id, NETWORK_MODE_GSM_ONLY, RAT_FAMILY_GSM) 809 810 811 def phone_setup_lte_cdma_evdo(log, ad): 812 return phone_setup_lte_cdma_evdo_for_subscription( 813 log, ad, ad.droid.subscriptionGetDefaultSubId()) 814 815 816 def phone_setup_lte_cdma_evdo_for_subscription(log, ad, sub_id): 817 return phone_setup_rat_for_subscription( 818 log, ad, sub_id, NETWORK_MODE_LTE_CDMA_EVDO, RAT_FAMILY_LTE) 819 820 821 def phone_setup_cdma(log, ad): 822 return phone_setup_cdma_for_subscription( 823 log, ad, ad.droid.subscriptionGetDefaultSubId()) 824 825 826 def phone_setup_cdma_for_subscription(log, ad, sub_id): 827 return phone_setup_rat_for_subscription(log, ad, sub_id, NETWORK_MODE_CDMA, 828 RAT_FAMILY_CDMA2000) 829 830 831 def phone_idle_volte(log, ad): 832 """Return if phone is idle for VoLTE call test. 833 834 Args: 835 ad: Android device object. 836 """ 837 return phone_idle_volte_for_subscription(log, ad, 838 get_outgoing_voice_sub_id(ad)) 839 840 841 def phone_idle_volte_for_subscription(log, ad, sub_id): 842 """Return if phone is idle for VoLTE call test for subscription id. 843 844 Args: 845 ad: Android device object. 846 sub_id: subscription id. 847 """ 848 if not wait_for_network_rat_for_subscription( 849 log, ad, sub_id, RAT_FAMILY_LTE, 850 voice_or_data=NETWORK_SERVICE_VOICE): 851 ad.log.error("Voice rat not in LTE mode.") 852 return False 853 if not wait_for_volte_enabled(log, ad, MAX_WAIT_TIME_VOLTE_ENABLED): 854 ad.log.error( 855 "Failed to <report volte enabled true> within %s seconds.", 856 MAX_WAIT_TIME_VOLTE_ENABLED) 857 return False 858 return True 859 860 861 def phone_idle_iwlan(log, ad): 862 """Return if phone is idle for WiFi calling call test. 863 864 Args: 865 ad: Android device object. 866 """ 867 return phone_idle_iwlan_for_subscription(log, ad, 868 get_outgoing_voice_sub_id(ad)) 869 870 871 def phone_idle_iwlan_for_subscription(log, ad, sub_id): 872 """Return if phone is idle for WiFi calling call test for subscription id. 873 874 Args: 875 ad: Android device object. 876 sub_id: subscription id. 877 """ 878 if not wait_for_network_rat_for_subscription( 879 log, ad, sub_id, RAT_FAMILY_WLAN, 880 voice_or_data=NETWORK_SERVICE_DATA): 881 ad.log.error("data rat not in iwlan mode.") 882 return False 883 if not wait_for_wfc_enabled(log, ad, MAX_WAIT_TIME_WFC_ENABLED): 884 ad.log.error("Failed to <report wfc enabled true> within %s seconds.", 885 MAX_WAIT_TIME_WFC_ENABLED) 886 return False 887 return True 888 889 890 def phone_idle_not_iwlan(log, ad): 891 """Return if phone is idle for non WiFi calling call test. 892 893 Args: 894 ad: Android device object. 895 """ 896 return phone_idle_not_iwlan_for_subscription(log, ad, 897 get_outgoing_voice_sub_id(ad)) 898 899 900 def phone_idle_not_iwlan_for_subscription(log, ad, sub_id): 901 """Return if phone is idle for non WiFi calling call test for sub id. 902 903 Args: 904 ad: Android device object. 905 sub_id: subscription id. 906 """ 907 if not wait_for_not_network_rat_for_subscription( 908 log, ad, sub_id, RAT_FAMILY_WLAN, 909 voice_or_data=NETWORK_SERVICE_DATA): 910 log.error("{} data rat in iwlan mode.".format(ad.serial)) 911 return False 912 return True 913 914 915 def phone_idle_csfb(log, ad): 916 """Return if phone is idle for CSFB call test. 917 918 Args: 919 ad: Android device object. 920 """ 921 return phone_idle_csfb_for_subscription(log, ad, 922 get_outgoing_voice_sub_id(ad)) 923 924 925 def phone_idle_csfb_for_subscription(log, ad, sub_id): 926 """Return if phone is idle for CSFB call test for subscription id. 927 928 Args: 929 ad: Android device object. 930 sub_id: subscription id. 931 """ 932 if not wait_for_network_rat_for_subscription( 933 log, ad, sub_id, RAT_FAMILY_LTE, 934 voice_or_data=NETWORK_SERVICE_DATA): 935 ad.log.error("Data rat not in lte mode.") 936 return False 937 return True 938 939 940 def phone_idle_3g(log, ad): 941 """Return if phone is idle for 3G call test. 942 943 Args: 944 ad: Android device object. 945 """ 946 return phone_idle_3g_for_subscription(log, ad, 947 get_outgoing_voice_sub_id(ad)) 948 949 950 def phone_idle_3g_for_subscription(log, ad, sub_id): 951 """Return if phone is idle for 3G call test for subscription id. 952 953 Args: 954 ad: Android device object. 955 sub_id: subscription id. 956 """ 957 return wait_for_network_generation_for_subscription( 958 log, ad, sub_id, GEN_3G, voice_or_data=NETWORK_SERVICE_VOICE) 959 960 961 def phone_idle_2g(log, ad): 962 """Return if phone is idle for 2G call test. 963 964 Args: 965 ad: Android device object. 966 """ 967 return phone_idle_2g_for_subscription(log, ad, 968 get_outgoing_voice_sub_id(ad)) 969 970 971 def phone_idle_2g_for_subscription(log, ad, sub_id): 972 """Return if phone is idle for 2G call test for subscription id. 973 974 Args: 975 ad: Android device object. 976 sub_id: subscription id. 977 """ 978 return wait_for_network_generation_for_subscription( 979 log, ad, sub_id, GEN_2G, voice_or_data=NETWORK_SERVICE_VOICE) 980 981 def get_current_voice_rat(log, ad): 982 """Return current Voice RAT 983 984 Args: 985 ad: Android device object. 986 """ 987 return get_current_voice_rat_for_subscription( 988 log, ad, get_outgoing_voice_sub_id(ad)) 989 990 def get_current_voice_rat_for_subscription(log, ad, sub_id): 991 """Return current Voice RAT for subscription id. 992 993 Args: 994 ad: Android device object. 995 sub_id: subscription id. 996 """ 997 return get_network_rat_for_subscription(log, ad, sub_id, 998 NETWORK_SERVICE_VOICE) 999 1000 def is_phone_in_call_volte(log, ad): 1001 """Return if phone is in VoLTE call. 1002 1003 Args: 1004 ad: Android device object. 1005 """ 1006 return is_phone_in_call_volte_for_subscription( 1007 log, ad, get_outgoing_voice_sub_id(ad)) 1008 1009 1010 def is_phone_in_call_volte_for_subscription(log, ad, sub_id): 1011 """Return if phone is in VoLTE call for subscription id. 1012 1013 Args: 1014 ad: Android device object. 1015 sub_id: subscription id. 1016 """ 1017 if not ad.droid.telecomIsInCall(): 1018 ad.log.error("Not in call.") 1019 return False 1020 nw_type = get_network_rat_for_subscription(log, ad, sub_id, 1021 NETWORK_SERVICE_VOICE) 1022 if nw_type != RAT_LTE: 1023 ad.log.error("Voice rat on: %s. Expected: LTE", nw_type) 1024 return False 1025 return True 1026 1027 1028 def is_phone_in_call_csfb(log, ad): 1029 """Return if phone is in CSFB call. 1030 1031 Args: 1032 ad: Android device object. 1033 """ 1034 return is_phone_in_call_csfb_for_subscription( 1035 log, ad, get_outgoing_voice_sub_id(ad)) 1036 1037 1038 def is_phone_in_call_csfb_for_subscription(log, ad, sub_id): 1039 """Return if phone is in CSFB call for subscription id. 1040 1041 Args: 1042 ad: Android device object. 1043 sub_id: subscription id. 1044 """ 1045 if not ad.droid.telecomIsInCall(): 1046 ad.log.error("Not in call.") 1047 return False 1048 nw_type = get_network_rat_for_subscription(log, ad, sub_id, 1049 NETWORK_SERVICE_VOICE) 1050 if nw_type == RAT_LTE: 1051 ad.log.error("Voice rat on: %s. Expected: not LTE", nw_type) 1052 return False 1053 return True 1054 1055 1056 def is_phone_in_call_3g(log, ad): 1057 """Return if phone is in 3G call. 1058 1059 Args: 1060 ad: Android device object. 1061 """ 1062 return is_phone_in_call_3g_for_subscription(log, ad, 1063 get_outgoing_voice_sub_id(ad)) 1064 1065 1066 def is_phone_in_call_3g_for_subscription(log, ad, sub_id): 1067 """Return if phone is in 3G call for subscription id. 1068 1069 Args: 1070 ad: Android device object. 1071 sub_id: subscription id. 1072 """ 1073 if not ad.droid.telecomIsInCall(): 1074 ad.log.error("Not in call.") 1075 return False 1076 nw_gen = get_network_gen_for_subscription(log, ad, sub_id, 1077 NETWORK_SERVICE_VOICE) 1078 if nw_gen != GEN_3G: 1079 ad.log.error("Voice rat on: %s. Expected: 3g", nw_gen) 1080 return False 1081 return True 1082 1083 1084 def is_phone_in_call_2g(log, ad): 1085 """Return if phone is in 2G call. 1086 1087 Args: 1088 ad: Android device object. 1089 """ 1090 return is_phone_in_call_2g_for_subscription(log, ad, 1091 get_outgoing_voice_sub_id(ad)) 1092 1093 1094 def is_phone_in_call_2g_for_subscription(log, ad, sub_id): 1095 """Return if phone is in 2G call for subscription id. 1096 1097 Args: 1098 ad: Android device object. 1099 sub_id: subscription id. 1100 """ 1101 if not ad.droid.telecomIsInCall(): 1102 ad.log.error("Not in call.") 1103 return False 1104 nw_gen = get_network_gen_for_subscription(log, ad, sub_id, 1105 NETWORK_SERVICE_VOICE) 1106 if nw_gen != GEN_2G: 1107 ad.log.error("Voice rat on: %s. Expected: 2g", nw_gen) 1108 return False 1109 return True 1110 1111 1112 def is_phone_in_call_1x(log, ad): 1113 """Return if phone is in 1x call. 1114 1115 Args: 1116 ad: Android device object. 1117 """ 1118 return is_phone_in_call_1x_for_subscription(log, ad, 1119 get_outgoing_voice_sub_id(ad)) 1120 1121 1122 def is_phone_in_call_1x_for_subscription(log, ad, sub_id): 1123 """Return if phone is in 1x call for subscription id. 1124 1125 Args: 1126 ad: Android device object. 1127 sub_id: subscription id. 1128 """ 1129 if not ad.droid.telecomIsInCall(): 1130 ad.log.error("Not in call.") 1131 return False 1132 nw_type = get_network_rat_for_subscription(log, ad, sub_id, 1133 NETWORK_SERVICE_VOICE) 1134 if nw_type != RAT_1XRTT: 1135 ad.log.error("Voice rat on: %s. Expected: 1xrtt", nw_type) 1136 return False 1137 return True 1138 1139 1140 def is_phone_in_call_wcdma(log, ad): 1141 """Return if phone is in WCDMA call. 1142 1143 Args: 1144 ad: Android device object. 1145 """ 1146 return is_phone_in_call_wcdma_for_subscription( 1147 log, ad, get_outgoing_voice_sub_id(ad)) 1148 1149 1150 def is_phone_in_call_wcdma_for_subscription(log, ad, sub_id): 1151 """Return if phone is in WCDMA call for subscription id. 1152 1153 Args: 1154 ad: Android device object. 1155 sub_id: subscription id. 1156 """ 1157 # Currently checking 'umts'. 1158 # Changes may needed in the future. 1159 if not ad.droid.telecomIsInCall(): 1160 ad.log.error("Not in call.") 1161 return False 1162 nw_type = get_network_rat_for_subscription(log, ad, sub_id, 1163 NETWORK_SERVICE_VOICE) 1164 if nw_type != RAT_UMTS: 1165 ad.log.error("%s voice rat on: %s. Expected: umts", nw_type) 1166 return False 1167 return True 1168 1169 1170 def is_phone_in_call_iwlan(log, ad): 1171 """Return if phone is in WiFi call. 1172 1173 Args: 1174 ad: Android device object. 1175 """ 1176 if not ad.droid.telecomIsInCall(): 1177 ad.log.error("Not in call.") 1178 return False 1179 nw_type = get_network_rat(log, ad, NETWORK_SERVICE_DATA) 1180 if nw_type != RAT_IWLAN: 1181 ad.log.error("Data rat on: %s. Expected: iwlan", nw_type) 1182 return False 1183 if not is_wfc_enabled(log, ad): 1184 ad.log.error("WiFi Calling feature bit is False.") 1185 return False 1186 return True 1187 1188 1189 def is_phone_in_call_not_iwlan(log, ad): 1190 """Return if phone is in WiFi call for subscription id. 1191 1192 Args: 1193 ad: Android device object. 1194 sub_id: subscription id. 1195 """ 1196 if not ad.droid.telecomIsInCall(): 1197 ad.log.error("Not in call.") 1198 return False 1199 nw_type = get_network_rat(log, ad, NETWORK_SERVICE_DATA) 1200 if nw_type == RAT_IWLAN: 1201 ad.log.error("Data rat on: %s. Expected: not iwlan", nw_type) 1202 return False 1203 if is_wfc_enabled(log, ad): 1204 ad.log.error("WiFi Calling feature bit is True.") 1205 return False 1206 return True 1207 1208 1209 def swap_calls(log, 1210 ads, 1211 call_hold_id, 1212 call_active_id, 1213 num_swaps=1, 1214 check_call_status=True): 1215 """PhoneA in call with B and C. Swap active/holding call on PhoneA. 1216 1217 Swap call and check status on PhoneA. 1218 (This step may have multiple times according to 'num_swaps'.) 1219 Check if all 3 phones are 'in-call'. 1220 1221 Args: 1222 ads: list of ad object, at least three need to pass in. 1223 Swap operation will happen on ads[0]. 1224 ads[1] and ads[2] are call participants. 1225 call_hold_id: id for the holding call in ads[0]. 1226 call_hold_id should be 'STATE_HOLDING' when calling this function. 1227 call_active_id: id for the active call in ads[0]. 1228 call_active_id should be 'STATE_ACTIVE' when calling this function. 1229 num_swaps: how many swap/check operations will be done before return. 1230 check_call_status: This is optional. Default value is True. 1231 If this value is True, then call status (active/hold) will be 1232 be checked after each swap operation. 1233 1234 Returns: 1235 If no error happened, return True, otherwise, return False. 1236 """ 1237 if check_call_status: 1238 # Check status before swap. 1239 if ads[0].droid.telecomCallGetCallState( 1240 call_active_id) != CALL_STATE_ACTIVE: 1241 ads[0].log.error( 1242 "Call_id:%s, state:%s, expected: STATE_ACTIVE", call_active_id, 1243 ads[0].droid.telecomCallGetCallState(call_active_id)) 1244 return False 1245 if ads[0].droid.telecomCallGetCallState( 1246 call_hold_id) != CALL_STATE_HOLDING: 1247 ads[0].log.error( 1248 "Call_id:%s, state:%s, expected: STATE_HOLDING", call_hold_id, 1249 ads[0].droid.telecomCallGetCallState(call_hold_id)) 1250 return False 1251 1252 i = 1 1253 while (i <= num_swaps): 1254 ads[0].log.info("swap_test %s: swap and check call status.", i) 1255 ads[0].droid.telecomCallHold(call_active_id) 1256 time.sleep(WAIT_TIME_IN_CALL) 1257 # Swap object reference 1258 call_active_id, call_hold_id = call_hold_id, call_active_id 1259 if check_call_status: 1260 # Check status 1261 if ads[0].droid.telecomCallGetCallState( 1262 call_active_id) != CALL_STATE_ACTIVE: 1263 ads[0].log.error( 1264 "Call_id:%s, state:%s, expected: STATE_ACTIVE", 1265 call_active_id, 1266 ads[0].droid.telecomCallGetCallState(call_active_id)) 1267 return False 1268 if ads[0].droid.telecomCallGetCallState( 1269 call_hold_id) != CALL_STATE_HOLDING: 1270 ads[0].log.error( 1271 "Call_id:%s, state:%s, expected: STATE_HOLDING", 1272 call_hold_id, 1273 ads[0].droid.telecomCallGetCallState(call_hold_id)) 1274 return False 1275 # TODO: b/26296375 add voice check. 1276 1277 i += 1 1278 1279 #In the end, check all three phones are 'in-call'. 1280 if not verify_incall_state(log, [ads[0], ads[1], ads[2]], True): 1281 return False 1282 1283 return True 1284 1285 1286 def get_audio_route(log, ad): 1287 """Gets the audio route for the active call 1288 1289 Args: 1290 log: logger object 1291 ad: android_device object 1292 1293 Returns: 1294 Audio route string ["BLUETOOTH", "EARPIECE", "SPEAKER", "WIRED_HEADSET" 1295 "WIRED_OR_EARPIECE"] 1296 """ 1297 1298 audio_state = ad.droid.telecomCallGetAudioState() 1299 return audio_state["AudioRoute"] 1300 1301 1302 def set_audio_route(log, ad, route): 1303 """Sets the audio route for the active call 1304 1305 Args: 1306 log: logger object 1307 ad: android_device object 1308 route: string ["BLUETOOTH", "EARPIECE", "SPEAKER", "WIRED_HEADSET" 1309 "WIRED_OR_EARPIECE"] 1310 1311 Returns: 1312 If no error happened, return True, otherwise, return False. 1313 """ 1314 ad.droid.telecomCallSetAudioRoute(route) 1315 return True 1316 1317 1318 def is_property_in_call_properties(log, ad, call_id, expected_property): 1319 """Return if the call_id has the expected property 1320 1321 Args: 1322 log: logger object 1323 ad: android_device object 1324 call_id: call id. 1325 expected_property: expected property. 1326 1327 Returns: 1328 True if call_id has expected_property. False if not. 1329 """ 1330 properties = ad.droid.telecomCallGetProperties(call_id) 1331 return (expected_property in properties) 1332 1333 1334 def is_call_hd(log, ad, call_id): 1335 """Return if the call_id is HD call. 1336 1337 Args: 1338 log: logger object 1339 ad: android_device object 1340 call_id: call id. 1341 1342 Returns: 1343 True if call_id is HD call. False if not. 1344 """ 1345 return is_property_in_call_properties(log, ad, call_id, 1346 CALL_PROPERTY_HIGH_DEF_AUDIO) 1347 1348 1349 def get_cep_conference_call_id(ad): 1350 """Get CEP conference call id if there is an ongoing CEP conference call. 1351 1352 Args: 1353 ad: android device object. 1354 1355 Returns: 1356 call id for CEP conference call if there is an ongoing CEP conference call. 1357 None otherwise. 1358 """ 1359 for call in ad.droid.telecomCallGetCallIds(): 1360 if len(ad.droid.telecomCallGetCallChildren(call)) != 0: 1361 return call 1362 return None 1363