def test_fake_emergency_call_by_emergency_dialer_wfc_apm_off_with_ecbm_call_block(
            self):
        """Test emergency call with emergency dialer in user account.

        Configure DUT in WFC APM off.
        Add system emergency number list with fake emergency number.
        Configure allow_non_emergency_calls_in_ecm_bool false.
        Use the emergency dialer to call fake emergency number and hung up before connect.
        Verify DUT cannot make call in ecbm mode.
        Verify DUT can make call out of ecbm mode.

        Returns:
            True if success.
            False if failed.
        """
        if CAPABILITY_WFC not in operator_capabilities.get(
                self.dut_operator, operator_capabilities["default"]):
            raise signals.TestSkip("WFC is not supported for carrier %s" %
                                   self.dut_operator)
        if self.dut_operator != "tmo":
            raise signals.TestSkip(
                "WFC in non-APM is not supported for carrier %s" %
                self.dut_operator)
        if not phone_setup_iwlan(
                self.log, self.dut, False, WFC_MODE_WIFI_PREFERRED,
                self.wifi_network_ssid, self.wifi_network_pass):
            self.dut.log.error("Failed to setup WFC.")
            return False
        self.set_ims_first("false")
        return self.check_emergency_call_back_mode(
            non_emergency_call_allowed=False)
    def test_fake_emergency_call_by_emergency_dialer_wfc_apm_off(self):
        """Test emergency call with emergency dialer in user account.

        Configure DUT in WFC APM off.
        Add system emergency number list with fake emergency number.
        Use the emergency dialer to call fake emergency number.
        Verify DUT has in call activity.
        Bring DUT to normal state and make regular call.

        Returns:
            True if success.
            False if failed.
        """
        if CAPABILITY_WFC not in operator_capabilities.get(
                self.dut_operator, operator_capabilities["default"]):
            raise signals.TestSkip("WFC is not supported for carrier %s" %
                                   self.dut_operator)
        if self.dut_operator != "tmo":
            raise signals.TestSkip(
                "WFC in non-APM is not supported for carrier %s" %
                self.dut_operator)
        if not phone_setup_iwlan(
                self.log, self.dut, False, WFC_MODE_WIFI_PREFERRED,
                self.wifi_network_ssid, self.wifi_network_pass):
            self.dut.log.error("Failed to setup WFC.")
            return False
        self.set_ims_first("false")
        return self.fake_emergency_call_test() and self.check_normal_call()
 def setup_class(self):
     super().setup_class()
     self.dut = self.android_devices[0]
     if len(self.android_devices) > 1:
         self.ad_reference = self.android_devices[1]
         setattr(self.ad_reference, "qxdm_log", False)
     else:
         self.ad_reference = None
     setattr(self.dut, "qxdm_log", False)
     self.stress_test_number = int(
         self.user_params.get("stress_test_number", 5))
     self.skip_reset_between_cases = False
     self.dut_model = get_model_name(self.dut)
     self.dut_operator = get_operator_name(self.log, self.dut)
     self.dut_capabilities = set(
         device_capabilities.get(
             self.dut_model, device_capabilities["default"])) & set(
                 operator_capabilities.get(
                     self.dut_operator, operator_capabilities["default"]))
     self.dut.log.info("DUT capabilities: %s", self.dut_capabilities)
     self.user_params["check_crash"] = False
     self.skip_reset_between_cases = False
     self.path = self.user_params['account_util'][0]
     self.user_account = "commsteltest1"
     self.user_password = "******"
    def test_fake_emergency_call_by_emergency_dialer_wfc_apm_ecbm(self):
        """Test emergency call with emergency dialer in user account.

        Configure DUT in WFC APM on.
        Add system emergency number list with fake emergency number.
        Turn off emergency call IMS first.
        Configure allow_non_emergency_calls_in_ecm_bool false.
        Use the emergency dialer to call fake emergency number and hung up before connect.
        Verify DUT voice and data in ecbm mode.

        Returns:
            True if success.
            False if failed.
        """
        if CAPABILITY_WFC not in operator_capabilities.get(
                self.dut_operator, operator_capabilities["default"]):
            raise signals.TestSkip("WFC is not supported for carrier %s" %
                                   self.dut_operator)
        if not phone_setup_iwlan(
                self.log, self.dut, True, WFC_MODE_WIFI_PREFERRED,
                self.wifi_network_ssid, self.wifi_network_pass):
            self.dut.log.error("Failed to setup WFC.")
            return False
        return self.check_emergency_call_back_mode()