Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index be9d1e06a7680cb33e722b4a52986f276bd66af9..c2d97eb1bf0be88342191b1b3fd430f82eb4485f 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -789,8 +789,21 @@ class AndroidCommands(object): |
# 60 seconds which isn't sufficient for a lot of users of this method. |
push_command = 'push %s %s' % (local_path, device_path) |
self._LogShell(push_command) |
- output = self._adb.SendCommand(push_command, timeout_time=30 * 60) |
- assert _HasAdbPushSucceeded(output) |
+ |
+ # Retry push with increasing backoff if the device is busy. |
+ retry = 0 |
+ while True: |
+ output = self._adb.SendCommand(push_command, timeout_time=30 * 60) |
+ if _HasAdbPushSucceeded(output): |
+ return |
+ if 'resource busy' in output and retry < 3: |
frankf
2013/07/18 17:54:07
If rm is required, then shouldn't you also being d
|
+ retry += 1 |
+ wait_time = 5 * retry |
+ logging.error('Push failed, retrying in %d seconds: %s' % |
+ (wait_time, output)) |
+ time.sleep(wait_time) |
+ else: |
+ raise Exception('Push failed: %s' % output) |
def GetPushSizeInfo(self): |
"""Get total size of pushes to the device done via PushIfNeeded() |