Ejemplo n.º 1
0
    def do(self):
        if local_utils.has_fastboot_serial(serial=self.serial):
            fastboot_steps.continue_to_adb(serial=self.serial, blocking=True)()

        local_steps.wait_for_adb(serial=self.serial, blocking=True)()

        adb_steps.wait_for_ui(serial=self.serial, pin=self.pin,
                              blocking=True)()

        adb_steps.command(serial=self.serial,
                          command="svc power stayon true")()

        ui_steps.remove_pin_screen_lock(serial=self.serial,
                                        pin=self.pin,
                                        blocking=True)()

        if self.set_screen_lock:
            ui_steps.set_pin_screen_lock(
                serial=self.serial,
                dut_pin=self.pin,
                require_pin_to_start_device=self.require_pin_to_start_device,
                blocking=True)()

        if self.set_wifi:
            wifi_steps.remove_network(serial=self.serial,
                                      ap_name=self.ap_name)()
            wifi_steps.connect_with_password(serial=self.serial,
                                             ap_name=self.ap_name,
                                             password=self.ap_password,
                                             blocking=True)()
        ui_steps.press_home(serial=self.serial)()
Ejemplo n.º 2
0
    def do(self):
        print "{0}: {1}".format(self.serial, self.img_path)
        ################################################################################
        # Device has to be in fastboot
        #   - if already in fastboot, do nothing
        #   - if it has adb, reboot in fastboot via adb
        #   - for any other state:
        #       * force poweroff via relay
        #       * boot in fastboot via relay (poweron & volume down)
        ################################################################################
        print "{0}: reboot to fastboot".format(self.serial)
        if local_utils.has_fastboot_serial(self.serial):
            pass
        elif local_utils.has_adb_serial(self.serial):
            adb_steps.reboot(serial=self.serial, command="fastboot")()
        else:
            ############################################################################
            # device file should be made dynamic to support multiple relays
            ############################################################################
            print "{0}: Relay needed!!!!!!!!".format(self.serial)
            my_relay = Relay(port=self.device["relay"]["tty"])
            my_relay.power_on(self.device["relay"]["v_up_port"])
            my_relay.power_on(self.device["relay"]["power_port"])
            my_relay.close()
        print "{0}: Done rebooting for fastboot!".format(self.serial)

        print "{0}: Wait for fastboot".format(self.serial)
        local_steps.wait_for_fastboot(serial=self.serial, timeout=100)()
        print "{0}: Done waiting for fastboot!".format(self.serial)
        old_folder, err = local_steps.command("pwd")()

        local_steps.change_dir(new_folder=self.img_path)()
        print "{0}: Wait for flash-all.sh".format(self.serial)
        #TODO: add stdout_gprep for flash-all.sh
        sout, serr = local_steps.command(
            command="./flash-all.sh -s {0}".format(self.serial))()
        print "{0}: Done! Image flashed".format(self.serial)
        print "{0}: Wait for adb".format(self.serial)

        local_steps.wait_for_adb(serial=self.serial, timeout=720)()
        print "{0}: Done! adb connected".format(self.serial)
        local_steps.change_dir(new_folder=old_folder.strip())()
Ejemplo n.º 3
0
 def check_condition(self):
     self.step_data = local_utils.has_fastboot_serial(
         serial=self.serial, iterations=self.timeout)
     return self.step_data
Ejemplo n.º 4
0
 def check_condition(self):
     return local_utils.has_fastboot_serial(serial=self.serial,
                                            iterations=20)
Ejemplo n.º 5
0
from testlib.scripts.android.adb import adb_utils

globals().update(vars(get_args(sys.argv)))
#globals().update({"version": adb_utils.get_android_version()})
PATH_TO_BUILD="/home/ccarabas/work/cts-dispatcher/repair/latest"


################################################################################
# Device has to be in fastboot
#   - if already in fastboot, do nothing
#   - if it has adb, reboot in fastboot via adb
#   - for any other state:
#       * force poweroff via relay
#       * boot in fastboot via relay (poweron & volume down)
################################################################################
if local_utils.has_fastboot_serial(serial):
    pass
elif local_utils.has_adb_serial(serial):
    adb_steps.reboot(serial = serial, command="fastboot", ip_enabled=False)()
else:
    ############################################################################
    # device file should be made dynamic to support multiple relays
    ############################################################################
    my_relay = Relay(port = "/dev/ttyACM0")
    my_relay.power_off()
    my_relay.enter_fastboot()
    my_relay.close()

local_steps.wait_for_fastboot(serial = serial,
                              timeout = 20)()