Skip to content

Commit 30761b6

Browse files
committed
Simplify fastboot_boot_recovery
1 parent fa5d04d commit 30761b6

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

openandroidinstaller/tooling.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -382,30 +382,19 @@ def fastboot_boot_recovery(
382382
bin_path: Path, recovery: str, is_ab: bool = True
383383
) -> TerminalResponse:
384384
"""Temporarily, boot custom recovery with fastboot."""
385-
# TODO: this can be unified now
386-
if is_ab:
387-
logger.info("Boot custom recovery with fastboot.")
388-
for line in run_command(
389-
"fastboot boot", target=f"{recovery}", bin_path=bin_path
390-
):
391-
yield line
392-
logger.info("Boot into TWRP with fastboot.")
393-
for line in adb_wait_for_recovery(bin_path=bin_path):
394-
yield line
395-
else:
396-
logger.info("Boot custom recovery with fastboot.")
397-
for line in run_command(
398-
"fastboot boot", target=f"{recovery}", bin_path=bin_path
399-
):
400-
yield line
385+
logger.info("Boot custom recovery with fastboot.")
386+
for line in run_command(
387+
"fastboot boot", target=f"{recovery}", bin_path=bin_path
388+
):
389+
yield line
390+
if not is_ab:
401391
if (type(line) == bool) and not line:
402392
logger.error("Booting recovery failed.")
403393
yield False
404394
else:
405395
yield True
406-
logger.info("Boot into TWRP with fastboot.")
407-
for line in adb_wait_for_recovery(bin_path=bin_path):
408-
yield line
396+
for line in adb_wait_for_recovery(bin_path=bin_path):
397+
yield line
409398

410399

411400
def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse:

0 commit comments

Comments
 (0)