Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3320)

Unified Diff: build/android/adb_install_apk.py

Issue 24194002: [android] Try killing adb server if no devices found Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set waiting interval to 10,20,40,80,160 Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_install_apk.py
diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py
index adad48bdef84a445d58e3f443017b979302706d4..e57e0b375efda06c63948df8f5a445da6fa1eda3 100755
--- a/build/android/adb_install_apk.py
+++ b/build/android/adb_install_apk.py
@@ -10,6 +10,7 @@ import multiprocessing
import optparse
import os
import sys
+import time
from pylib import android_commands
from pylib import constants
@@ -58,7 +59,20 @@ def main(argv):
if len(args) > 1:
raise Exception('Error: Unknown argument:', args[1:])
- devices = android_commands.GetAttachedDevices()
+ retry_times = 5
+ retry_interval = 10
+ while retry_times > 0:
+ devices = android_commands.GetAttachedDevices()
+ if not devices:
+ print 'No connected devices found, '\
+ 'kill adb server and retry in %d seconds...' % retry_interval
+ android_commands.AndroidCommands().KillAdbServer()
+ time.sleep(retry_interval)
+ retry_interval *= 2
+ retry_times -= 1
+ else:
+ break
+
if not devices:
raise Exception('Error: no connected devices')
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698