TestDevice.MicrodroidBuilder
  public
  static
  
  
  class
  TestDevice.MicrodroidBuilder
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | com.android.tradefed.device.TestDevice.MicrodroidBuilder | 
A builder used to create a Microdroid TestDevice.
Summary
| Public methods | |
|---|---|
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      addAssignableDevice(String sysfsNode)
      Adds a device to assign to microdroid. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      addBootFile(File localFile, String remoteFileName)
      Adds a file for booting to be pushed to  | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      addExtraIdsigPath(String extraIdsigPath)
      Adds extra idsig file to the list. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      addTestDeviceOption(String optionName, String valueText)
      Sets a  | 
| 
        
        
        
        
        
        ITestDevice | 
      build(TestDevice device)
      Starts a Micrdroid TestDevice on the given TestDevice. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      cpuAffinity(String affinity)
      Sets on which host CPUs the vCPUs can run. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      cpuTopology(String cpuTopology)
      Sets the CPU topology configuration. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      debugLevel(String debugLevel)
      Sets the debug level. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      dumpDt(String dumpDt)
      Sets path where device tree blob will be dumped. | 
| 
        
        
        static
        
        
        TestDevice.MicrodroidBuilder | 
      fromDevicePath(String apkPath, String configPath)
      Creates a Microdroid builder for the given apkPath and the payload config file in APK. | 
| 
        
        
        static
        
        
        TestDevice.MicrodroidBuilder | 
      fromFile(File apkFile, String configPath)
      Creates a Microdroid builder for the given APK and the payload config file in APK. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      gki(String version)
      
      This method is deprecated.
    use  | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      hugePages(boolean hintHugePages)
      Sets whether to hint the kernel for transparent hugepages. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      instanceIdFile(String instanceIdPath)
      Sets the instance_id path. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      instanceImgFile(String instanceImgPath)
      Sets instance.img file path. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      memoryMib(int memoryMib)
      Sets the amount of RAM to give the VM. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      name(String name)
      Sets name for this VM. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      numCpus(int num)
      Sets the number of vCPUs in the VM. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      os(String os)
      Uses non-default variant of Microdroid OS. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      protectedVm(boolean isProtectedVm)
      Sets whether the VM will be protected or not. | 
| 
        
        
        
        
        
        TestDevice.MicrodroidBuilder | 
      setAdbConnectTimeoutMs(long timeoutMs)
      Sets the timeout for adb connect to microdroid TestDevice in millis. | 
