def check_normal_call(self):
     result = True
     if "wfc" not in self.test_name:
         toggle_airplane_mode_by_adb(self.log, self.dut, False)
     self.dut.ensure_screen_on()
     self.dut.exit_setup_wizard()
     reset_device_password(self.dut, None)
     begin_time = get_current_epoch_time()
     if not call_setup_teardown(
             self.log,
             self.android_devices[1],
             self.dut,
             ad_hangup=self.android_devices[1]):
         self.dut.log.error("Regular MT phone call fails")
         self.dut.log.info("call_info = %s", dumpsys_last_call_info(
             self.dut))
         result = False
     if not call_setup_teardown(
             self.log, self.dut, self.android_devices[1],
             ad_hangup=self.dut):
         self.dut.log.error("Regular MO phone call fails")
         self.dut.log.info("call_info = %s", dumpsys_last_call_info(
             self.dut))
         result = False
     return result
 def check_call(self):
     result = True
     if not call_setup_teardown(self.log, self.android_devices[1], self.dut,
                                self.dut):
         if not call_setup_teardown(self.log, self.android_devices[1],
                                    self.dut, self.dut):
             self.dut.log.error("MT call failed")
             result = False
     if not call_setup_teardown(self.log, self.dut, self.android_devices[1],
                                self.dut):
         self.dut.log.error("MO call failed")
         result = False
     return result
 def check_call_in_volte(self):
     result = True
     if not call_setup_teardown(self.log, self.android_devices[1], self.dut,
                                self.dut, None, is_phone_in_call_volte):
         if not call_setup_teardown(self.log, self.android_devices[1],
                                    self.dut, self.dut, None,
                                    is_phone_in_call_volte):
             self.dut.log.error("MT VoLTE call failed")
             result = False
     if not call_setup_teardown(self.log, self.dut, self.android_devices[1],
                                self.dut, is_phone_in_call_volte):
         self.dut.log.error("MO VoLTE call failed")
         result = False
     return result
 def check_call_in_wfc(self):
     result = True
     if not call_setup_teardown(self.log, self.android_devices[1], self.dut,
                                self.dut, None, is_phone_in_call_iwlan):
         if not call_setup_teardown(self.log, self.android_devices[1],
                                    self.dut, self.dut, None,
                                    is_phone_in_call_iwlan):
             self.dut.log.error("MT WFC call failed")
             result = False
     if not call_setup_teardown(self.log, self.dut, self.android_devices[1],
                                self.dut, is_phone_in_call_iwlan):
         self.dut.log.error("MO WFC call failed")
         result = False
     return result
Esempio n. 5
0
 def _setup_phone_call(self):
     if not call_setup_teardown(
             self.log, self.caller, self.callee, ad_hangup=None):
         self.log.error("Setup Call failed.")
         return False
     self.log.info("Setup call successfully.")
     return True
Esempio n. 6
0
 def _setup_phone_active_call_wfc(self,
                                  ad,
                                  ssid,
                                  password,
                                  airplane_mode,
                                  wfc_mode,
                                  setup_volte=False):
     if setup_volte and (not phone_setup_volte(self.log, ad)):
         self.log.error("Phone failed to setup VoLTE.")
         return False
     if not phone_setup_iwlan(self.log, ad, airplane_mode, wfc_mode, ssid,
                              password):
         self.log.error("DUT Failed to Set Up WiFi Calling")
         return False
     ensure_phones_idle(self.log, [ad, self.android_devices[1]])
     if not phone_idle_iwlan(self.log, ad):
         self.log.error("DUT not in WFC enabled state.")
         return False
     if not call_setup_teardown(self.log,
                                ad,
                                self.android_devices[1],
                                ad_hangup=None,
                                verify_caller_func=is_phone_in_call_iwlan):
         self.log.error("Setup Call failed.")
         return False
     ad.droid.goToSleepNow()
     return True
