def coex_test_phone_setup(self, Screen_status, WiFi_status, WiFi_band, BT_status, BLE_status, Cellular_status, Celluar_band): """Setup the phone in desired state for coex tests. Args: Screen_status: 'ON' or 'OFF' WiFi_status: 'ON', 'Connected', 'Disconnected', or 'OFF' WiFi_band: '2g', '5g' or None, the band of AP BT_status: 'ON' or 'OFF' BLE_status: 'ON' or 'OFF' Cellular_status: 'ON' or 'OFF' Celluar_band: 'Verizon', 'Tmobile', or 'ATT' for live network, actual band for callbox setup; 'None' when celluar is OFF """ # Setup WiFi if WiFi_status is 'ON': wutils.wifi_toggle_state(self.dut, True) elif WiFi_status is 'Connected': self.setup_ap_connection(self.main_network[WiFi_band]) elif WiFi_status is 'Disconnected': self.setup_ap_connection(self.main_network[WiFi_band], connect=False) # Setup BT/BLE self.phone_setup_for_BT(BT_status, BLE_status, Screen_status) # Setup Cellular if Cellular_status is 'ON': self.dut.droid.connectivityToggleAirplaneMode(False) utils.set_mobile_data_always_on(self.dut, True)
def test_power_mobile_data_always_on_gsm(self): try: PASS_CRITERIA = int( self.user_params["pass_criteria_mobile_data_always_on_gsm"] ["pass_criteria"]) except KeyError: PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA result = self._test_power_idle("test_power_mobile_data_always_on_gsm", self._setup_phone_mobile_data_always_on, PASS_CRITERIA, phone_setup_func=phone_setup_voice_2g, connect_wifi=False) set_mobile_data_always_on(self.ad, False) return result
def test_disable_mobile_data_always_on(self): """Verify mobile_data_always_on can be disabled. Steps: 1. Disable mobile_data_always_on by adb. 2. Verify the mobile data_always_on state. Expected Results: mobile_data_always_on return 0. """ self.dut.log.info("Disable mobile_data_always_on") set_mobile_data_always_on(self.dut, False) time.sleep(1) return self.dut.adb.shell( "settings get global mobile_data_always_on") == "0"
def test_enable_mobile_data_always_on(self): """Verify mobile_data_always_on can be enabled. Steps: 1. Enable mobile_data_always_on by adb. 2. Verify the mobile data_always_on state. Expected Results: mobile_data_always_on return 1. """ self.dut.log.info("Enable mobile_data_always_on") set_mobile_data_always_on(self.dut, True) time.sleep(1) return "1" in self.dut.adb.shell( "settings get global mobile_data_always_on")
def dut_rockbottom(self): """Set the phone into Rock-bottom state. """ self.dut.log.info('Now set the device to Rockbottom State') utils.require_sl4a((self.dut, )) self.dut.droid.connectivityToggleAirplaneMode(False) time.sleep(2) self.dut.droid.connectivityToggleAirplaneMode(True) time.sleep(2) utils.set_ambient_display(self.dut, False) utils.set_auto_rotate(self.dut, False) utils.set_adaptive_brightness(self.dut, False) utils.sync_device_time(self.dut) utils.set_location_service(self.dut, False) utils.set_mobile_data_always_on(self.dut, False) utils.disable_doze_light(self.dut) utils.disable_doze(self.dut) wutils.reset_wifi(self.dut) wutils.wifi_toggle_state(self.dut, False) try: self.dut.droid.nfcDisable() except acts.controllers.sl4a_lib.rpc_client.Sl4aApiError: self.dut.log.info('NFC is not available') self.dut.droid.setScreenBrightness(0) self.dut.adb.shell(AOD_OFF) self.dut.droid.setScreenTimeout(2200) self.dut.droid.wakeUpNow() self.dut.adb.shell(LIFT) self.dut.adb.shell(DOUBLE_TAP) self.dut.adb.shell(JUMP_TO_CAMERA) self.dut.adb.shell(RAISE_TO_CAMERA) self.dut.adb.shell(FLIP_CAMERA) self.dut.adb.shell(ASSIST_GESTURE) self.dut.adb.shell(ASSIST_GESTURE_ALERT) self.dut.adb.shell(ASSIST_GESTURE_WAKE) self.dut.adb.shell(SCREENON_USB_DISABLE) self.dut.adb.shell(UNLOCK_SCREEN) self.dut.adb.shell(SETTINGS_PAGE) self.dut.adb.shell(SCROLL_BOTTOM) self.dut.adb.shell(MUSIC_IQ_OFF) self.dut.adb.shell(AUTO_TIME_OFF) self.dut.adb.shell(AUTO_TIMEZONE_OFF) self.dut.adb.shell(FORCE_YOUTUBE_STOP) self.dut.adb.shell(FORCE_DIALER_STOP) self.dut.droid.wifiSetCountryCode('US') self.dut.droid.wakeUpNow() self.dut.log.info('Device has been set to Rockbottom state') self.dut.log.info('Screen is ON')
def test_power_mobile_data_always_on_1xevdo_wifi_on(self): try: PASS_CRITERIA = int(self.user_params[ "pass_criteria_mobile_data_always_on_1xevdo_wifi_on"] ["pass_criteria"]) except KeyError: PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA result = self._test_power_idle( "test_power_mobile_data_always_on_1xevdo_wifi_on", self._setup_phone_mobile_data_always_on, PASS_CRITERIA, phone_setup_func=phone_setup_voice_3g, connect_wifi=True, wifi_ssid=self.wifi_network_ssid_2g, wifi_password=self.wifi_network_pass_2g) set_mobile_data_always_on(self.ad, False) return result
def _setup_phone_mobile_data_always_on(self, ad, phone_setup_func, connect_wifi, wifi_ssid=None, wifi_password=None, mobile_data_always_on=True): set_mobile_data_always_on(ad, mobile_data_always_on) if not phone_setup_func(self.log, ad): self.log.error("Phone failed to setup {}.".format( phone_setup_func.__name__)) return False if (connect_wifi and not ensure_wifi_connected(self.log, ad, wifi_ssid, wifi_password)): self.log.error("WiFi connect failed") return False # simulate normal user behavior -- wake up every 1 minutes and do ping # (transmit data) if not self._start_alarm(): return False ad.droid.goToSleepNow() return True
def _test_setup(self, apm=False, rat=None, volte=False, wifi=None, wfc=False, mobile_data_always_on=False, periodic_ping=False, active_call=False): if not ensure_phones_default_state(self.log, self.android_devices): self.log.error("Fail to set phones in default state") return False else: self.log.info("Set phones in default state successfully") if apm and not self._setup_apm(): return False if rat and not self._setup_rat(rat, volte): return False if wifi and not self._setup_wifi(wifi): return False if wfc and not self._setup_wfc(): return False if mobile_data_always_on: set_mobile_data_always_on(self.ad, True) if periodic_ping and not self._start_alarm(): return False if active_call and not self._setup_phone_active_call(): return False self.ad.droid.goToSleepNow() return True