Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mobly/controllers/android_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
# Default name for bug reports taken without a specified test name.
DEFAULT_BUG_REPORT_NAME = 'bugreport'

# Default timeout to wait for device to go offline upon reboot.
# This number is from max_clean_shutdown_timeout system/core/init/reboot.cpp
DEFAULT_TIMEOUT_DISCONNECT_SECOND = 10

# Default Timeout to wait for boot completion
DEFAULT_TIMEOUT_BOOT_COMPLETION_SECOND = 15 * 60

Expand Down Expand Up @@ -728,6 +732,13 @@ def handle_reboot(self):
try:
yield
finally:
# If we execute `wait-for-device` right after `reboot`, adbd in the device
# may still be running, which would cause `wait-for-device` to return
# immediately, even if the device hasn't finished rebooting.
# To avoid this situation, wait until the adb connection is actually
# lost, and then wait for the boot complete signal.
self.adb.wait_for_disconnect(timeout=DEFAULT_TIMEOUT_DISCONNECT_SECOND)

self.wait_for_boot_completion()
# On boot completion, invalidate the `build_info` cache since any
# value it had from before boot completion is potentially invalid.
Expand Down
Loading