Skip to content

Commit be8d660

Browse files
authored
If no addon is selected just reboot to OS at installation time (#148)
2 parents 574516c + 0b54802 commit be8d660

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

openandroidinstaller/app_state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(
4040
# placeholders
4141
self.advanced = False
4242
self.install_addons = False
43+
self.addon_paths = None
4344
self.config = None
4445
self.image_path = None
4546
self.recovery_path = None

openandroidinstaller/views/install_addons_view.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
from views import BaseView
3535
from app_state import AppState
36-
from tooling import adb_twrp_install_addons
36+
from tooling import adb_twrp_install_addons, adb_reboot
3737
from widgets import (
3838
confirm_button,
3939
get_title,
@@ -158,16 +158,22 @@ def run_install_addons(self, e):
158158
self.right_view.update()
159159

160160
# run the install script
161-
for line in adb_twrp_install_addons(
162-
addons=self.state.addon_paths,
163-
bin_path=self.state.bin_path,
164-
is_ab=self.state.config.is_ab,
165-
):
166-
# write the line to advanced output terminal
167-
self.terminal_box.write_line(line)
168-
# in case the install command is run, we want to update the progress bar
169-
self.progress_indicator.display_progress_bar(line)
170-
self.progress_indicator.update()
161+
if self.state.addon_paths:
162+
for line in adb_twrp_install_addons(
163+
addons=self.state.addon_paths,
164+
bin_path=self.state.bin_path,
165+
is_ab=self.state.config.is_ab,
166+
):
167+
# write the line to advanced output terminal
168+
self.terminal_box.write_line(line)
169+
# in case the install command is run, we want to update the progress bar
170+
self.progress_indicator.display_progress_bar(line)
171+
self.progress_indicator.update()
172+
else:
173+
logger.info("No addons selected. Rebooting to OS.")
174+
for line in adb_reboot(bin_path=self.state.bin_path):
175+
# write the line to advanced output terminal
176+
self.terminal_box.write_line(line)
171177
success = line # the last element of the iterable is a boolean encoding success/failure
172178

173179
# update the view accordingly
@@ -177,7 +183,7 @@ def run_install_addons(self, e):
177183
# also remove the last error text if it happened
178184
self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly."
179185
else:
180-
sleep(5) # wait to make sure everything is fine
186+
sleep(4) # wait to make sure everything is fine
181187
logger.success("Installation process was successful. Allow to continue.")
182188
# enable the confirm button and disable the call button
183189
self.confirm_button.disabled = False

0 commit comments

Comments
 (0)