diff options
Diffstat (limited to 'mobly/controllers/android_device_lib/adb.py')
-rw-r--r-- | mobly/controllers/android_device_lib/adb.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mobly/controllers/android_device_lib/adb.py b/mobly/controllers/android_device_lib/adb.py index b3994c9..8b55b65 100644 --- a/mobly/controllers/android_device_lib/adb.py +++ b/mobly/controllers/android_device_lib/adb.py @@ -29,7 +29,7 @@ ADB_PORT_LOCK = threading.Lock() # Number of attempts to execute "adb root", and seconds for interval time of # this commands. -ADB_ROOT_RETRY_ATTMEPTS = 3 +ADB_ROOT_RETRY_ATTEMPTS = 3 ADB_ROOT_RETRY_ATTEMPT_INTERVAL_SEC = 10 # Qualified class name of the default instrumentation test runner. @@ -517,7 +517,8 @@ class AdbProxy: Raises: AdbError: If the command exit code is not 0. """ - for attempt in range(ADB_ROOT_RETRY_ATTMEPTS): + retry_interval = ADB_ROOT_RETRY_ATTEMPT_INTERVAL_SEC + for attempt in range(ADB_ROOT_RETRY_ATTEMPTS): try: return self._exec_adb_cmd('root', args=None, @@ -525,12 +526,13 @@ class AdbProxy: timeout=None, stderr=None) except AdbError as e: - if attempt + 1 < ADB_ROOT_RETRY_ATTMEPTS: + if attempt + 1 < ADB_ROOT_RETRY_ATTEMPTS: logging.debug('Retry the command "%s" since Error "%s" occurred.' % (utils.cli_cmd_to_string( e.cmd), e.stderr.decode('utf-8').strip())) # Buffer between "adb root" commands. - time.sleep(ADB_ROOT_RETRY_ATTEMPT_INTERVAL_SEC) + time.sleep(retry_interval) + retry_interval *= 2 else: raise e |