Public methods
addAssignableDevice
public TestDevice.MicrodroidBuilder addAssignableDevice (String sysfsNode)
Adds a device to assign to microdroid.
| Parameters | |
|---|---|
| sysfsNode | String: The path to the sysfs node to assign | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | the microdroid builder. | 
addBootFile
public TestDevice.MicrodroidBuilder addBootFile (File localFile, String remoteFileName)
Adds a file for booting to be pushed to ERROR(/#TEST_ROOT).
 
Use this method if an file is required for booting microdroid. Otherwise use NativeDevice.pushFile(File, String).
| Parameters | |
|---|---|
| localFile | File: The local file on the host | 
| remoteFileName | String: The remote file name on the device | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | the microdroid builder. | 
addExtraIdsigPath
public TestDevice.MicrodroidBuilder addExtraIdsigPath (String extraIdsigPath)
Adds extra idsig file to the list.
| Parameters | |
|---|---|
| extraIdsigPath | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
addTestDeviceOption
public TestDevice.MicrodroidBuilder addTestDeviceOption (String optionName, String valueText)
Sets a TestDeviceOptions for the microdroid TestDevice.
| Parameters | |
|---|---|
| optionName | String: The name of the TestDeviceOption to set | 
| valueText | String: The value | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | the microdroid builder. | 
build
public ITestDevice build (TestDevice device)
Starts a Micrdroid TestDevice on the given TestDevice.
| Parameters | |
|---|---|
| device | TestDevice | 
| Returns | |
|---|---|
| ITestDevice | |
| Throws | |
|---|---|
| DeviceNotAvailableException | |
cpuAffinity
public TestDevice.MicrodroidBuilder cpuAffinity (String affinity)
Sets on which host CPUs the vCPUs can run. The format is a comma-separated list of CPUs or CPU ranges to run vCPUs on. e.g. "0,1-3,5" to choose host CPUs 0, 1, 2, 3, and 5. Or this can be a colon-separated list of assignments of vCPU to host CPU assignments. e.g. "0=0:1=1:2=2" to map vCPU 0 to host CPU 0, and so on.
Only supported in Android T.
| Parameters | |
|---|---|
| affinity | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
cpuTopology
public TestDevice.MicrodroidBuilder cpuTopology (String cpuTopology)
Sets the CPU topology configuration. Supported values: "one_cpu" and "match_host".
| Parameters | |
|---|---|
| cpuTopology | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
debugLevel
public TestDevice.MicrodroidBuilder debugLevel (String debugLevel)
Sets the debug level.
Supported values: "none" and "full". Android T also supports "app_only".
| Parameters | |
|---|---|
| debugLevel | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
dumpDt
public TestDevice.MicrodroidBuilder dumpDt (String dumpDt)
Sets path where device tree blob will be dumped.
Supported values: null and "path".
| Parameters | |
|---|---|
| dumpDt | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
fromDevicePath
public static TestDevice.MicrodroidBuilder fromDevicePath (String apkPath, String configPath)
Creates a Microdroid builder for the given apkPath and the payload config file in APK.
| Parameters | |
|---|---|
| apkPath | String | 
| configPath | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
fromFile
public static TestDevice.MicrodroidBuilder fromFile (File apkFile, String configPath)
Creates a Microdroid builder for the given APK and the payload config file in APK.
| Parameters | |
|---|---|
| apkFile | File | 
| configPath | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
gki
public TestDevice.MicrodroidBuilder gki (String version)
      This method is deprecated.
    use os(String).
  
Uses GKI kernel instead of microdroid kernel
| Parameters | |
|---|---|
| version | String: The GKI version to use | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
hugePages
public TestDevice.MicrodroidBuilder hugePages (boolean hintHugePages)
Sets whether to hint the kernel for transparent hugepages.
| Parameters | |
|---|---|
| hintHugePages | boolean | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | the microdroid builder. | 
instanceIdFile
public TestDevice.MicrodroidBuilder instanceIdFile (String instanceIdPath)
Sets the instance_id path.
| Parameters | |
|---|---|
| instanceIdPath | String: : Path to the instanceId | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
instanceImgFile
public TestDevice.MicrodroidBuilder instanceImgFile (String instanceImgPath)
Sets instance.img file path.
| Parameters | |
|---|---|
| instanceImgPath | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
memoryMib
public TestDevice.MicrodroidBuilder memoryMib (int memoryMib)
Sets the amount of RAM to give the VM. If this is zero or negative then the default will be used.
| Parameters | |
|---|---|
| memoryMib | int | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
name
public TestDevice.MicrodroidBuilder name (String name)
Sets name for this VM.
| Parameters | |
|---|---|
| name | String | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | the microdroid builder. | 
numCpus
public TestDevice.MicrodroidBuilder numCpus (int num)
Sets the number of vCPUs in the VM. Defaults to 1.
Only supported in Android T.
| Parameters | |
|---|---|
| num | int | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
os
public TestDevice.MicrodroidBuilder os (String os)
Uses non-default variant of Microdroid OS.
| Parameters | |
|---|---|
| os | String: The Microdroid OS version to use | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
protectedVm
public TestDevice.MicrodroidBuilder protectedVm (boolean isProtectedVm)
Sets whether the VM will be protected or not.
| Parameters | |
|---|---|
| isProtectedVm | boolean | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
setAdbConnectTimeoutMs
public TestDevice.MicrodroidBuilder setAdbConnectTimeoutMs (long timeoutMs)
Sets the timeout for adb connect to microdroid TestDevice in millis.
| Parameters | |
|---|---|
| timeoutMs | long: The timeout in millis | 
| Returns | |
|---|---|
| TestDevice.MicrodroidBuilder | |
