1#!/usr/bin/env python3.4 2# 3# Copyright 2017 - Google 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16""" 17 Test Script for Telephony Pre Check In Sanity 18""" 19 20from acts import signals 21from acts.test_decorators import test_tracker_info 22from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 23from acts.test_utils.tel.tel_defines import CAPABILITY_WFC 24from acts.test_utils.tel.tel_defines import DEFAULT_DEVICE_PASSWORD 25from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED 26from acts.test_utils.tel.tel_lookup_tables import operator_capabilities 27from acts.test_utils.tel.tel_test_utils import fastboot_wipe 28from acts.test_utils.tel.tel_test_utils import reset_device_password 29from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode_by_adb 30from acts.test_utils.tel.tel_test_utils import wait_for_sim_ready_by_adb 31from acts.test_utils.tel.tel_voice_utils import phone_setup_csfb 32from acts.test_utils.tel.tel_voice_utils import phone_setup_iwlan 33from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_3g 34from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_2g 35from TelLiveEmergencyBase import TelLiveEmergencyBase 36 37 38class TelLiveEmergencyTest(TelLiveEmergencyBase): 39 """ Tests Begin """ 40 41 @test_tracker_info(uuid="fe75ba2c-e4ea-4fc1-881b-97e7a9a7f48e") 42 @TelephonyBaseTest.tel_test_wrap 43 def test_fake_emergency_call_by_emergency_dialer(self): 44 """Test emergency call with emergency dialer in user account. 45 46 Add system emergency number list with fake emergency number. 47 Use the emergency dialer to call fake emergency number. 48 Verify DUT has in call activity. 49 Hung up fake emergency call in ringing. 50 Bring DUT to normal state and make regular call. 51 52 Returns: 53 True if success. 54 False if failed. 55 """ 56 toggle_airplane_mode_by_adb(self.log, self.dut, False) 57 return self.fake_emergency_call_test() and self.check_normal_call() 58 59 @test_tracker_info(uuid="eb1fa042-518a-4ddb-8e9f-16a6c39c49f1") 60 @TelephonyBaseTest.tel_test_wrap 61 def test_fake_emergency_call_by_emergency_dialer_csfb(self): 62 """Test emergency call with emergency dialer in user account. 63 64 Configure DUT in CSFB 65 Add system emergency number list with fake emergency number. 66 Turn off emergency call IMS first. 67 Use the emergency dialer to call fake emergency number. 68 Verify DUT has in call activity. 69 Bring DUT to normal state and make regular call. 70 71 Returns: 72 True if success. 73 False if failed. 74 """ 75 if not phone_setup_csfb(self.log, self.dut): 76 return False 77 self.set_ims_first("false") 78 return self.fake_emergency_call_test() and self.check_normal_call() 79 80 @test_tracker_info(uuid="7a55991a-adc0-432c-b705-8ac9ee249323") 81 @TelephonyBaseTest.tel_test_wrap 82 def test_fake_emergency_call_by_emergency_dialer_3g(self): 83 """Test emergency call with emergency dialer in user account. 84 85 Configure DUT in 3G 86 Add a fake emergency number to emergency number list. 87 Turn off emergency call IMS first. 88 Use the emergency dialer to call fake emergency number. 89 Verify DUT has in call activity. 90 Bring DUT to normal state and make regular call. 91 92 Returns: 93 True if success. 94 False if failed. 95 """ 96 if not phone_setup_voice_3g(self.log, self.dut): 97 return False 98 self.set_ims_first("false") 99 return self.fake_emergency_call_test() and self.check_normal_call() 100 101 @test_tracker_info(uuid="cc40611b-6fe5-4952-8bdd-c15d6d995516") 102 @TelephonyBaseTest.tel_test_wrap 103 def test_fake_emergency_call_by_emergency_dialer_2g(self): 104 """Test emergency call with emergency dialer in user account. 105 106 Configure DUT in 2G 107 Add system emergency number list with fake emergency number. 108 Turn off emergency call IMS first. 109 Use the emergency dialer to call fake emergency number. 110 Verify DUT has in call activity. 111 Bring DUT to normal state and make regular call. 112 113 Returns: 114 True if success. 115 False if failed. 116 """ 117 if self.dut_operator != "tmo": 118 raise signals.TestSkip( 119 "2G is not supported for carrier %s" % self.dut_operator) 120 if not phone_setup_voice_2g(self.log, self.dut): 121 return False 122 self.set_ims_first("false") 123 return self.fake_emergency_call_test() and self.check_normal_call() 124 125 @test_tracker_info(uuid="a209864c-93fc-455c-aa81-8d3a83f6ad7c") 126 @TelephonyBaseTest.tel_test_wrap 127 def test_fake_emergency_call_by_emergency_dialer_wfc_apm(self): 128 """Test emergency call with emergency dialer in user account. 129 130 Configure DUT in WFC APM on. 131 Add system emergency number list with fake emergency number. 132 Use the emergency dialer to call fake emergency number. 133 Turn off emergency call IMS first. 134 Verify DUT has in call activity. 135 Bring DUT to normal state and make regular call. 136 137 Returns: 138 True if success. 139 False if failed. 140 """ 141 if CAPABILITY_WFC not in operator_capabilities.get( 142 self.dut_operator, operator_capabilities["default"]): 143 raise signals.TestSkip( 144 "WFC is not supported for carrier %s" % self.dut_operator) 145 if not phone_setup_iwlan( 146 self.log, self.dut, True, WFC_MODE_WIFI_PREFERRED, 147 self.wifi_network_ssid, self.wifi_network_pass): 148 self.dut.log.error("Failed to setup WFC.") 149 return False 150 return self.fake_emergency_call_test() and self.check_normal_call() 151 152 @test_tracker_info(uuid="be654073-0107-4b67-a5df-f25ebec7d93e") 153 @TelephonyBaseTest.tel_test_wrap 154 def test_fake_emergency_call_by_emergency_dialer_wfc_apm_off(self): 155 """Test emergency call with emergency dialer in user account. 156 157 Configure DUT in WFC APM off. 158 Add system emergency number list with fake emergency number. 159 Use the emergency dialer to call fake emergency number. 160 Verify DUT has in call activity. 161 Bring DUT to normal state and make regular call. 162 163 Returns: 164 True if success. 165 False if failed. 166 """ 167 if CAPABILITY_WFC not in operator_capabilities.get( 168 self.dut_operator, operator_capabilities["default"]): 169 raise signals.TestSkip( 170 "WFC is not supported for carrier %s" % self.dut_operator) 171 if self.dut_operator != "tmo": 172 raise signals.TestSkip( 173 "WFC in non-APM is not supported for carrier %s" % 174 self.dut_operator) 175 if not phone_setup_iwlan( 176 self.log, self.dut, False, WFC_MODE_WIFI_PREFERRED, 177 self.wifi_network_ssid, self.wifi_network_pass): 178 self.dut.log.error("Failed to setup WFC.") 179 return False 180 self.set_ims_first("false") 181 return self.fake_emergency_call_test() and self.check_normal_call() 182 183 @test_tracker_info(uuid="8a0978a8-d93e-4f6a-99fe-d0e28bf1be2a") 184 @TelephonyBaseTest.tel_test_wrap 185 def test_fake_emergency_call_by_dialer(self): 186 """Test emergency call with dialer. 187 188 Add system emergency number list with fake emergency number. 189 Use dialer to call fake emergency number. 190 Verify DUT has in call activity. 191 Bring DUT to normal state and make regular call. 192 193 Returns: 194 True if success. 195 False if failed. 196 """ 197 return self.fake_emergency_call_test( 198 by_emergency_dialer=False) and self.check_emergency_call_back_mode( 199 by_emergency_dialer=False) 200 201 @test_tracker_info(uuid="2e6fcc75-ff9e-47b1-9ae8-ed6f9966d0f5") 202 @TelephonyBaseTest.tel_test_wrap 203 def test_fake_emergency_call_in_apm(self): 204 """Test emergency call with emergency dialer in airplane mode. 205 206 Enable airplane mode. 207 Add system emergency number list with fake emergency number. 208 Use the emergency dialer to call fake emergency number. 209 Verify DUT has in call activity. 210 Bring DUT to normal state and make regular call. 211 212 Returns: 213 True if success. 214 False if failed. 215 """ 216 toggle_airplane_mode_by_adb(self.log, self.dut, True) 217 return self.fake_emergency_call_test() and self.check_normal_call() 218 219 @test_tracker_info(uuid="469bfa60-6e8f-4159-af1f-ab6244073079") 220 @TelephonyBaseTest.tel_test_wrap 221 def test_fake_emergency_call_in_screen_lock(self): 222 """Test emergency call with emergency dialer in screen lock phase. 223 224 Enable device password and then reboot upto password query window. 225 Add system emergency number list with fake emergency number. 226 Use the emergency dialer to call fake emergency number. 227 Verify DUT has in call activity. 228 Bring to DUT to normal state and make regular call. 229 230 Returns: 231 True if success. 232 False if failed. 233 """ 234 toggle_airplane_mode_by_adb(self.log, self.dut, False) 235 reset_device_password(self.dut, DEFAULT_DEVICE_PASSWORD) 236 if not wait_for_sim_ready_by_adb(self.log, self.dut): 237 self.dut.log.error("SIM is not ready") 238 return False 239 self.dut.reboot(stop_at_lock_screen=True) 240 return self.fake_emergency_call_test() and self.check_normal_call() 241 242 @test_tracker_info(uuid="17401c57-0dc2-49b5-b954-a94dbb2d5ad0") 243 @TelephonyBaseTest.tel_test_wrap 244 def test_fake_emergency_call_in_screen_lock_apm(self): 245 """Test emergency call with emergency dialer in screen lock phase. 246 247 Enable device password and then reboot upto password query window. 248 Add system emergency number list with fake emergency number. 249 Use the emergency dialer to call fake emergency number. 250 Verify DUT has in call activity. 251 Bring DUT to normal state and make regular call. 252 253 Returns: 254 True if success. 255 False if failed. 256 """ 257 toggle_airplane_mode_by_adb(self.log, self.dut, True) 258 reset_device_password(self.dut, DEFAULT_DEVICE_PASSWORD) 259 self.dut.reboot(stop_at_lock_screen=True) 260 if not wait_for_sim_ready_by_adb(self.log, self.dut): 261 self.dut.log.error("SIM is not ready") 262 return False 263 return self.fake_emergency_call_test() and self.check_normal_call() 264 265 @test_tracker_info(uuid="ccea13ae-6951-4790-a5f7-b5b7a2451c6c") 266 @TelephonyBaseTest.tel_test_wrap 267 def test_fake_emergency_call_in_setupwizard(self): 268 """Test emergency call with emergency dialer in setupwizard. 269 270 Wipe the device and then reboot upto setupwizard. 271 Add system emergency number list with fake emergency number. 272 Use the emergency dialer to call fake emergency number. 273 Verify DUT has in call activity. 274 Bring DUT to normal state and make regular call. 275 276 Returns: 277 True if success. 278 False if failed. 279 """ 280 if not fastboot_wipe(self.dut, skip_setup_wizard=False): 281 return False 282 if not wait_for_sim_ready_by_adb(self.log, self.dut): 283 self.dut.log.error("SIM is not ready") 284 return False 285 return self.fake_emergency_call_test() and self.check_normal_call() 286 287 @test_tracker_info(uuid="b138da45-45fa-4202-8f19-f8e598e535e1") 288 @TelephonyBaseTest.tel_test_wrap 289 def test_fake_emergency_call_by_emergency_dialer_ecbm(self): 290 """Test emergency call with emergency dialer in user account. 291 292 Add system emergency number list with fake emergency number. 293 Configure allow_non_emergency_calls_in_ecm_bool true. 294 Use the emergency dialer to call fake emergency number and hung up before connected. 295 Verify DUT voice and data in ecbm mode. 296 297 Returns: 298 True if success. 299 False if failed. 300 """ 301 toggle_airplane_mode_by_adb(self.log, self.dut, False) 302 return self.check_emergency_call_back_mode() 303 304 @test_tracker_info(uuid="") 305 @TelephonyBaseTest.tel_test_wrap 306 def test_fake_emergency_call_by_emergency_dialer_csfb_ecbm(self): 307 """Test emergency call with emergency dialer in user account. 308 309 Configure DUT in CSFB 310 Add system emergency number list with fake emergency number. 311 Configure allow_non_emergency_calls_in_ecm_bool true. 312 Turn off emergency call IMS first. 313 Use the emergency dialer to call fake emergency number and hung up before connected. 314 Verify DUT voice and data in ecbm mode. 315 316 Returns: 317 True if success. 318 False if failed. 319 """ 320 if not phone_setup_csfb(self.log, self.dut): 321 return False 322 self.set_ims_first("false") 323 return self.check_emergency_call_back_mode() 324 325 @test_tracker_info(uuid="8199eab0-3656-4fc3-8e9c-7063c24f72c9") 326 @TelephonyBaseTest.tel_test_wrap 327 def test_fake_emergency_call_by_emergency_dialer_3g_ecbm(self): 328 """Test emergency call with emergency dialer in user account. 329 330 Configure DUT in 3G 331 Add a fake emergency number to emergency number list. 332 Turn off emergency call IMS first. 333 Configure allow_non_emergency_calls_in_ecm_bool false. 334 Use the emergency dialer to call fake emergency number and hung up before connected. 335 Verify DUT voice and data in ecbm mode. 336 337 Returns: 338 True if success. 339 False if failed. 340 """ 341 if not phone_setup_voice_3g(self.log, self.dut): 342 return False 343 self.set_ims_first("false") 344 return self.check_emergency_call_back_mode() 345 346 @test_tracker_info(uuid="6a8ff7e6-29d0-48db-8d27-a7b39aaf4470") 347 @TelephonyBaseTest.tel_test_wrap 348 def test_fake_emergency_call_by_emergency_dialer_2g_ecbm(self): 349 """Test emergency call with emergency dialer in user account. 350 351 Configure DUT in 2G 352 Add system emergency number list with fake emergency number. 353 Turn off emergency call IMS first. 354 Configure allow_non_emergency_calls_in_ecm_bool false. 355 Use the emergency dialer to call fake emergency number and hung up before connect. 356 Verify DUT voice and data in ecbm mode. 357 358 Returns: 359 True if success. 360 False if failed. 361 """ 362 if self.dut_operator != "tmo": 363 raise signals.TestSkip( 364 "2G is not supported for carrier %s" % self.dut_operator) 365 if not phone_setup_voice_2g(self.log, self.dut): 366 return False 367 self.set_ims_first("false") 368 return self.check_emergency_call_back_mode() 369 370 @test_tracker_info(uuid="583b89c8-be9d-407b-9491-7cc44b4a9d9a") 371 @TelephonyBaseTest.tel_test_wrap 372 def test_fake_emergency_call_by_emergency_dialer_wfc_apm_ecbm(self): 373 """Test emergency call with emergency dialer in user account. 374 375 Configure DUT in WFC APM on. 376 Add system emergency number list with fake emergency number. 377 Turn off emergency call IMS first. 378 Configure allow_non_emergency_calls_in_ecm_bool false. 379 Use the emergency dialer to call fake emergency number and hung up before connect. 380 Verify DUT voice and data in ecbm mode. 381 382 Returns: 383 True if success. 384 False if failed. 385 """ 386 if CAPABILITY_WFC not in operator_capabilities.get( 387 self.dut_operator, operator_capabilities["default"]): 388 raise signals.TestSkip( 389 "WFC is not supported for carrier %s" % self.dut_operator) 390 if not phone_setup_iwlan( 391 self.log, self.dut, True, WFC_MODE_WIFI_PREFERRED, 392 self.wifi_network_ssid, self.wifi_network_pass): 393 self.dut.log.error("Failed to setup WFC.") 394 return False 395 return self.check_emergency_call_back_mode() 396 397 @test_tracker_info(uuid="a5ac18db-58ae-41b0-b6a8-ed1bdfa8447e") 398 @TelephonyBaseTest.tel_test_wrap 399 def test_fake_emergency_call_by_emergency_dialer_wfc_apm_off_ecbm(self): 400 """Test emergency call with emergency dialer in user account. 401 402 Configure DUT in WFC APM off. 403 Add system emergency number list with fake emergency number. 404 Configure allow_non_emergency_calls_in_ecm_bool false. 405 Use the emergency dialer to call fake emergency number and hung up before connect. 406 Verify DUT voice and data in ecbm mode. 407 408 Returns: 409 True if success. 410 False if failed. 411 """ 412 if CAPABILITY_WFC not in operator_capabilities.get( 413 self.dut_operator, operator_capabilities["default"]): 414 raise signals.TestSkip( 415 "WFC is not supported for carrier %s" % self.dut_operator) 416 if self.dut_operator != "tmo": 417 raise signals.TestSkip( 418 "WFC in non-APM is not supported for carrier %s" % 419 self.dut_operator) 420 if not phone_setup_iwlan( 421 self.log, self.dut, False, WFC_MODE_WIFI_PREFERRED, 422 self.wifi_network_ssid, self.wifi_network_pass): 423 self.dut.log.error("Failed to setup WFC.") 424 return False 425 self.set_ims_first("false") 426 return self.check_emergency_call_back_mode() 427 428 @test_tracker_info(uuid="1469db59-36f4-4b01-a05a-35ee60be22bc") 429 @TelephonyBaseTest.tel_test_wrap 430 def test_fake_emergency_call_by_dialer_ecbm(self): 431 """Test emergency call with dialer in user account. 432 433 Add system emergency number list with fake emergency number. 434 Configure allow_non_emergency_calls_in_ecm_bool true. 435 Use the dialer to call fake emergency number and hung up before connected. 436 Verify DUT voice and data in ecbm mode. 437 438 Returns: 439 True if success. 440 False if failed. 441 """ 442 return self.check_emergency_call_back_mode() 443 444 @test_tracker_info(uuid="dca5945d-2847-4662-bab8-583f35a4514e") 445 @TelephonyBaseTest.tel_test_wrap 446 def test_fake_emergency_call_in_apm_ecbm(self): 447 """Test emergency call with emergency dialer in airplane mode. 448 449 Enable airplane mode. 450 Add system emergency number list with fake emergency number. 451 Configure allow_non_emergency_calls_in_ecm_bool true. 452 Call fake emergency number and hung up before connected. 453 Verify DUT voice and data in ecbm mode. 454 455 Returns: 456 True if success. 457 False if failed. 458 """ 459 toggle_airplane_mode_by_adb(self.log, self.dut, True) 460 return self.check_emergency_call_back_mode() 461 462 @test_tracker_info(uuid="752afef4-bea9-4859-b352-8075f036f859") 463 @TelephonyBaseTest.tel_test_wrap 464 def test_fake_emergency_call_in_screen_lock_ecbm(self): 465 """Test emergency call with emergency dialer in screen lock phase. 466 467 Enable device password and then reboot upto password query window. 468 Add system emergency number list with fake emergency number. 469 Configure allow_non_emergency_calls_in_ecm_bool true. 470 Call fake emergency number and hung up before connected. 471 Verify DUT cannot make call in ecbm mode. 472 Verify DUT can make call out of ecbm mode. 473 474 Returns: 475 True if success. 476 False if failed. 477 """ 478 toggle_airplane_mode_by_adb(self.log, self.dut, False) 479 reset_device_password(self.dut, DEFAULT_DEVICE_PASSWORD) 480 if not wait_for_sim_ready_by_adb(self.log, self.dut): 481 self.dut.log.error("SIM is not ready") 482 return False 483 self.dut.reboot(stop_at_lock_screen=True) 484 return self.check_emergency_call_back_mode() 485 486 @test_tracker_info(uuid="45193127-a155-4281-b126-bfef79d70064") 487 @TelephonyBaseTest.tel_test_wrap 488 def test_fake_emergency_call_in_screen_lock_apm_ecbm(self): 489 """Test emergency call with emergency dialer in screen lock phase. 490 491 Enable device password and then reboot upto password query window. 492 Add system emergency number list with fake emergency number. 493 Configure allow_non_emergency_calls_in_ecm_bool true. 494 Call fake emergency number and hung up before connected. 495 Verify DUT call and data activity in ecbm mode. 496 497 Returns: 498 True if success. 499 False if failed. 500 """ 501 toggle_airplane_mode_by_adb(self.log, self.dut, True) 502 reset_device_password(self.dut, DEFAULT_DEVICE_PASSWORD) 503 self.dut.reboot(stop_at_lock_screen=True) 504 if not wait_for_sim_ready_by_adb(self.log, self.dut): 505 self.dut.log.error("SIM is not ready") 506 return False 507 return self.check_emergency_call_back_mode() 508 509 @test_tracker_info(uuid="ccb9ce63-f04f-480e-8c19-43d2a8c3d60f") 510 @TelephonyBaseTest.tel_test_wrap 511 def test_fake_emergency_call_in_setupwizard_ecbm(self): 512 """Test emergency call with emergency dialer in setupwizard. 513 514 Wipe the device and then reboot upto setupwizard. 515 Add system emergency number list with fake emergency number. 516 Configure allow_non_emergency_calls_in_ecm_bool true. 517 Call fake emergency number and hung up before connected. 518 Verify DUT call and data activity in ecbm mode. 519 520 Returns: 521 True if success. 522 False if failed. 523 """ 524 if not fastboot_wipe(self.dut, skip_setup_wizard=False): 525 return False 526 if not wait_for_sim_ready_by_adb(self.log, self.dut): 527 self.dut.log.error("SIM is not ready") 528 return False 529 return self.check_emergency_call_back_mode() 530 531 @test_tracker_info(uuid="e0fd7a16-7b3a-4cd9-ab5f-b7e49a531232") 532 @TelephonyBaseTest.tel_test_wrap 533 def test_fake_emergency_call_by_emergency_dialer_with_ecbm_call_block( 534 self): 535 """Test emergency call with emergency dialer in user account. 536 537 Add system emergency number list with fake emergency number. 538 Configure allow_non_emergency_calls_in_ecm_bool false. 539 Use the emergency dialer to call fake emergency number and hung up before connected. 540 Verify DUT cannot make call in ecbm mode. 541 Verify DUT can make call out of ecbm mode. 542 543 Returns: 544 True if success. 545 False if failed. 546 """ 547 toggle_airplane_mode_by_adb(self.log, self.dut, False) 548 return self.check_emergency_call_back_mode( 549 non_emergency_call_allowed=False) 550 551 @test_tracker_info(uuid="d08daf23-5efc-43ed-8530-e54fc141f555") 552 @TelephonyBaseTest.tel_test_wrap 553 def test_fake_emergency_call_by_emergency_dialer_csfb_with_ecbm_call_block( 554 self): 555 """Test emergency call with emergency dialer in user account. 556 557 Configure DUT in CSFB 558 Add system emergency number list with fake emergency number. 559 Configure allow_non_emergency_calls_in_ecm_bool false. 560 Turn off emergency call IMS first. 561 Use the emergency dialer to call fake emergency number and hung up before connected. 562 Verify DUT cannot make call in ecbm mode. 563 Verify DUT can make call out of ecbm mode. 564 565 Returns: 566 True if success. 567 False if failed. 568 """ 569 if not phone_setup_csfb(self.log, self.dut): 570 return False 571 self.set_ims_first("false") 572 return self.check_emergency_call_back_mode( 573 non_emergency_call_allowed=False) 574 575 @test_tracker_info(uuid="4ea2f8bb-ce0f-4c7a-b4b2-07259a5c371a") 576 @TelephonyBaseTest.tel_test_wrap 577 def test_fake_emergency_call_by_emergency_dialer_3g_with_ecbm_call_block( 578 self): 579 """Test emergency call with emergency dialer in user account. 580 581 Configure DUT in 3G 582 Add a fake emergency number to emergency number list. 583 Turn off emergency call IMS first. 584 Configure allow_non_emergency_calls_in_ecm_bool false. 585 Use the emergency dialer to call fake emergency number and hung up before connected. 586 Verify DUT cannot make call in ecbm mode. 587 Verify DUT can make call out of ecbm mode. 588 589 Returns: 590 True if success. 591 False if failed. 592 """ 593 if not phone_setup_voice_3g(self.log, self.dut): 594 return False 595 self.set_ims_first("false") 596 return self.check_emergency_call_back_mode( 597 non_emergency_call_allowed=False) 598 599 @test_tracker_info(uuid="ff11b2cb-0425-4a0b-8748-7ecff0148fe4") 600 @TelephonyBaseTest.tel_test_wrap 601 def test_fake_emergency_call_by_emergency_dialer_2g_with_ecbm_call_block( 602 self): 603 """Test emergency call with emergency dialer in user account. 604 605 Configure DUT in 2G 606 Add system emergency number list with fake emergency number. 607 Turn off emergency call IMS first. 608 Configure allow_non_emergency_calls_in_ecm_bool false. 609 Use the emergency dialer to call fake emergency number and hung up before connect. 610 Verify DUT cannot make call in ecbm mode. 611 Verify DUT can make call out of ecbm mode. 612 613 Returns: 614 True if success. 615 False if failed. 616 """ 617 if self.dut_operator != "tmo": 618 raise signals.TestSkip( 619 "2G is not supported for carrier %s" % self.dut_operator) 620 if not phone_setup_voice_2g(self.log, self.dut): 621 return False 622 self.set_ims_first("false") 623 return self.check_emergency_call_back_mode( 624 non_emergency_call_allowed=False) 625 626 @test_tracker_info(uuid="13296bdc-4d56-47d3-9d97-00474ca13608") 627 @TelephonyBaseTest.tel_test_wrap 628 def test_fake_emergency_call_by_emergency_dialer_wfc_apm_with_ecbm_call_block( 629 self): 630 """Test emergency call with emergency dialer in user account. 631 632 Configure DUT in WFC APM on. 633 Add system emergency number list with fake emergency number. 634 Turn off emergency call IMS first. 635 Configure allow_non_emergency_calls_in_ecm_bool false. 636 Use the emergency dialer to call fake emergency number and hung up before connect. 637 Verify DUT cannot make call in ecbm mode. 638 Verify DUT can make call out of ecbm mode. 639 640 Returns: 641 True if success. 642 False if failed. 643 """ 644 if CAPABILITY_WFC not in operator_capabilities.get( 645 self.dut_operator, operator_capabilities["default"]): 646 raise signals.TestSkip( 647 "WFC is not supported for carrier %s" % self.dut_operator) 648 if not phone_setup_iwlan( 649 self.log, self.dut, True, WFC_MODE_WIFI_PREFERRED, 650 self.wifi_network_ssid, self.wifi_network_pass): 651 self.dut.log.error("Failed to setup WFC.") 652 return False 653 return self.check_emergency_call_back_mode( 654 non_emergency_call_allowed=False) 655 656 @test_tracker_info(uuid="9179e64a-9236-4b79-b7b3-c5127dd3c21a") 657 @TelephonyBaseTest.tel_test_wrap 658 def test_fake_emergency_call_by_emergency_dialer_wfc_apm_off_with_ecbm_call_block( 659 self): 660 """Test emergency call with emergency dialer in user account. 661 662 Configure DUT in WFC APM off. 663 Add system emergency number list with fake emergency number. 664 Configure allow_non_emergency_calls_in_ecm_bool false. 665 Use the emergency dialer to call fake emergency number and hung up before connect. 666 Verify DUT cannot make call in ecbm mode. 667 Verify DUT can make call out of ecbm mode. 668 669 Returns: 670 True if success. 671 False if failed. 672 """ 673 if CAPABILITY_WFC not in operator_capabilities.get( 674 self.dut_operator, operator_capabilities["default"]): 675 raise signals.TestSkip( 676 "WFC is not supported for carrier %s" % self.dut_operator) 677 if self.dut_operator != "tmo": 678 raise signals.TestSkip( 679 "WFC in non-APM is not supported for carrier %s" % 680 self.dut_operator) 681 if not phone_setup_iwlan( 682 self.log, self.dut, False, WFC_MODE_WIFI_PREFERRED, 683 self.wifi_network_ssid, self.wifi_network_pass): 684 self.dut.log.error("Failed to setup WFC.") 685 return False 686 self.set_ims_first("false") 687 return self.check_emergency_call_back_mode( 688 non_emergency_call_allowed=False) 689 690 @test_tracker_info(uuid="8deea62b-a7e8-4747-91c6-9abe3317d0d9") 691 @TelephonyBaseTest.tel_test_wrap 692 def test_fake_emergency_call_by_dialer_with_ecbm_call_block(self): 693 """Test emergency call with dialer in user account. 694 695 Add system emergency number list with fake emergency number. 696 Configure allow_non_emergency_calls_in_ecm_bool false. 697 Use the dialer to call fake emergency number and hung up before connected. 698 Verify DUT cannot make call in ecbm mode. 699 Verify DUT can make call out of ecbm mode. 700 701 Returns: 702 True if success. 703 False if failed. 704 """ 705 return self.check_emergency_call_back_mode( 706 by_emergency_dialer=False, non_emergency_call_allowed=False) 707 708 @test_tracker_info(uuid="561d0a61-84c8-40e3-b2d7-72e221ccf83e") 709 @TelephonyBaseTest.tel_test_wrap 710 def test_fake_emergency_call_in_apm_with_ecbm_call_block(self): 711 """Test emergency call with emergency dialer in airplane mode. 712 713 Enable airplane mode. 714 Add system emergency number list with fake emergency number. 715 Configure allow_non_emergency_calls_in_ecm_bool false. 716 Call fake emergency number and hung up before connected. 717 Verify DUT cannot make call in ecbm mode. 718 Verify DUT can make call out of ecbm mode. 719 720 Returns: 721 True if success. 722 False if failed. 723 """ 724 toggle_airplane_mode_by_adb(self.log, self.dut, True) 725 return self.check_emergency_call_back_mode( 726 non_emergency_call_allowed=False) 727 728 @test_tracker_info(uuid="7b8dc0ae-9e2f-456a-bc88-3c920ba0ca71") 729 @TelephonyBaseTest.tel_test_wrap 730 def test_fake_emergency_call_in_screen_lock_with_ecbm_call_block(self): 731 """Test emergency call with emergency dialer in screen lock phase. 732 733 Enable device password and then reboot upto password query window. 734 Add system emergency number list with fake emergency number. 735 Configure allow_non_emergency_calls_in_ecm_bool false. 736 Call fake emergency number and hung up before connected. 737 Verify DUT cannot make call in ecbm mode. 738 Verify DUT can make call out of ecbm mode. 739 740 Returns: 741 True if success. 742 False if failed. 743 """ 744 toggle_airplane_mode_by_adb(self.log, self.dut, False) 745 reset_device_password(self.dut, DEFAULT_DEVICE_PASSWORD) 746 if not wait_for_sim_ready_by_adb(self.log, self.dut): 747 self.dut.log.error("SIM is not ready") 748 return False 749 self.dut.reboot(stop_at_lock_screen=True) 750 return self.check_emergency_call_back_mode( 751 non_emergency_call_allowed=False) 752 753 @test_tracker_info(uuid="fcdc1510-f60c-4f4e-9be1-a6123365b8ae") 754 @TelephonyBaseTest.tel_test_wrap 755 def test_fake_emergency_call_in_screen_lock_apm_with_ecbm_call_block(self): 756 """Test emergency call with emergency dialer in screen lock phase. 757 758 Enable device password and then reboot upto password query window. 759 Add system emergency number list with fake emergency number. 760 Configure allow_non_emergency_calls_in_ecm_bool false. 761 Call fake emergency number and hung up before connected. 762 Verify DUT cannot make call in ecbm mode. 763 Verify DUT can make call out of ecbm mode. 764 765 Returns: 766 True if success. 767 False if failed. 768 """ 769 toggle_airplane_mode_by_adb(self.log, self.dut, True) 770 reset_device_password(self.dut, DEFAULT_DEVICE_PASSWORD) 771 self.dut.reboot(stop_at_lock_screen=True) 772 if not wait_for_sim_ready_by_adb(self.log, self.dut): 773 self.dut.log.error("SIM is not ready") 774 return False 775 return self.check_emergency_call_back_mode( 776 non_emergency_call_allowed=False) 777 778 @test_tracker_info(uuid="85300bba-055c-4ca7-b011-bf1023ffda72") 779 @TelephonyBaseTest.tel_test_wrap 780 def test_fake_emergency_call_in_setupwizard_with_ecbm_call_block(self): 781 """Test emergency call with emergency dialer in setupwizard. 782 783 Wipe the device and then reboot upto setupwizard. 784 Add system emergency number list with fake emergency number. 785 Configure allow_non_emergency_calls_in_ecm_bool false. 786 Call fake emergency number and hung up before connected. 787 Verify DUT cannot make call in ecbm mode. 788 Verify DUT can make call out of ecbm mode. 789 790 Returns: 791 True if success. 792 False if failed. 793 """ 794 if not fastboot_wipe(self.dut, skip_setup_wizard=False): 795 return False 796 if not wait_for_sim_ready_by_adb(self.log, self.dut): 797 self.dut.log.error("SIM is not ready") 798 return False 799 return self.check_emergency_call_back_mode( 800 non_emergency_call_allowed=False) 801 802 803""" Tests End """ 804