Esempio n. 7
0
    def test_sms_mt_in_call_volte(self):
        """ Test MT SMS during a MO VoLTE call.

        Make Sure PhoneA is in LTE mode (with VoLTE).
        Make Sure PhoneB is able to make/receive call.
        Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA.

        Returns:
            True if pass; False if fail.
        """
        ads = self.android_devices

        tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte,
                                                           (self.log, ads[1]))]
        if not multithread_func(self.log, tasks):
            self.log.error("Phone Failed to Set Up Properly.")
            return False

        self.log.info("Begin In Call SMS Test.")
        if not call_setup_teardown(self.log,
                                   ads[0],
                                   ads[1],
                                   ad_hangup=None,
                                   verify_caller_func=is_phone_in_call_volte,
                                   verify_callee_func=None):
            return False

        if not self._sms_test_mt(ads):
            self.log.error("SMS test fail.")
            return False

        return True
Esempio n. 8
0
    def test_sms_mt_in_call_iwlan(self):
        """ Test MT SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode.

        Make Sure PhoneA APM, WiFi connected, WFC WiFi preferred mode.
        Make sure PhoneA report iwlan as data rat.
        Make Sure PhoneB is able to make/receive call/sms.
        Call from PhoneA to PhoneB, accept on PhoneB.
        Receive SMS on PhoneA.

        Returns:
            True if pass; False if fail.
        """

        ads = self.android_devices

        tasks = [(phone_setup_iwlan,
                  (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
                   self.wifi_network_ssid, self.wifi_network_pass)),
                 (phone_setup_voice_general, (self.log, ads[1]))]
        if not multithread_func(self.log, tasks):
            self.log.error("Phone Failed to Set Up Properly.")
            return False

        self.log.info("Begin In Call SMS Test.")
        if not call_setup_teardown(self.log,
                                   ads[0],
                                   ads[1],
                                   ad_hangup=None,
                                   verify_caller_func=is_phone_in_call_iwlan,
                                   verify_callee_func=None):
            return False

        return self._sms_test_mt(ads)
 def _setup_phone_active_call(self):
     if not call_setup_teardown(
             self.log, self.ad, self.android_devices[1], ad_hangup=None):
         self.log.error("Setup Call failed.")
         return False
     self.log.info("Setup active call successfully.")
     return True
Esempio n. 10
0
    def test_smoke_wfc_call_sms(self):
        ads = self.android_devices
        sms_idle_result = False
        sms_incall_result = False
        call_result = False

        self.log.info("--------start test_smoke_wfc_call_sms--------")
        for ad in [ads[0], ads[1]]:
            if not ad.droid.imsIsWfcEnabledByPlatform():
                self.log.info("WFC not supported by platform.")
                return True
        try:
            ensure_phones_default_state(self.log, ads)
            tasks = [(phone_setup_iwlan,
                      (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
                       self.wifi_network_ssid, self.wifi_network_pass)),
                     (phone_setup_iwlan,
                      (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED,
                       self.wifi_network_ssid, self.wifi_network_pass))]
            if not multithread_func(self.log, tasks):
                self.log.error("Phone Failed to Set Up WiFI Calling.")
                return False

            self.log.info("1. Verify SMS in idle.")
            if sms_send_receive_verify(self.log, ads[0], ads[1],
                                       [rand_ascii_str(50)]):
                sms_idle_result = True

            self.log.info("2. Setup WiFi Call.")
            if not call_setup_teardown(
                    self.log,
                    ads[0],
                    ads[1],
                    ad_hangup=None,
                    verify_caller_func=is_phone_in_call_iwlan,
                    verify_callee_func=is_phone_in_call_iwlan):
                self.log.error("Setup WiFi Call Failed.")
                self.log.info("sms_idle_result:{}".format(sms_idle_result))
                return False

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

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

            return (call_result and sms_idle_result and sms_incall_result)
        finally:
            self.log.info(
                "Summary for test run. Testbed:<{}>. <WFC> SMS idle: {}, "
                "SMS in call: {}, Voice Call: {}".format(
                    getattr(self, Config.ikey_testbed_name.value),
                    sms_idle_result, sms_incall_result, call_result))
