Пример #1
0
def phone_setup_csfb_for_subscription(log, ad, sub_id):
    """Setup phone for CSFB call test for subscription id.

    Setup Phone to be in 4G mode.
    Disabled VoLTE.

    Args:
        log: log object
        ad: Android device object.
        sub_id: subscription id.

    Returns:
        True if setup successfully.
        False for errors.
    """
    if not phone_setup_4g_for_subscription(log, ad, sub_id):
        log.error("{} failed to set to 4G data.".format(ad.serial))
        return False
    if ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform():
        toggle_volte(log, ad, False)
    if not ensure_network_generation_for_subscription(
            log, ad, sub_id, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA):
        return False

    if not wait_for_voice_attach_for_subscription(log, ad, sub_id,
                                                  MAX_WAIT_TIME_NW_SELECTION):
        return False

    return phone_idle_csfb_for_subscription(log, ad, sub_id)
Пример #2
0
 def _phone_setup_lte_wcdma(self, ad):
     toggle_volte(self.log, ad, False)
     return ensure_network_rat(self.log,
                               ad,
                               NETWORK_MODE_LTE_GSM_WCDMA,
                               RAT_FAMILY_LTE,
                               toggle_apm_after_setting=True)
def phone_setup_video_for_subscription(log,
                                       ad,
                                       sub_id,
                                       wfc_mode=WFC_MODE_DISABLED):
    """Setup phone sub_id to make video call

    Args:
        log: log object.
        ad: android device object
        sub_id: ad's sub id.
        wfc_mode: WFC mode to set to.
            Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED,
            WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED.

    Returns:
        True if ad (sub_id) is setup correctly and idle for video call.
    """

    toggle_airplane_mode(log, ad, False)
    if not set_wfc_mode(log, ad, wfc_mode):
        log.error("{} WFC mode failed to be set to {}.".format(
            ad.serial, wfc_mode))
        return False
    toggle_volte(log, ad, True)

    if not ensure_network_generation(
            log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA):
        log.error("{} voice not in LTE mode.".format(ad.serial))
        return False

    return phone_idle_video_for_subscription(log, ad, sub_id)
Пример #4
0
 def _phone_setup_volte(self, ad):
     ad.droid.telephonyToggleDataConnection(True)
     toggle_volte(self.log, ad, True)
     return ensure_network_rat(self.log,
                               ad,
                               NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
                               RAT_FAMILY_LTE,
                               toggle_apm_after_setting=True)
Пример #5
0
def phone_setup_iwlan_for_subscription(log,
                                       ad,
                                       sub_id,
                                       is_airplane_mode,
                                       wfc_mode,
                                       wifi_ssid=None,
                                       wifi_pwd=None):
    """Phone setup function for epdg call test for subscription id.
    Set WFC mode according to wfc_mode.
    Set airplane mode according to is_airplane_mode.
    Make sure phone connect to WiFi. (If wifi_ssid is not None.)
    Wait for phone to be in iwlan data network type.
    Wait for phone to report wfc enabled flag to be true.

    Args:
        log: Log object.
        ad: Android device object.
        sub_id: subscription id.
        is_airplane_mode: True to turn on airplane mode. False to turn off airplane mode.
        wfc_mode: WFC mode to set to.
        wifi_ssid: WiFi network SSID. This is optional.
            If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi.
        wifi_pwd: WiFi network password. This is optional.

    Returns:
        True if success. False if fail.
    """

    # VoLTE settings are unavailable in airplane mode
    toggle_airplane_mode(log, ad, False)

    # Now that we are out of APM, toggle VoLTE if necessary
    if ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform():
        toggle_volte(log, ad, True)

    if not is_airplane_mode and not ensure_network_generation_for_subscription(
            log, ad, sub_id, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA):
        return False

    if not set_wfc_mode(log, ad, wfc_mode):
        log.error("{} set WFC mode failed.".format(ad.serial))
        return False

    if not toggle_airplane_mode(log, ad, is_airplane_mode):
        log.error("Failed to enable airplane mode on {}".format(ad.serial))
        return False

    if wifi_ssid is not None:
        if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd):
            log.error("{} connect to WiFi failed.".format(ad.serial))
            return False

    return phone_idle_iwlan_for_subscription(log, ad, sub_id)
