Пример #1
0
def phone_idle_csfb_for_subscription(log, ad, sub_id):
    """Return if phone is idle for CSFB call test for subscription id.

    Args:
        ad: Android device object.
        sub_id: subscription id.
    """
    if not wait_for_network_rat_for_subscription(
            log, ad, sub_id, RAT_FAMILY_LTE,
            voice_or_data=NETWORK_SERVICE_DATA):
        log.error("{} data rat not in lte mode.".format(ad.serial))
        return False
    return True
Пример #2
0
def phone_idle_iwlan_for_subscription(log, ad, sub_id):
    """Return if phone is idle for WiFi calling call test for subscription id.

    Args:
        ad: Android device object.
        sub_id: subscription id.
    """
    if not wait_for_network_rat_for_subscription(
            log, ad, sub_id, RAT_FAMILY_WLAN,
            voice_or_data=NETWORK_SERVICE_DATA):
        log.error("{} data rat not in iwlan mode.".format(ad.serial))
        return False
    if not wait_for_wfc_enabled(log, ad, MAX_WAIT_TIME_WFC_ENABLED):
        log.error("{} failed to <report wfc enabled true> within {}s.".format(
            ad.serial, MAX_WAIT_TIME_WFC_ENABLED))
        return False
    return True
Пример #3
0
def phone_idle_volte_for_subscription(log, ad, sub_id):
    """Return if phone is idle for VoLTE call test for subscription id.

    Args:
        ad: Android device object.
        sub_id: subscription id.
    """
    if not wait_for_network_rat_for_subscription(
            log, ad, sub_id, RAT_FAMILY_LTE,
            voice_or_data=NETWORK_SERVICE_VOICE):
        log.error("{} voice rat not in LTE mode.".format(ad.serial))
        return False
    if not wait_for_volte_enabled(log, ad, MAX_WAIT_TIME_VOLTE_ENABLED):
        log.error(
            "{} failed to <report volte enabled true> within {}s.".format(
                ad.serial, MAX_WAIT_TIME_VOLTE_ENABLED))
        return False
    return True
Пример #4
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.
    """
    toggle_airplane_mode(log, ad, is_airplane_mode, strict_checking=False)

    # check if WFC supported phones
    if wfc_mode != WFC_MODE_DISABLED and not ad.droid.imsIsWfcEnabledByPlatform(
    ):
        ad.log.error("WFC is not enabled on this device by checking "
                     "ImsManager.isWfcEnabledByPlatform")
        return False

    if wifi_ssid is not None:
        if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd):
            ad.log.error("Fail to bring up WiFi connection on %s.", wifi_ssid)
            return False

    if not set_wfc_mode(log, ad, wfc_mode):
        ad.log.error("Unable to set WFC mode to %s.", wfc_mode)
        return False

    if not wait_for_wfc_enabled(log, ad, max_time=MAX_WAIT_TIME_WFC_ENABLED):
        ad.log.error("WFC is not enabled")
        return False

    if wait_for_network_rat_for_subscription(
            log, ad, sub_id, RAT_FAMILY_WLAN,
            voice_or_data=NETWORK_SERVICE_DATA):
        ad.log.info(
            "Data rat is in iwlan mode successfully with APM %s WFC %s",
            is_airplane_mode, wfc_mode)
        return True
    else:
        ad.log.error(
            "Unable to bring data rat in iwlan mode with APM %s WFC %s",
            is_airplane_mode, wfc_mode)
        return False