Skip to content

Commit 03e50a7

Browse files
committed
WIP
1 parent 2bb75d0 commit 03e50a7

2 files changed

Lines changed: 25 additions & 11 deletions

File tree

openandroidinstaller/tooling.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

228240
def fastboot_unlock_with_code(bin_path: Path, unlock_code: str) -> bool:

openandroidinstaller/views/install_view.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ def check_addons_switch(e):
7474
"""Check the switch to enable the addons installation process."""
7575
if self.install_addons_switch.value:
7676
logger.info("Enable flashing addons.")
77+
# TODO: add the addons step here.
7778
self.state.install_addons = True
78-
self.state.steps.extend(self.state.config.flash_recovery)
7979
else:
8080
logger.info("Disable flashing addons.")
81+
# TODO: empty the steps again
8182
self.state.install_addons = False
8283

8384
self.install_addons_switch = Switch(
@@ -159,7 +160,7 @@ def check_addons_switch(e):
159160

160161
def run_install(self, e):
161162
"""
162-
Run the installation process trought twrp.
163+
Run the installation process trough twrp.
163164
164165
Some parts of the command are changed by placeholders.
165166
"""
@@ -178,6 +179,7 @@ def run_install(self, e):
178179
target=self.state.image_path,
179180
config_path=self.state.config_path,
180181
bin_path=self.state.bin_path,
182+
install_addons=self.state.install_addons,
181183
):
182184
# write the line to advanced output terminal
183185
self.terminal_box.write_line(line)

0 commit comments

Comments
 (0)