Example #1
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
 def _setup_wfc(self):
     if not set_wfc_mode(self.log, self.ad, WFC_MODE_WIFI_PREFERRED):
         self.log.error("Phone failed to enable Wifi-Calling.")
         return False
     self.log.info("Phone is set in Wifi-Calling successfully.")
     if not phone_idle_iwlan(self.log, self.ad):
         self.log.error("DUT not in WFC enabled state.")
         return False
     return True
    def _wifi_connected_enable_wfc_teardown_wfc(
            self,
            tear_down_operation,
            initial_setup_wifi=True,
            initial_setup_wfc_mode=WFC_MODE_WIFI_PREFERRED,
            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
        if initial_setup_wfc_mode and not set_wfc_mode(self.log, self.ad,
                                                       initial_setup_wfc_mode):
            self.log.error("Failed to set WFC mode.")
            return False
        if not phone_idle_iwlan(self.log, self.ad):
            self.log.error("WFC is not available.")
            return False

        # Tear Down WFC based on tear_down_operation
        if tear_down_operation == self._TEAR_DOWN_OPERATION_DISCONNECT_WIFI:
            if not WifiUtils.wifi_toggle_state(self.log, self.ad, False):
                self.log.error("Failed to turn off WiFi.")
                return False
        elif tear_down_operation == self._TEAR_DOWN_OPERATION_RESET_WIFI:
            if not WifiUtils.wifi_reset(self.log, self.ad, False):
                self.log.error("Failed to reset WiFi")
                return False
        elif tear_down_operation == self._TEAR_DOWN_OPERATION_DISABLE_WFC:
            if not set_wfc_mode(self.log, self.ad, WFC_MODE_DISABLED):
                self.log.error("Failed to turn off WFC.")
                return False
        else:
            self.log.error("No tear down operation")
            return False

        if not wait_for_not_network_rat(self.log,
                                        self.ad,
                                        RAT_FAMILY_WLAN,
                                        voice_or_data=NETWORK_SERVICE_DATA):
            self.log.error("Data Rat is still iwlan.")
            return False
        if not wait_for_wfc_disabled(self.log, self.ad):
            self.log.error("WFC is still available after turn off WFC.")
            return False

        # If VoLTE was previous available, after tear down WFC, DUT should have
        # VoLTE service.
        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
Example #4
0
 def _setup_wfc(self):
     for ad in self.android_devices:
         if not ensure_wifi_connected(ad.log,
                                      ad,
                                      self.wifi_network_ssid,
                                      self.wifi_network_pass,
                                      retries=3):
             ad.log.error("Phone Wifi connection fails.")
             return False
         ad.log.info("Phone WIFI is connected successfully.")
         if not set_wfc_mode(self.log, ad, WFC_MODE_WIFI_PREFERRED):
             ad.log.error("Phone failed to enable Wifi-Calling.")
             return False
         ad.log.info("Phone is set in Wifi-Calling successfully.")
         if not phone_idle_iwlan(self.log, ad):
             ad.log.error("Phone is not in WFC enabled state.")
             return False
         ad.log.info("Phone is in WFC enabled state.")
     return True
 def _wifi_connected_set_wfc_mode_turn_off_apm(
         self, wfc_mode, is_wfc_available_after_turn_off_apm):
     if 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
     if not set_wfc_mode(self.log, self.ad, wfc_mode):
         self.log.error("Failed to set WFC mode.")
         return False
     if not phone_idle_iwlan(self.log, self.ad):
         self.log.error("WFC is not available.")
         return False
     if not toggle_airplane_mode(self.log, self.ad, False):
         self.log.error("Failed to turn off airplane mode")
         return False
     is_wfc_not_available = wait_for_wfc_disabled(self.log, self.ad)
     if is_wfc_available_after_turn_off_apm and is_wfc_not_available:
         self.log.error("WFC is not available.")
         return False
     elif (not is_wfc_available_after_turn_off_apm
           and not is_wfc_not_available):
         self.log.error("WFC is available.")
         return False
     return True
 def _phone_idle_iwlan(self):
     return phone_idle_iwlan(self.log, self.android_devices[0])