Exemplo n.º 1
0
def flash_bxt_m_fused(eb_user_patch_flashfiles_zip_name=None,
                      eb_userdebug_patch_flashfiles_zip_name=None,
                      support_flash=False,
                      serial=None):
    unpack_the_zip(file_name="./temp/image/eb/userdebug/" +
                   eb_userdebug_patch_flashfiles_zip_name,
                   temp_path=r"./temp/image/eb/userdebug/flashfiles")
    unpack_the_zip(file_name="./temp/image/eb/user/" +
                   eb_user_patch_flashfiles_zip_name,
                   temp_path=r"./temp/image/eb/user/flashfiles")
    os.system(
        "cp -f ./temp/image/eb/userdebug/flashfiles/boot.img ./temp/image/eb/user/flashfiles"
    )
    if support_flash:
        os.system(
            "cp -f ./temp/image/eb/userdebug/flashfiles/ifwi_gr_mrb_b1.bin ./temp/image/eb/user/flashfiles"
        )
    make_the_zip(dir_name="./temp/image/eb/user/flashfiles/",
                 file_name="./temp/image/eb/flashfiles.zip")

    flash_bxt(flash_ioc="True",
              flash_ifwi="False",
              flash_android="True",
              zip_file="./temp/image/eb/flashfiles.zip",
              serial=serial,
              sleep_time=30,
              wait_for_adb=False)
    flash_bxt(flash_ioc="False",
              flash_ifwi="True",
              flash_android="False",
              zip_file="./temp/image/eb/flashfiles.zip",
              serial=serial,
              sleep_time=30,
              wait_for_adb=False)
    to_fastboot_by_script(serial=serial)
    time.sleep(30)
    local_steps.wait_for_fastboot(timeout=300, serial=serial)()
    os.system("fastboot reboot > /dev/null 2>&1")
    time.sleep(120)

    push_uiautomator_jar(serial=serial)
    d = Device(serial)
    time.sleep(5)
    if d(text="To start Android, enter your password").exists:
        d(resourceId="com.android.settings:id/passwordEntry").click.wait()
        time.sleep(5)
        os.system("adb -s {0} shell input text 1234".format(serial))
        time.sleep(5)
        os.system("adb -s {0} shell input keyevent 66".format(serial))
        time.sleep(5)
    if d(text="Decryption unsuccessful").exists:
        d(text="Reset phone").click.wait()
        time.sleep(120)
    local_steps.wait_for_adb(timeout=300, serial=serial)()
Exemplo 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())()
Exemplo n.º 3
0
from testlib.base.base_utils import get_args
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.fastboot import fastboot_steps
from testlib.scripts.android.fastboot import fastboot_utils
from testlib.scripts.connections.local import local_steps

##### initialization #####
globals().update(vars(get_args(sys.argv)))

##### test start #####
try:
	os.system("mkdir -p ./temp/files/flash")
	fastboot_utils.download_flash_scripts()

	adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)()
	local_steps.wait_for_fastboot(timeout=300, serial=serial)()
	fastboot_steps.continue_to_adb(serial=serial)()
	local_steps.wait_for_adb(timeout=300, serial=serial)()

	os.system("adb -s {0} shell reboot -p".format(serial))
	time.sleep(30)
	fastboot_utils.to_fastboot_by_script(serial=serial)
	local_steps.wait_for_fastboot(timeout=300, serial=serial)()
	fastboot_steps.continue_to_adb(serial=serial)()
	local_steps.wait_for_adb(timeout=300, serial=serial)()
	os.system("sudo rm -rf ./temp")

except:
	fastboot_utils.to_fastboot_by_script(serial=serial)
	local_steps.wait_for_fastboot(timeout=300, serial=serial)()
	fastboot_steps.continue_to_adb(serial=serial)()
                               wait_ui=True)()

    ui_steps.wake_up_device(serial=serial)()
    ui_steps.unlock_device(serial=serial)()

    dessert = adb_utils.get_android_version(serial=serial)

    # Disable OEM unlock in developer options #
    ui_steps.disable_options_from_developer_options(
        serial=serial, developer_options=[dev_oem_option])()

    # Reboot into bootloader
    #adb_steps.reboot(command="fastboot", serial=serial)()
    local_steps.command(
        command="adb -s {0} reboot bootloader".format(serial))()
    local_steps.wait_for_fastboot(serial=serial, timeout=60)()

    # Check unlock ability (should be disabled)
    fastboot_steps.command(serial=serial,
                           command=get_unlock_ability_command,
                           stderr_grep=unlock_disabled_output,
                           timeout=20)()

    # Attempt to unlock bootloader
    relay_steps.change_state(serial=serial,
                             dessert=dessert,
                             unlock_bootloader="yes",
                             oem_unlock_enabled="no",
                             relay_type=relay_type,
                             relay_port=relay_port,
                             power_port=power_port,