@@ -150,7 +150,7 @@ def adb_twrp_copy_partitions(bin_path: Path, config_path: Path):
150150 return True
151151
152152
153- def adb_twrp_wipe_and_install (bin_path : Path , target : str , config_path : Path ) -> bool :
153+ def adb_twrp_wipe_and_install (bin_path : Path , target : str , config_path : Path , install_addons = True ) -> bool :
154154 """Wipe and format data with twrp, then flash os image with adb.
155155
156156 Only works for twrp recovery.
@@ -214,15 +214,27 @@ def adb_twrp_wipe_and_install(bin_path: Path, target: str, config_path: Path) ->
214214 break
215215 # finally reboot into os
216216 sleep (7 )
217- logger .info ("Reboot into OS." )
218- for line in run_command ("adb" , ["reboot" ], bin_path ): # "shell", "twrp",
219- yield line
220- if (type (line ) == bool ) and not line :
221- logger .error ("Rebooting failed." )
222- yield False
223- return
217+ if install_addons :
218+ # TODO: Fix the process for samsung devices
219+ # reboot into the bootloader again
220+ logger .info ("Rebooting device into bootloader with adb." )
221+ for line in run_command ("adb" , ["reboot" , "bootloader" ], bin_path ):
222+ yield line
223+ if (type (line ) == bool ) and not line :
224+ logger .error ("Reboot into bootloader failed." )
225+ yield False
226+ return
227+ sleep (7 )
224228 else :
225- yield True
229+ logger .info ("Reboot into OS." )
230+ for line in run_command ("adb" , ["reboot" ], bin_path ): # "shell", "twrp",
231+ yield line
232+ if (type (line ) == bool ) and not line :
233+ logger .error ("Rebooting failed." )
234+ yield False
235+ return
236+ else :
237+ yield True
226238
227239
228240def fastboot_unlock_with_code (bin_path : Path , unlock_code : str ) -> bool :
0 commit comments