Esempio n. 11
0
 def _check_volte_enabled(self):
     if phone_idle_volte(self.log, self.dut):
         self.dut.log.info("VoLTE is enabled")
     else:
         self.dut.log.error("VoLTE is not enabled")
         return False
     if not call_setup_teardown(self.log, self.dut, self.ad_reference,
                                self.dut, is_phone_in_call_volte):
         self.log.error("VoLTE Call Failed.")
         return False
     if not self._check_lte_data():
         return False
     return True
Esempio n. 12
0
 def _check_csfb_enabled(self):
     if not call_setup_teardown(self.log, self.dut, self.ad_reference,
                                self.dut, is_phone_in_call_csfb):
         self.log.error("CSFB Call Failed.")
         return False
     if not wait_for_network_generation(
             self.log, self.dut, GEN_4G,
             voice_or_data=NETWORK_SERVICE_DATA):
         self.dut.log.error("Data service failed to camp to 4G")
         return False
     if not verify_internet_connection(self.log, self.dut):
         self.log.error("Data not available on cell.")
         return False
     return True
Esempio n. 13
0
 def _make_phone_call(self, ads):
     self.result_info["Total Calls"] += 1
     if not call_setup_teardown(self.log,
                                ads[0],
                                ads[1],
                                ad_hangup=ads[random.randrange(0, 2)],
                                wait_time_in_call=random.randrange(
                                    self.min_phone_call_duration,
                                    self.max_phone_call_duration)):
         self.log.error("Call setup and teardown failed.")
         self.result_info["Call Failure"] += 1
         return False
     self.log.info("Call setup and teardown succeed.")
     return True
Esempio n. 14
0
    def _mo_sms_in_3g_call(self, ads):
        self.log.info("Begin In Call SMS Test.")
        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=None):
            return False

        if not self._sms_test_mo(ads):
            self.log.error("SMS test fail.")
            return False

        return True
