def setup_class(self): self.hotspot_device = self.android_devices[0] self.tethered_devices = self.android_devices[1:] req_params = ("ssid", "password", "url") self.unpack_userparams(req_params) self.network = {"SSID": self.ssid, "password": self.password} self.offset = 1 * 60 self.hz = 5000 self.duration = 9 * 60 + self.offset self.mon_data_path = os.path.join(self.log_path, "Monsoon") self.mon = self.monsoons[0] self.mon.set_voltage(4.2) self.mon.set_max_current(7.8) self.mon.attach_device(self.hotspot_device) asserts.assert_true(self.mon.usb("auto"), "Failed to turn USB mode to auto on monsoon.") set_location_service(self.hotspot_device, False) set_adaptive_brightness(self.hotspot_device, False) set_ambient_display(self.hotspot_device, False) self.hotspot_device.adb.shell( "settings put system screen_brightness 0") set_auto_rotate(self.hotspot_device, False) wutils.wifi_toggle_state(self.hotspot_device, False) self.hotspot_device.droid.telephonyToggleDataConnection(True) tel_utils.wait_for_cell_data_connection(self.log, self.hotspot_device, True) asserts.assert_true( tel_utils.verify_http_connection(self.log, self.hotspot_device), "HTTP verification failed on cell data connection") for ad in self.tethered_devices: wutils.reset_wifi(ad)
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 _configure_dut(self): try: self.log.info("Rebooting DUT") self.ad.reboot() self.log.info("DUT rebooted") set_adaptive_brightness(self.ad, False) set_ambient_display(self.ad, False) set_auto_rotate(self.ad, False) set_location_service(self.ad, False) # This is not needed for AOSP build disable_doze(self.ad) set_phone_screen_on(self.log, self.ad, 15) self.ad.droid.telephonyFactoryReset() except Exception as e: self.ad.log.error(e) return False return True
def setup_class(self): # Not to call Base class setup_class() # since it removes the bonded devices for ad in self.android_devices: sync_device_time(ad) self.ad = self.android_devices[0] self.mon = self.monsoons[0] self.mon.set_voltage(self.MONSOON_OUTPUT_VOLTAGE) self.mon.set_max_current(self.MONSOON_MAX_CURRENT) # Monsoon phone self.mon.attach_device(self.ad) self.monsoon_log_path = os.path.join(self.log_path, "MonsoonLog") create_dir(self.monsoon_log_path) asserts.assert_true(self.mon.usb("auto"), "Failed to turn USB mode to auto on monsoon.") asserts.assert_true( force_airplane_mode(self.ad, True), "Can not turn on airplane mode on: %s" % self.ad.serial) asserts.assert_true(bluetooth_enabled_check(self.ad), "Failed to set Bluetooth state to enabled") set_location_service(self.ad, False) set_adaptive_brightness(self.ad, False) set_ambient_display(self.ad, False) self.ad.adb.shell("settings put system screen_brightness 0") set_auto_rotate(self.ad, False) set_phone_screen_on(self.log, self.ad, self.SCREEN_TIME_OFF) wutils.wifi_toggle_state(self.ad, False) # Start PMC app. self.log.info("Start PMC app...") self.ad.adb.shell(self.START_PMC_CMD) self.ad.adb.shell(self.PMC_VERBOSE_CMD) self.log.info("Check to see if PMC app started") for _ in range(self.WAIT_TIME): time.sleep(1) try: self.ad.adb.shell('ps -A | grep "S com.android.pmc"') break except adb.AdbError as e: self.log.info("PMC app is NOT started yet")
def setup_class(self): super().setup_class() self.mon = self.monsoons[0] self.mon.set_voltage(MONSOON_OUTPUT_VOLTAGE) self.mon.set_max_current(MONSOON_MAX_CURRENT) # Monsoon phone self.mon.dut = self.ad = self.android_devices[0] set_adaptive_brightness(self.ad, False) set_ambient_display(self.ad, False) set_auto_rotate(self.ad, False) set_location_service(self.ad, False) # This is not needed for AOSP build disable_doze(self.ad) set_phone_screen_on(self.log, self.ad, 15) self.wifi_network_ssid_2g = self.user_params["wifi_network_ssid_2g"] self.wifi_network_pass_2g = self.user_params["wifi_network_pass_2g"] self.wifi_network_ssid_5g = self.user_params["wifi_network_ssid_5g"] self.wifi_network_pass_5g = self.user_params["wifi_network_pass_5g"] self.monsoon_log_path = os.path.join(self.log_path, "MonsoonLog") create_dir(self.monsoon_log_path) return True
def setup_class(self): self.offset = 5 * 60 self.hz = 5000 self.scan_interval = 15 # Continuosly download self.download_interval = 0 self.mon_data_path = os.path.join(self.log_path, "Monsoon") self.mon = self.monsoons[0] self.mon.set_voltage(4.2) self.mon.set_max_current(7.8) self.dut = self.android_devices[0] self.mon.attach_device(self.dut) asserts.assert_true(self.mon.usb("auto"), "Failed to turn USB mode to auto on monsoon.") asserts.assert_true( force_airplane_mode(self.dut, True), "Can not turn on airplane mode on: %s" % self.dut.serial) set_location_service(self.dut, False) set_adaptive_brightness(self.dut, False) set_ambient_display(self.dut, False) self.dut.adb.shell("settings put system screen_brightness 0") set_auto_rotate(self.dut, False) required_userparam_names = ( # These two params should follow the format of # {"SSID": <SSID>, "password": <Password>} "network_2g", "network_5g", "iperf_server_address") self.unpack_userparams(required_userparam_names, threshold=None) wutils.wifi_test_device_init(self.dut) try: self.attn = self.attenuators[0] self.attn.set_atten(0) except AttributeError: self.log.warning("No attenuator found, some tests will fail.") pass