Пример #6
0
def phone_setup_iwlan_cellular_preferred(log,
                                         ad,
                                         wifi_ssid=None,
                                         wifi_pwd=None):
    """Phone setup function for iwlan Non-APM CELLULAR_PREFERRED test.
    Set WFC mode according to CELLULAR_PREFERRED.
    Set airplane mode according to False.
    Make sure phone connect to WiFi. (If wifi_ssid is not None.)
    Make sure phone don't report iwlan data network type.
    Make sure phone don't report wfc enabled flag to be true.

    Args:
        log: Log object.
        ad: Android device object.
        wifi_ssid: WiFi network SSID. This is optional.
            If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi.
        wifi_pwd: WiFi network password. This is optional.

    Returns:
        True if success. False if fail.
    """
    toggle_airplane_mode(log, ad, False, strict_checking=False)
    try:
        toggle_volte(log, ad, True)
        if not wait_for_network_generation(
                log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA):
            if not ensure_network_generation(
                    log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA):
                ad.log.error("Fail to ensure data in 4G")
                return False
    except Exception as e:
        ad.log.error(e)
        ad.droid.telephonyToggleDataConnection(True)
    if wifi_ssid is not None:
        if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd):
            ad.log.error("Connect to WiFi failed.")
            return False
    if not set_wfc_mode(log, ad, WFC_MODE_CELLULAR_PREFERRED):
        ad.log.error("Set WFC mode failed.")
        return False
    if not wait_for_not_network_rat(
            log, ad, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA):
        ad.log.error("Data rat in iwlan mode.")
        return False
    elif not wait_for_wfc_disabled(log, ad, MAX_WAIT_TIME_WFC_ENABLED):
        ad.log.error("Should report wifi calling disabled within %s.",
                     MAX_WAIT_TIME_WFC_ENABLED)
        return False
    return True
    def test_factory_reset_by_fastboot_wipe(self):
        """Verify the network setting after factory reset by wipe.

        Steps:
        1. Config VoLTE, WFC, APM, data_roamingn, mobile_data,
           preferred_network_mode to non-factory default.
        2. Factory reset by fastboot wipe.
        3. Verify network configs back to factory default.

        """
        self.dut.log.info("Set VoLTE off, WFC wifi preferred, APM on")
        toggle_volte(self.log, self.dut, False)
        revert_default_telephony_setting(self.dut)
        self.change_ims_setting(True, True, False, True,
                                WFC_MODE_WIFI_PREFERRED)
        self.dut.log.info("Wipe in fastboot")
        fastboot_wipe(self.dut)
        return verify_default_telephony_setting(
            self.dut) and (self.verify_default_ims_setting())
    def test_lte_wfc_enabled_wifi_connected_toggle_volte(self):
        """Test for WiFi Calling settings:
        LTE + VoLTE Enabled + WiFi Connected + WFC enabled, toggle VoLTE setting

        Steps:
        1. Setup DUT Idle, LTE network type, VoLTE enabled.
        2. Make sure DUT WiFi connected, WFC enabled (WiFi Preferred).
            Verify DUT WFC available, report iwlan rat.
        3. Disable VoLTE on DUT, verify in 2 minutes period,
            DUT does not lost WiFi Calling, DUT still report WFC available,
            rat iwlan.
        4. Enable VoLTE on DUT, verify in 2 minutes period,
            DUT does not lost WiFi Calling, DUT still report WFC available,
            rat iwlan.

        Expected Results:
        2. DUT WiFi Calling feature bit return True, network rat is iwlan.
        3. DUT WiFi Calling feature bit return True, network rat is iwlan.
        4. DUT WiFi Calling feature bit return True, network rat is iwlan.
        """
        if not phone_setup_volte(self.log, self.ad):
            self.log.error("Failed to setup VoLTE.")
            return False
        if not phone_setup_iwlan(self.log, self.ad, False,
                                 WFC_MODE_WIFI_PREFERRED,
                                 self.wifi_network_ssid,
                                 self.wifi_network_pass):
            self.log.error("Failed to setup WFC.")
            return False
        # Turn Off VoLTE, then Turn On VoLTE
        for i in range(2):
            if not toggle_volte(self.log, self.ad):
                self.log.error("Failed to toggle VoLTE.")
                return False
            if wait_for_wfc_disabled(self.log, self.ad):
                self.log.error("WFC is not available.")
                return False
            if not is_droid_in_rat_family(self.log, self.ad, RAT_FAMILY_WLAN,
                                          NETWORK_SERVICE_DATA):
                self.log.error("Data Rat is not iwlan.")
                return False
        return True
