Allow dynamic download to use a device for information
Test: unit tests
Bug: 149516126
Change-Id: I040aebb794d9be77d57740311a58407e67dee73e
diff --git a/src/com/android/tradefed/config/DynamicRemoteFileResolver.java b/src/com/android/tradefed/config/DynamicRemoteFileResolver.java
index b6e6ba1..56467a6 100644
--- a/src/com/android/tradefed/config/DynamicRemoteFileResolver.java
+++ b/src/com/android/tradefed/config/DynamicRemoteFileResolver.java
@@ -23,6 +23,7 @@
import com.android.tradefed.config.remote.HttpsRemoteFileResolver;
import com.android.tradefed.config.remote.IRemoteFileResolver;
import com.android.tradefed.config.remote.LocalFileResolver;
+import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.util.FileUtil;
import com.android.tradefed.util.MultiMap;
@@ -73,12 +74,18 @@
public static final String OPTIONAL_KEY = "optional";
private Map<String, OptionFieldsForName> mOptionMap;
+ private ITestDevice mDevice;
/** Sets the map of options coming from {@link OptionSetter} */
public void setOptionMap(Map<String, OptionFieldsForName> optionMap) {
mOptionMap = optionMap;
}
+ /** Sets the device under tests */
+ public void setDevice(ITestDevice device) {
+ mDevice = device;
+ }
+
/**
* Runs through all the {@link File} option type and check if their path should be resolved.
*
@@ -260,6 +267,7 @@
}
// Downloaded individual files should be saved to destDir, return value is not needed.
try {
+ resolver.setPrimaryDevice(mDevice);
resolver.resolveRemoteFiles(new File(remoteZipFilePath), queryArgs);
} catch (BuildRetrievalError e) {
if (isOptional(queryArgs)) {