Esempio n. 15
0
 def _check_wfc_apm(self):
     if CAPABILITY_WFC in self.dut_capabilities:
         self.log.info("Check WFC in APM")
         if not phone_setup_iwlan(
                 self.log, self.dut, True, WFC_MODE_CELLULAR_PREFERRED,
                 self.wifi_network_ssid, self.wifi_network_pass):
             self.log.error("Failed to setup WFC.")
             return False
         if not call_setup_teardown(self.log, self.dut, self.ad_reference,
                                    self.dut, is_phone_in_call_iwlan):
             self.log.error("WFC Call Failed.")
             return False
         else:
             return True
     return False
 def _setup_phone_call(self, test_video):
     if test_video:
         if not video_call_setup(
                 self.log,
                 self.android_devices[0],
                 self.android_devices[1],
         ):
             self.log.error("Failed to setup Video call")
             return False
     else:
         if not call_setup_teardown(
                 self.log, self.caller, self.callee, ad_hangup=None):
             self.log.error("Setup Call failed.")
             return False
     self.log.info("Setup call successfully.")
     return True
 def _setup_phone_call(self, test_video, phone_call_duration=WAIT_TIME_IN_CALL):
     if test_video:
         if not video_call_setup(
                 self.log,
                 self.android_devices[0],
                 self.android_devices[1],
         ):
             self.log.error("Failed to setup Video call")
             return False
     else:
         if not call_setup_teardown(
                 self.log, self.caller, self.callee, ad_hangup=None, wait_time_in_call=phone_call_duration):
             self.log.error("Setup Call failed.")
             return False
     self.log.info("Setup call successfully.")
     return True
 def _check_volte(self, ad, ad_reference):
     if (CAPABILITY_VOLTE in device_capabilities[self.dut_model] and
             CAPABILITY_VOLTE in operator_capabilities[self.dut_operator]):
         self.log.info("Check VoLTE")
         if not phone_setup_volte(self.log, ad):
             self.log.error("Failed to setup VoLTE.")
             return False
         if not call_setup_teardown(self.log, ad, ad_reference, ad,
                                    is_phone_in_call_volte):
             self.log.error("VoLTE Call Failed.")
             return False
         if not sms_send_receive_verify(self.log, ad, ad_reference,
                                        [rand_ascii_str(50)]):
             self.log.error("SMS failed")
             return False
     return True
 def _check_3g(self):
     self.log.info("Check 3G data and CS call")
     if not phone_setup_voice_3g(self.log, self.dut):
         self.log.error("Failed to setup 3G")
         return False
     if not verify_http_connection(self.log, self.dut):
         self.log.error("Data not available on cell.")
         return False
     if not call_setup_teardown(self.log, self.dut, self.ad_reference,
                                self.dut, is_phone_in_call_3g):
         self.log.error("WFC Call Failed.")
         return False
     if not sms_send_receive_verify(self.log, self.dut, self.ad_reference,
                                    [rand_ascii_str(50)]):
         self.log.error("SMS failed")
         return False
     return True
 def _check_wfc(self, ad, ad_reference):
     if (CAPABILITY_WFC in device_capabilities[self.dut_model] and
             CAPABILITY_WFC in operator_capabilities[self.dut_operator]):
         self.log.info("Check WFC")
         if not phone_setup_iwlan(self.log, ad, True, WFC_MODE_WIFI_PREFERRED,
             self.wifi_network_ssid, self.wifi_network_pass):
             self.log.error("Failed to setup WFC.")
             return False
         if not call_setup_teardown(self.log, ad, ad_reference, ad,
                                    is_phone_in_call_iwlan):
             self.log.error("WFC Call Failed.")
             return False
         if not sms_send_receive_verify(self.log, ad, ad_reference,
                                        [rand_ascii_str(50)]):
             self.log.error("SMS failed")
             return False
     return True
Esempio n. 21
0
    def check_incall_data(self):
        if verify_internet_connection_by_ping(self.log, self.dut):
            self.internet_connection_check_method = verify_internet_connection_by_ping
        elif verify_http_connection(self.log, self.dut):
            self.internet_connection_check_method = verify_http_connection
        else:
            self.dut.log.error("Data test failed")
            raise signals.TestFailure("Data check failed")
        if self.single_phone_test:
            if not initiate_call(
                    self.log, self.dut,
                    self.call_server_number) and wait_for_in_call_active(
                        self.dut, 60, 3):
                self._take_bug_report(self.test_name, self.begin_time)
                raise signals.TestFailure("Unable to make phone call")
        else:
            if not call_setup_teardown(
                    self.log, self.dut, self.android_devices[1],
                    ad_hangup=None):
                self._take_bug_report(self.test_name, self.begin_time)
                raise signals.TestFailure("Unable to make phone call")
        voice_rat = self.dut.droid.telephonyGetCurrentVoiceNetworkType()
        data_rat = self.dut.droid.telephonyGetCurrentDataNetworkType()
        self.dut.log.info("Voice in RAT %s, Data in RAT %s", voice_rat,
                          data_rat)
        try:
            if is_rat_svd_capable(voice_rat.upper()) and is_rat_svd_capable(
                    data_rat.upper()):
                self.dut.log.info("Capable for simultaneous voice and data")

                if not self.internet_connection_check_method(
                        self.log, self.dut):
                    self.dut.log.error("Incall data check failed")
                    raise signals.TestFailure("Incall data check failed")
                else:
                    return True
            else:
                self.dut.log.info(
                    "Not capable for simultaneous voice and data")
                return False
            hangup_call(self.log, self.dut)
        finally:
            for ad in self.android_devices:
                if ad.droid.telecomIsInCall():
                    hangup_call(self.log, ad)