Пример #9
0
 def _phone_setup_volte_airplane_mode(self, ad):
     toggle_volte(self.log, ad, True)
     return toggle_airplane_mode_by_adb(self.log, ad, True)
 def change_ims_setting(self,
                        airplane_mode,
                        wifi_enabled,
                        volte_enabled,
                        wfc_enabled,
                        wfc_mode=None):
     result = True
     self.dut.log.info(
         "Setting APM %s, WIFI %s, VoLTE %s, WFC %s, WFC mode %s",
         airplane_mode, wifi_enabled, volte_enabled, wfc_enabled, wfc_mode)
     toggle_airplane_mode_by_adb(self.log, self.dut, airplane_mode)
     if wifi_enabled:
         if not ensure_wifi_connected(self.log, self.dut,
                                      self.wifi_network_ssid,
                                      self.wifi_network_pass,
                                      apm=airplane_mode):
             self.dut.log.error("Fail to connected to WiFi")
             result = False
     else:
         if not wifi_toggle_state(self.log, self.dut, False):
             self.dut.log.error("Failed to turn off WiFi.")
             result = False
     toggle_volte(self.log, self.dut, volte_enabled)
     toggle_wfc(self.log, self.dut, wfc_enabled)
     if wfc_mode:
         set_wfc_mode(self.log, self.dut, wfc_mode)
     wfc_mode = self.dut.droid.imsGetWfcMode()
     if wifi_enabled or not airplane_mode:
         if not ensure_phone_subscription(self.log, self.dut):
             self.dut.log.error("Failed to find valid subscription")
             result = False
     if airplane_mode:
         if (CAPABILITY_WFC in self.dut_capabilities) and (wifi_enabled
                                                           and wfc_enabled):
             if not wait_for_wfc_enabled(self.log, self.dut):
                 result = False
             elif not self.check_call_in_wfc():
                 result = False
         else:
             if not wait_for_state(
                     self.dut.droid.telephonyGetCurrentVoiceNetworkType,
                     RAT_UNKNOWN):
                 self.dut.log.error(
                     "Voice RAT is %s not UNKNOWN",
                     self.dut.droid.telephonyGetCurrentVoiceNetworkType())
                 result = False
             else:
                 self.dut.log.info("Voice RAT is in UNKKNOWN")
     else:
         if (wifi_enabled and wfc_enabled) and (
                 wfc_mode == WFC_MODE_WIFI_PREFERRED) and (
                     CAPABILITY_WFC in self.dut_capabilities):
             if not wait_for_wfc_enabled(self.log, self.dut):
                 result = False
             if not wait_for_state(
                     self.dut.droid.telephonyGetCurrentVoiceNetworkType,
                     RAT_UNKNOWN):
                 self.dut.log.error(
                     "Voice RAT is %s, not UNKNOWN",
                     self.dut.droid.telephonyGetCurrentVoiceNetworkType())
             if not self.check_call_in_wfc():
                 result = False
         else:
             if not wait_for_wfc_disabled(self.log, self.dut):
                 self.dut.log.error("WFC is not disabled")
                 result = False
             if volte_enabled and CAPABILITY_VOLTE in self.dut_capabilities:
                 if not wait_for_volte_enabled(self.log, self.dut):
                     result = False
                 if not self.check_call_in_volte():
                     result = False
             else:
                 if not wait_for_not_network_rat(
                         self.log,
                         self.dut,
                         RAT_LTE,
                         voice_or_data=NETWORK_SERVICE_VOICE):
                     self.dut.log.error(
                         "Voice RAT is %s",
                         self.dut.droid.telephonyGetCurrentVoiceNetworkType(
                         ))
                     result = False
                 if not wait_for_voice_attach(self.log, self.dut):
                     result = False
                 if not self.check_call():
                     result = False
     user_config_profile = get_user_config_profile(self.dut)
     self.dut.log.info("user_config_profile: %s ",
                       sorted(user_config_profile.items()))
     return result
 def disable_volte(self):
     if CAPABILITY_VOLTE not in self.dut_capabilities:
         raise signals.TestSkip("VoLTE is not supported, abort test.")
     toggle_volte(self.log, self.dut, False)