diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index d48ed2e4..3a0573f0 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -195,24 +195,25 @@ def adb_twrp_wipe_and_install( sleep(5) logger.info("Sideload and install os image.") for line in adb_sideload(bin_path=bin_path, target=target): - if line: - yield line + yield line # wipe some cache partitions sleep(7) for partition in ["dalvik", "cache"]: - for line in adb_twrp_wipe_partition(bin_path=bin_path, partition=partition): + for line in run_command(f"adb shell twrp wipe {partition}", bin_path): yield line + sleep(1) if (type(line) == bool) and not line: logger.error(f"Wiping {partition} failed.") # TODO: if this fails, a fix can be to just sideload something and then adb reboot - sleep(1) - for line in adb_sideload( - bin_path=bin_path, - target=f"{config_path.parent.joinpath(Path('helper.txt'))}", + for line in run_command( + f"adb sideload {config_path.parent.joinpath(Path('helper.txt'))}", + bin_path, ): yield line - sleep(1) + if (type(line) == bool) and not line: + yield False break + sleep(2) # finally reboot into os or to fastboot for flashing addons sleep(7) if install_addons: @@ -222,7 +223,9 @@ def adb_twrp_wipe_and_install( yield line sleep(3) # boot to TWRP again - for line in fastboot_flash_boot(bin_path=bin_path, recovery=recovery): + for line in fastboot_flash_recovery( + bin_path=bin_path, recovery=recovery, is_ab=is_ab + ): yield line sleep(7) else: @@ -317,7 +320,10 @@ def fastboot_reboot(bin_path: Path) -> Union[str, bool]: yield line -def fastboot_flash_recovery(bin_path: Path, recovery: str, is_ab: bool = True) -> bool: +@add_logging("Flash or boot custom recovery with fastboot.") +def fastboot_flash_recovery( + bin_path: Path, recovery: str, is_ab: bool = True +) -> Union[str, bool]: """Temporarily, flash custom recovery with fastboot.""" if is_ab: logger.info("Boot custom recovery with fastboot.") @@ -337,12 +343,6 @@ def fastboot_flash_recovery(bin_path: Path, recovery: str, is_ab: bool = True) - for line in run_command("fastboot reboot recovery", bin_path): yield line - if (type(line) == bool) and not line: - logger.error("Booting recovery failed.") - yield False - else: - yield True - def fastboot_flash_boot(bin_path: Path, recovery: str) -> bool: """Temporarily, flash custom recovery with fastboot to boot partition.""" diff --git a/openandroidinstaller/views/base.py b/openandroidinstaller/views/base.py index a45dcef8..f4975ba5 100644 --- a/openandroidinstaller/views/base.py +++ b/openandroidinstaller/views/base.py @@ -34,7 +34,7 @@ def __init__(self, state: AppState, image: str = "placeholder.png"): # right part of the display, add content here. self.right_view_header = Column(width=self.column_width, height=100, spacing=30) self.right_view = Column( - alignment="center", width=self.column_width, height=650 + alignment="center", width=self.column_width, height=650, scroll="auto" ) # left part of the display: used for displaying the images self.left_view = Column(