Esempio n. 22
0
 def _check_wfc_enabled(self):
     if not wait_for_wifi_data_connection(self.log, self.dut, True):
         self.dut.log.error("Failed to connect to WIFI")
         return False
     if not wait_for_wfc_enabled(self.log, self.dut):
         self.dut.log.error("WFC is not enabled")
         return False
     if not wait_for_network_rat(self.log,
                                 self.dut,
                                 RAT_FAMILY_WLAN,
                                 voice_or_data=NETWORK_SERVICE_DATA):
         ad.log.info("Data rat can not go to iwlan mode successfully")
         return False
     if not call_setup_teardown(self.log, self.dut, self.ad_reference,
                                self.dut, is_phone_in_call_iwlan):
         self.log.error("WFC Call Failed.")
         return False
     return True
 def _make_phone_call(self, ads):
     self.result_info["Total Calls"] += 1
     begin_time = get_current_epoch_time()
     start_qxdm_loggers(self.log, self.android_devices)
     if not call_setup_teardown(
             self.log,
             ads[0],
             ads[1],
             ad_hangup=ads[random.randrange(0, 2)],
             wait_time_in_call=random.randrange(
                 self.min_phone_call_duration,
                 self.max_phone_call_duration)):
         self.log.error("Call setup and teardown failed.")
         self.result_info["Call Failure"] += 1
         self._take_bug_report("%s_call_failure" % self.test_name,
                               begin_time)
         return False
     self.log.info("Call setup and teardown succeed.")
     return True
 def test_ota_upgrade(self):
     ota_package = self.user_params.get("ota_package")
     if isinstance(ota_package, list):
         ota_package = ota_package[0]
     if ota_package and "dev/null" not in ota_package:
         self.log.info("Upgrade with ota_package %s", ota_package)
         self.log.info("Before OTA upgrade: %s",
                       get_info(self.android_devices))
     else:
         raise signals.TestSkip("No ota_package is defined")
     ota_util = self.user_params.get("ota_util")
     if isinstance(ota_util, list):
         ota_util = ota_util[0]
     if ota_util:
         if "update_engine_client.zip" in ota_util:
             self.user_params["UpdateDeviceOtaTool"] = ota_util
             self.user_params["ota_tool"] = "UpdateDeviceOtaTool"
         else:
             self.user_params["AdbSideloadOtaTool"] = ota_util
             self.user_params["ota_tool"] = "AdbSideloadOtaTool"
     self.log.info("OTA upgrade with %s by %s", ota_package,
                   self.user_params["ota_tool"])
     ota_updater.initialize(self.user_params, self.android_devices)
     tasks = [(self._ota_upgrade, [ad]) for ad in self.android_devices]
     try:
         result = multithread_func(self.log, tasks)
     except Exception as err:
         abort_all_tests(self.log, "Unable to do ota upgrade: %s" % err)
     device_info = get_info(self.android_devices)
     self.log.info("After OTA upgrade: %s", device_info)
     self.results.add_controller_info("AndroidDevice", device_info)
     if len(self.android_devices) > 1:
         caller = self.android_devices[0]
         callee = self.android_devices[1]
         return call_setup_teardown(
             self.log, caller, callee, caller,
             self._get_call_verification_function(caller),
             self._get_call_verification_function(callee)) and result
     return result
    def call_drop_by_modem_crash(self,
                                 call_verification_function=None,
                                 vt=False):
        if vt:
            if not video_call_setup_teardown(
                    self.log,
                    self.dut,
                    self.ad_reference,
                    None,
                    video_state=VT_STATE_BIDIRECTIONAL,
                    verify_caller_func=is_phone_in_call_video_bidirectional,
                    verify_callee_func=is_phone_in_call_video_bidirectional):
                self.dut.log.error("VT Call Failed.")
                return False
        else:
            if not call_setup_teardown(
                    self.log,
                    self.dut,
                    self.ad_reference,
                    ad_hangup=None,
                    verify_caller_func=call_verification_function,
                    wait_time_in_call=10):
                self.log.error("Call setup failed")
                return False

        # Modem SSR
        self.modem_crash()

        try:
            if self.dut.droid.telecomIsInCall():
                self.dut.log.info("Still in call after trigger modem crash")
                return False
            else:
                reasons = self.dut.search_logcat(
                    "qcril_qmi_voice_map_qmi_to_ril_last_call_failure_cause")
                if reasons:
                    self.dut.log.info(reasons[-1]["log_message"])
        except Exception as e:
            self.dut.log.error(e)
