Skip to content

Commit

Permalink
Exit the agent if an adb reboot doesn't restore connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeenan committed Oct 19, 2018
1 parent 8d104db commit 71f1fd5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, options, cache_dir):
self.simplert = None
self.no_network_count = 0
self.needs_exit = False
self.rebooted = False
self.vpn_forwarder = None
self.known_apps = {
'com.motorola.ccc.ota': {},
Expand Down Expand Up @@ -658,6 +659,7 @@ def is_device_ready(self):
net_ok = False
if self.ping(self.ping_address) is not None:
self.no_network_count = 0
self.rebooted = False
net_ok = True
else:
addresses = []
Expand Down Expand Up @@ -695,8 +697,12 @@ def is_device_ready(self):
is_ready = False
if not is_ready and self.no_network_count > 20:
self.no_network_count = 0
self.adb(['reboot'])
self.adb(['wait-for-device'])
if self.rebooted:
self.needs_exit = True
else:
self.adb(['reboot'])
self.adb(['wait-for-device'])
self.rebooted = True
if is_ready and not self.initialized:
self.initialized = True
# Disable emergency alert notifications
Expand Down

0 comments on commit 71f1fd5

Please sign in to comment.