Skip to content

Commit

Permalink
Fix wiping cache after install
Browse files Browse the repository at this point in the history
  • Loading branch information
tsterbak committed Feb 9, 2023
1 parent 93d8711 commit d280c14
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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.")
Expand All @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d280c14

Please sign in to comment.