Esempio n. 26
0
 def _setup_phone_active_call(self, ad, phone_setup_func,
                              phone_idle_check_func,
                              phone_in_call_check_func):
     if not phone_setup_func(self.log, ad):
         self.log.error("DUT Failed to Set Up Properly: {}".format(
             phone_setup_func.__name__))
         return False
     ensure_phones_idle(self.log, [ad, self.android_devices[1]])
     if not phone_idle_check_func(self.log, ad):
         self.log.error("DUT not in correct idle state: {}".format(
             phone_idle_check_func.__name__))
         return False
     if not call_setup_teardown(
             self.log,
             ad,
             self.android_devices[1],
             ad_hangup=None,
             verify_caller_func=phone_in_call_check_func):
         self.log.error("Setup Call failed.")
         return False
     ad.droid.goToSleepNow()
     return True
Esempio n. 27
0
    def test_sms_mo_in_call_csfb_1x(self):
        """ Test MO SMS during a MO csfb 1x call.

        Make Sure PhoneA is in LTE mode (no VoLTE).
        Make Sure PhoneB is able to make/receive call.
        Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA.

        Returns:
            True if pass; False if fail.
        """
        ads = self.android_devices
        # make sure PhoneA is CDMA phone before proceed.
        if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA):
            self.log.error("Not CDMA phone, abort this csfb 1x SMS test.")
            return False

        tasks = [(phone_setup_csfb, (self.log, ads[0])),
                 (phone_setup_voice_general, (self.log, ads[1]))]
        if not multithread_func(self.log, tasks):
            self.log.error("Phone Failed to Set Up Properly.")
            return False

        self.log.info("Begin In Call SMS Test.")
        if not call_setup_teardown(self.log,
                                   ads[0],
                                   ads[1],
                                   ad_hangup=None,
                                   verify_caller_func=is_phone_in_call_1x,
                                   verify_callee_func=None):
            return False

        if not self._sms_test_mo(ads):
            self.log.error("SMS test fail.")
            return False

        return True
Esempio n. 28
0
    def test_sms_mt_in_call_gsm(self):
        """ Test MT SMS during a MO gsm call.

        Make Sure PhoneA is in gsm mode.
        Make Sure PhoneB is able to make/receive call.
        Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA.

        Returns:
            True if pass; False if fail.
        """
        ads = self.android_devices
        # make sure PhoneA is GSM phone before proceed.
        if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
            self.log.error("Not GSM phone, abort this gsm SMS test.")
            return False

        tasks = [(phone_setup_voice_2g, (self.log, ads[0])),
                 (phone_setup_voice_general, (self.log, ads[1]))]
        if not multithread_func(self.log, tasks):
            self.log.error("Phone Failed to Set Up Properly.")
            return False

        self.log.info("Begin In Call SMS Test.")
        if not call_setup_teardown(self.log,
                                   ads[0],
                                   ads[1],
                                   ad_hangup=None,
                                   verify_caller_func=is_phone_in_call_2g,
                                   verify_callee_func=None):
            return False

        if not self._sms_test_mt(ads):
            self.log.error("SMS test fail.")
            return False

        return True
