示例#1
0
def is_phone_in_call_iwlan(log, ad, call_id=None):
    """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
    if not ad.droid.telephonyIsImsRegistered():
        ad.log.info("IMS is not registered.")
        return False
    if not ad.droid.telephonyIsWifiCallingAvailable():
        ad.log.info("IsWifiCallingAvailble is False")
        return False
    if not call_id:
        call_ids = ad.droid.telecomCallGetCallIds()
        if call_ids:
            call_id = call_ids[-1]
    if not call_id:
        ad.log.error("Failed to get call id")
        return False
    else:
        call_prop = ad.droid.telecomCallGetProperties(call_id)
        if "WIFI" not in call_prop:
            ad.log.info("callProperties = %s, expecting WIFI", call_prop)
            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
    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
示例#5
0
    def test_smoke_3g_call_data_sms(self):
        try:
            ads = self.android_devices
            sms_idle_result = False
            sms_incall_result = False
            data_idle_result = False
            data_incall_result = False
            call_result = False

            self.log.info("--------start test_smoke_3g_call_data_sms--------")
            ensure_phones_default_state(self.log, ads)
            tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
                     (phone_setup_voice_3g, (self.log, ads[1]))]
            if not multithread_func(self.log, tasks):
                self.log.error("Phone Failed to Set Up 3G.")
                return False
            self.log.info("1. SMS in 3G idle.")
            sms_idle_result = sms_send_receive_verify(self.log, ads[0], ads[1],
                                                      [rand_ascii_str(50)])

            self.log.info("2. Data in 3G idle.")
            if (wait_for_cell_data_connection(self.log, ads[0], True)
                    and verify_http_connection(self.log, ads[0])):
                data_idle_result = True

            self.log.info("3. Setup 3G Call.")
            if not call_setup_teardown(self.log,
                                       ads[0],
                                       ads[1],
                                       ad_hangup=None,
                                       verify_caller_func=is_phone_in_call_3g,
                                       verify_callee_func=is_phone_in_call_3g):
                self.log.error("Setup 3G Call Failed.")
                return False

            self.log.info("4. Verify SMS in call.")
            sms_incall_result = sms_send_receive_verify(
                self.log, ads[0], ads[1], [rand_ascii_str(51)])

            self.log.info("5. Verify Data in call.")
            if is_rat_svd_capable(
                    get_network_rat(self.log, ads[0], NETWORK_SERVICE_VOICE)):
                if (wait_for_cell_data_connection(self.log, ads[0], True)
                        and verify_http_connection(self.log, ads[0])):
                    data_incall_result = True
            else:
                self.log.info("Data in call not supported on current RAT."
                              "Skip Data verification.")
                data_incall_result = SKIP

            self.log.info("6. Verify Call not drop and hangup.")
            if (is_phone_in_call_3g(self.log, ads[0])
                    and is_phone_in_call_3g(self.log, ads[1])
                    and hangup_call(self.log, ads[0])):
                call_result = True

            return (sms_idle_result and data_idle_result and call_result
                    and sms_incall_result and ((data_incall_result is True) or
                                               (data_incall_result == SKIP)))
        finally:
            self.log.info(
                "Summary for test run. Testbed:<{}>. <3G> SMS idle: {}, "
                "Data idle: {}, SMS in call: {}, Data in call: {}, "
                "Voice Call: {}".format(
                    getattr(self, Config.ikey_testbed_name.value),
                    sms_idle_result, data_idle_result, sms_incall_result,
                    data_incall_result, call_result))