def _wifi_connected_set_wfc_mode_change_wfc_mode(
         self,
         initial_wfc_mode,
         new_wfc_mode,
         is_wfc_available_in_initial_wfc_mode,
         is_wfc_available_in_new_wfc_mode,
         initial_setup_wifi=True,
         check_volte_after_wfc_disabled=False):
     if initial_setup_wifi and not ensure_wifi_connected(
             self.log, self.ad, self.wifi_network_ssid,
             self.wifi_network_pass):
         self.log.error("Failed to connect WiFi")
         return False
     # Set to initial_wfc_mode first, then change to new_wfc_mode
     for (wfc_mode, is_wfc_available) in \
         [(initial_wfc_mode, is_wfc_available_in_initial_wfc_mode),
          (new_wfc_mode, is_wfc_available_in_new_wfc_mode)]:
         current_wfc_status = is_wfc_enabled(self.log, self.ad)
         self.log.info("Current WFC: {}, Set WFC to {}".format(
             current_wfc_status, wfc_mode))
         if not set_wfc_mode(self.log, self.ad, wfc_mode):
             self.log.error("Failed to set WFC mode.")
             return False
         if is_wfc_available:
             if current_wfc_status:
                 # Previous is True, after set it still need to be true
                 # wait and check if DUT WFC got disabled.
                 if wait_for_wfc_disabled(self.log, self.ad):
                     self.log.error("WFC is not available.")
                     return False
             else:
                 # Previous is False, after set it will be true,
                 # wait and check if DUT WFC got enabled.
                 if not wait_for_wfc_enabled(self.log, self.ad):
                     self.log.error("WFC is not available.")
                     return False
         else:
             if current_wfc_status:
                 # Previous is True, after set it will be false,
                 # wait and check if DUT WFC got disabled.
                 if not wait_for_wfc_disabled(self.log, self.ad):
                     self.log.error("WFC is available.")
                     return False
             else:
                 # Previous is False, after set it still need to be false
                 # Wait and check if DUT WFC got enabled.
                 if wait_for_wfc_enabled(self.log, self.ad):
                     self.log.error("WFC is available.")
                     return False
             if check_volte_after_wfc_disabled and not wait_for_volte_enabled(
                     self.log, self.ad, MAX_WAIT_TIME_VOLTE_ENABLED):
                 self.log.error("Device failed to acquire VoLTE service")
                 return False
     return True
Пример #2
0
def is_phone_in_call_viwifi_for_subscription(log,
                                             ad,
                                             sub_id,
                                             video_state=None):
    """Return if ad (for sub_id) is in a viwifi call (in expected video state).
    Args:
        log: log object.
        ad: android device object
        sub_id: device sub_id
        video_state: Expected Video call state.
            This is optional, if it's None,
            then TX_ENABLED/RX_ENABLED/BIDIRECTIONAL video call state will
            return True.

    Returns:
        True if ad is in a video call (in expected video state).
    """

    if video_state is None:
        log.info("Verify if {}(subid {}) in video call.".format(
            ad.serial, sub_id))
    if not ad.droid.telecomIsInCall():
        log.error("{} not in call.".format(ad.serial))
        return False
    nw_type = get_network_rat(log, ad, NETWORK_SERVICE_DATA)
    if nw_type != RAT_IWLAN:
        ad.log.error("Data rat on: %s. Expected: iwlan", nw_type)
        return False
    if not is_wfc_enabled(log, ad):
        ad.log.error("WiFi Calling feature bit is False.")
        return False
    call_list = ad.droid.telecomCallGetCallIds()
    for call in call_list:
        state = ad.droid.telecomCallVideoGetState(call)
        if video_state is None:
            if {
                    VT_STATE_AUDIO_ONLY: False,
                    VT_STATE_TX_ENABLED: True,
                    VT_STATE_TX_PAUSED: True,
                    VT_STATE_RX_ENABLED: True,
                    VT_STATE_RX_PAUSED: True,
                    VT_STATE_BIDIRECTIONAL: True,
                    VT_STATE_BIDIRECTIONAL_PAUSED: True,
                    VT_STATE_STATE_INVALID: False
            }[state]:
                return True
        else:
            if state == video_state:
                return True
        ad.log.info("Non-Video-State: %s", state)
    ad.log.error("Phone not in video call. Call list: %s", call_list)
    return False
def is_phone_in_call_iwlan(log, ad):
    """Return if phone is in WiFi call.

    Args:
        ad: Android device object.
    """
    if not ad.droid.telecomIsInCall():
        ad.log.error("Not in call.")
        return False
    nw_type = get_network_rat(log, ad, NETWORK_SERVICE_DATA)
    if nw_type != RAT_IWLAN:
        ad.log.error("Data rat on: %s. Expected: iwlan", nw_type)
        return False
    if not is_wfc_enabled(log, ad):
        ad.log.error("WiFi Calling feature bit is False.")
        return False
    return True
Пример #4
0
def is_phone_in_call_not_iwlan(log, ad):
    """Return if phone is in WiFi call for subscription id.

    Args:
        ad: Android device object.
        sub_id: subscription id.
    """
    if not ad.droid.telecomIsInCall():
        log.error("{} not in call.".format(ad.serial))
        return False
    nw_type = get_network_rat(log, ad, NETWORK_SERVICE_DATA)
    if nw_type == RAT_IWLAN:
        log.error("{} data rat on: {}. Expected: not iwlan".format(
            ad.serial, nw_type))
        return False
    if is_wfc_enabled(log, ad):
        log.error("{} WiFi Calling feature bit is True.".format(ad.serial))
        return False
    return True