Esempio n. 29
0
 def _check_volte(self):
     if CAPABILITY_VOLTE in self.dut_capabilities:
         self._set_volte_provisioning()
         if not self._check_volte_provisioning():
             return False
         self.log.info("Check VoLTE")
         if not wait_for_state(self.dut.droid.imsIsVolteProvisionedOnDevice,
                               True):
             self.dut.log.error("VoLTE provisioning is disabled.")
             return False
         if not phone_setup_volte(self.log, self.dut):
             self.log.error("Failed to setup VoLTE.")
             return False
         time.sleep(5)
         if not call_setup_teardown(self.log, self.dut, self.ad_reference,
                                    self.dut, is_phone_in_call_volte):
             self.log.error("VoLTE Call Failed.")
             return False
         if not self._check_lte_data():
             return False
     else:
         self.dut.log.info("VoLTE is not supported")
         return False
     return True
Esempio n. 30
0
def two_phone_call_long_seq(log,
                            phone_a,
                            phone_a_idle_func,
                            phone_a_in_call_check_func,
                            phone_b,
                            phone_b_idle_func,
                            phone_b_in_call_check_func,
                            call_sequence_func=None,
                            wait_time_in_call=WAIT_TIME_IN_CALL):
    """Call process long sequence.
    1. Ensure phone idle and in idle_func check return True.
    2. Call from PhoneA to PhoneB, accept on PhoneB.
    3. Check phone state, hangup on PhoneA.
    4. Ensure phone idle and in idle_func check return True.
    5. Call from PhoneA to PhoneB, accept on PhoneB.
    6. Check phone state, hangup on PhoneB.
    7. Ensure phone idle and in idle_func check return True.
    8. Call from PhoneB to PhoneA, accept on PhoneA.
    9. Check phone state, hangup on PhoneA.
    10. Ensure phone idle and in idle_func check return True.
    11. Call from PhoneB to PhoneA, accept on PhoneA.
    12. Check phone state, hangup on PhoneB.

    Args:
        phone_a: PhoneA's android device object.
        phone_a_idle_func: function to check PhoneA's idle state.
        phone_a_in_call_check_func: function to check PhoneA's in-call state.
        phone_b: PhoneB's android device object.
        phone_b_idle_func: function to check PhoneB's idle state.
        phone_b_in_call_check_func: function to check PhoneB's in-call state.
        call_sequence_func: default parameter, not implemented.
        wait_time_in_call: time to wait in call.
            This is optional, default is WAIT_TIME_IN_CALL

    Returns:
        True: if call sequence succeed.
        False: for errors
    """
    ads = [phone_a, phone_b]

    call_params = [
        (ads[0], ads[1], ads[0], phone_a_in_call_check_func,
         phone_b_in_call_check_func),
        (ads[0], ads[1], ads[1], phone_a_in_call_check_func,
         phone_b_in_call_check_func),
        (ads[1], ads[0], ads[0], phone_b_in_call_check_func,
         phone_a_in_call_check_func),
        (ads[1], ads[0], ads[1], phone_b_in_call_check_func,
         phone_a_in_call_check_func),
    ]

    for param in call_params:
        # Make sure phones are idle.
        ensure_phones_idle(log, ads)
        if phone_a_idle_func and not phone_a_idle_func(log, phone_a):
            log.error("Phone A Failed to Reselect")
            return False
        if phone_b_idle_func and not phone_b_idle_func(log, phone_b):
            log.error("Phone B Failed to Reselect")
            return False

        # TODO: b/26337871 Need to use proper API to check phone registered.
        time.sleep(WAIT_TIME_BETWEEN_REG_AND_CALL)

        # Make call.
        log.info("---> Call test: {} to {} <---".format(
            param[0].serial, param[1].serial))
        if not call_setup_teardown(
                log, *param, wait_time_in_call=wait_time_in_call):
            log.error("Call Iteration Failed")
            return False

    return True