diff options
Diffstat (limited to 'src/com/android/tradefed/targetprep')
-rw-r--r-- | src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java b/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java index e0076aa14..96ec06979 100644 --- a/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java +++ b/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java @@ -23,6 +23,7 @@ import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.util.CommandResult; import com.android.tradefed.util.CommandStatus; import com.android.tradefed.util.FileUtil; +import com.android.tradefed.util.IRunUtil; import com.android.tradefed.util.RunUtil; import com.android.tradefed.util.ZipUtil; @@ -565,7 +566,7 @@ public class FastbootDeviceFlasher implements IDeviceFlasher { attempts++; CLog.w("Could not find version for '%s'. Output '%s', retrying.", imageName, queryOutput); - RunUtil.getDefault().sleep(RETRY_SLEEP * (attempts - 1) + getRunUtil().sleep(RETRY_SLEEP * (attempts - 1) + new Random(System.currentTimeMillis()).nextInt(RETRY_SLEEP)); continue; } @@ -575,6 +576,13 @@ public class FastbootDeviceFlasher implements IDeviceFlasher { } /** + * Exposed for testing. + */ + protected IRunUtil getRunUtil() { + return RunUtil.getDefault(); + } + + /** * Helper method to execute fastboot command. * * @param device the {@link ITestDevice} to execute command on |