Skip to content

Commit fa5d04d

Browse files
committed
Fix adb bug
1 parent 406ac40 commit fa5d04d

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

openandroidinstaller/tooling.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ def activate_sideload(bin_path: Path) -> TerminalResponse:
140140
yield line
141141

142142

143+
@add_logging("Wait for device")
144+
def adb_wait_for_device(bin_path: Path) -> TerminalResponse:
145+
"""Use adb to wait for the device to become available."""
146+
for line in run_command("adb wait-for-device", bin_path):
147+
yield line
148+
149+
143150
@add_logging("Wait for recovery")
144151
def adb_wait_for_recovery(bin_path: Path) -> TerminalResponse:
145152
"""Use adb to wait for the recovery to become available."""
@@ -229,7 +236,7 @@ def adb_twrp_wipe_and_install(
229236
for partition in ["dalvik", "cache"]:
230237
for line in run_command(f"adb shell twrp wipe {partition}", bin_path):
231238
yield line
232-
sleep(1)
239+
sleep(3)
233240
if (type(line) == bool) and not line:
234241
logger.error(f"Wiping {partition} failed.")
235242
# TODO: if this fails, a fix can be to just sideload something and then adb reboot
@@ -238,17 +245,20 @@ def adb_twrp_wipe_and_install(
238245
bin_path=bin_path,
239246
):
240247
yield line
248+
sleep(1)
241249
if (type(line) == bool) and not line:
242250
yield False
243251
break
244252
sleep(2)
245253
# finally reboot into os or to fastboot for flashing addons
246-
sleep(7)
254+
for line in adb_wait_for_recovery(bin_path):
255+
yield line
247256
if install_addons:
248257
if is_ab:
249258
# reboot into the bootloader again
250259
for line in adb_reboot_bootloader(bin_path):
251260
yield line
261+
sleep(3)
252262
# boot to TWRP again
253263
for line in fastboot_boot_recovery(
254264
bin_path=bin_path, recovery=recovery, is_ab=is_ab
@@ -281,7 +291,6 @@ def adb_twrp_install_addon(
281291
# now flash the addon
282292
for line in adb_sideload(bin_path=bin_path, target=addon_path):
283293
yield line
284-
sleep(7)
285294
logger.info("done.")
286295

287296

@@ -293,6 +302,8 @@ def adb_twrp_finish_install_addons(
293302
Only works for twrp recovery.
294303
"""
295304
sleep(3)
305+
for line in adb_wait_for_recovery(bin_path):
306+
yield line
296307
# finally reboot into os
297308
if is_ab:
298309
logger.info("Switch partitions on a/b-partitioned device.")

openandroidinstaller/views/install_addons_view.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def build(self):
5757
# error text
5858
self.error_text = Text("", color=colors.RED)
5959
# text field to inform about the currently installing addon
60-
self.addon_info_text = Text("")
60+
self.addon_info_text = Text("", weight="bold")
6161

6262
# switch to enable advanced output - here it means show terminal input/output in tool
6363
def check_advanced_switch(e):
@@ -179,6 +179,7 @@ def run_install_addons(self, e):
179179
# in case the install command is run, we want to update the progress bar
180180
self.progress_indicator.display_progress_bar(line)
181181
self.progress_indicator.update()
182+
sleep(7)
182183

183184
# reboot after installing the addons; here we might switch partitions on ab-partitioned devices
184185
for line in adb_twrp_finish_install_addons(

0 commit comments

Comments
 (0)