DeviceSelectionOptions
public
class
DeviceSelectionOptions
extends Object
implements
IDeviceSelection
java.lang.Object | |
↳ | com.android.tradefed.device.DeviceSelectionOptions |
Container for for device selection criteria.
Summary
Public constructors | |
---|---|
DeviceSelectionOptions()
|
Public methods | |
---|---|
void
|
addExcludeSerial(String serialNumber)
Add a serial number to exclusion list. |
void
|
addProductType(String productType)
Add a product type to the device selection options. |
void
|
addProperty(String propertyKey, String propValue)
Add a property criteria to the device selection options |
void
|
addSerial(String serialNumber)
Add a serial number to the device selection options. |
static
IDeviceSelection
|
createForSerial(String serial)
Helper factory method to create a |
boolean
|
deviceRequested()
|
boolean
|
emulatorRequested()
|
String
|
fetchEnvironmentVariable(String name)
Helper function used to fetch environment variable. |
boolean
|
gceDeviceRequested()
|
IDeviceSelection.BaseDeviceType
|
getBaseDeviceTypeRequested()
Returns the device type we should use. |
Integer
|
getBatteryLevel(IDevice device)
Retrieves the battery level for the given device |
String
|
getDeviceProductType(IDevice device)
Gets the given devices product type |
String
|
getDeviceProductVariant(IDevice device)
Gets the given devices product variant |
DeviceSelectionOptions.DeviceRequestedType
|
getDeviceTypeRequested()
|
|
getExcludeSerials()
Gets a copy of the serial numbers exclusion list |
Integer
|
getMaxBatteryLevel()
Gets the requested maximum battery level |
Integer
|
getMaxBatteryTemperature()
Gets the requested maximum battery level |
Integer
|
getMinBatteryLevel()
Gets the requested minimum battery level |
|
getNoMatchReason()
Returns the reason for which the device was not matched. |
|
getProductTypes()
Gets a copy of the product type list |
|
getProperties()
Returns a map of the property list |
boolean
|
getRequireBatteryCheck()
Gets whether battery check is required for devices with unknown battery level |
boolean
|
getRequireBatteryTemperatureCheck()
Gets whether battery temp check is required for devices with unknown battery temperature |
|
getSerials(IDevice device)
Gets a copy of the serial numbers |
|
getSerials()
Returns the list of requested serials. |
boolean
|
localVirtualDeviceRequested()
|
boolean
|
matches(IDevice device)
|
boolean
|
nullDeviceRequested()
|
boolean
|
remoteDeviceRequested()
|
void
|
setBaseDeviceTypeRequested(IDeviceSelection.BaseDeviceType type)
Sets the device type we should use. |
void
|
setDeviceRequested(boolean deviceRequested)
Sets the emulator requested flag |
void
|
setDeviceTypeRequested(DeviceSelectionOptions.DeviceRequestedType requestedType)
|
void
|
setEmulatorRequested(boolean emulatorRequested)
Sets the emulator requested flag |
void
|
setGceDeviceRequested(boolean gceDeviceRequested)
|
void
|
setMaxBatteryLevel(Integer maxBattery)
Sets the maximum battery level |
void
|
setMaxBatteryTemperature(Integer maxBatteryTemperature)
Sets the maximum battery level |
void
|
setMinBatteryLevel(Integer minBattery)
Sets the minimum battery level |
void
|
setNullDeviceRequested(boolean nullDeviceRequested)
Sets the null device requested flag |
void
|
setRequireBatteryCheck(boolean requireCheck)
Sets whether battery check is required for devices with unknown battery level |
void
|
setRequireBatteryTemperatureCheck(boolean requireCheckTemprature)
Sets whether battery temp check is required for devices with unknown battery temperature |
void
|
setSerial(String... serialNumber)
Set the serial numbers inclusion list, replacing any existing values. |
void
|
setStubEmulatorRequested(boolean stubEmulatorRequested)
Sets the stub emulator requested flag |
boolean
|
stubEmulatorRequested()
|
Public constructors
DeviceSelectionOptions
public DeviceSelectionOptions ()
Public methods
addExcludeSerial
public void addExcludeSerial (String serialNumber)
Add a serial number to exclusion list.
addProductType
public void addProductType (String productType)
Add a product type to the device selection options.
addProperty
public void addProperty (String propertyKey, String propValue)
Add a property criteria to the device selection options
Parameters | |
---|---|
propertyKey |
String |
propValue |
String |
addSerial
public void addSerial (String serialNumber)
Add a serial number to the device selection options.
createForSerial
public static IDeviceSelection createForSerial (String serial)
Helper factory method to create a IDeviceSelection
that will only match device
with given serial
Parameters | |
---|---|
serial |
String |
Returns | |
---|---|
IDeviceSelection |
deviceRequested
public boolean deviceRequested ()
Returns | |
---|---|
boolean |
emulatorRequested
public boolean emulatorRequested ()
Returns | |
---|---|
boolean |
fetchEnvironmentVariable
public String fetchEnvironmentVariable (String name)
Helper function used to fetch environment variable. It is essentially a wrapper around System.getenv(String)
This is done for unit testing purposes.
Parameters | |
---|---|
name |
String : the environment variable to fetch. |
Returns | |
---|---|
String |
a String value of the environment variable or null if not available. |
gceDeviceRequested
public boolean gceDeviceRequested ()
Returns | |
---|---|
boolean |
getBaseDeviceTypeRequested
public IDeviceSelection.BaseDeviceType getBaseDeviceTypeRequested ()
Returns the device type we should use.
Returns | |
---|---|
IDeviceSelection.BaseDeviceType |
getBatteryLevel
public Integer getBatteryLevel (IDevice device)
Retrieves the battery level for the given device
Parameters | |
---|---|
device |
IDevice : the IDevice |
Returns | |
---|---|
Integer |
the device battery level or null if unknown |
getDeviceProductType
public String getDeviceProductType (IDevice device)
Gets the given devices product type
Parameters | |
---|---|
device |
IDevice : the IDevice |
Returns | |
---|---|
String |
the device product type or null if unknown |
getDeviceProductVariant
public String getDeviceProductVariant (IDevice device)
Gets the given devices product variant
Parameters | |
---|---|
device |
IDevice : the IDevice |
Returns | |
---|---|
String |
the device product variant or null if unknown |
getDeviceTypeRequested
public DeviceSelectionOptions.DeviceRequestedType getDeviceTypeRequested ()
Returns | |
---|---|
DeviceSelectionOptions.DeviceRequestedType |
getExcludeSerials
publicgetExcludeSerials ()
Gets a copy of the serial numbers exclusion list
Returns | |
---|---|
|
a ERROR(/Collection) of serial numbers |
getMaxBatteryLevel
public Integer getMaxBatteryLevel ()
Gets the requested maximum battery level
Returns | |
---|---|
Integer |
getMaxBatteryTemperature
public Integer getMaxBatteryTemperature ()
Gets the requested maximum battery level
Returns | |
---|---|
Integer |
getMinBatteryLevel
public Integer getMinBatteryLevel ()
Gets the requested minimum battery level
Returns | |
---|---|
Integer |
getNoMatchReason
publicgetNoMatchReason ()
Returns the reason for which the device was not matched.
Returns | |
---|---|
|
a Map of serial number to reason for which it wasn't allocated |
getProductTypes
publicgetProductTypes ()
Gets a copy of the product type list
Returns | |
---|---|
|
a ERROR(/Collection) of product types |
getProperties
publicgetProperties ()
Returns a map of the property list
Returns | |
---|---|
|
a ERROR(/Map) of device property names to values |
getRequireBatteryCheck
public boolean getRequireBatteryCheck ()
Gets whether battery check is required for devices with unknown battery level
Returns | |
---|---|
boolean |
getRequireBatteryTemperatureCheck
public boolean getRequireBatteryTemperatureCheck ()
Gets whether battery temp check is required for devices with unknown battery temperature
Returns | |
---|---|
boolean |
getSerials
publicgetSerials (IDevice device)
Gets a copy of the serial numbers
Parameters | |
---|---|
device |
IDevice : The IDevice representing the device considered for selection. |
Returns | |
---|---|
|
a ERROR(/Collection) of serial numbers |
getSerials
publicgetSerials ()
Returns the list of requested serials.
Returns | |
---|---|
|
localVirtualDeviceRequested
public boolean localVirtualDeviceRequested ()
Returns | |
---|---|
boolean |
matches
public boolean matches (IDevice device)
Parameters | |
---|---|
device |
IDevice |
Returns | |
---|---|
boolean |
true if the given IDevice is a match for the provided options.
false otherwise |
nullDeviceRequested
public boolean nullDeviceRequested ()
Returns | |
---|---|
boolean |
remoteDeviceRequested
public boolean remoteDeviceRequested ()
Returns | |
---|---|
boolean |
setBaseDeviceTypeRequested
public void setBaseDeviceTypeRequested (IDeviceSelection.BaseDeviceType type)
Sets the device type we should use.
Parameters | |
---|---|
type |
IDeviceSelection.BaseDeviceType |
setDeviceRequested
public void setDeviceRequested (boolean deviceRequested)
Sets the emulator requested flag
Parameters | |
---|---|
deviceRequested |
boolean |
setDeviceTypeRequested
public void setDeviceTypeRequested (DeviceSelectionOptions.DeviceRequestedType requestedType)
Parameters | |
---|---|
requestedType |
DeviceSelectionOptions.DeviceRequestedType |
setEmulatorRequested
public void setEmulatorRequested (boolean emulatorRequested)
Sets the emulator requested flag
Parameters | |
---|---|
emulatorRequested |
boolean |
setGceDeviceRequested
public void setGceDeviceRequested (boolean gceDeviceRequested)
Parameters | |
---|---|
gceDeviceRequested |
boolean |
setMaxBatteryLevel
public void setMaxBatteryLevel (Integer maxBattery)
Sets the maximum battery level
Parameters | |
---|---|
maxBattery |
Integer |
setMaxBatteryTemperature
public void setMaxBatteryTemperature (Integer maxBatteryTemperature)
Sets the maximum battery level
Parameters | |
---|---|
maxBatteryTemperature |
Integer |
setMinBatteryLevel
public void setMinBatteryLevel (Integer minBattery)
Sets the minimum battery level
Parameters | |
---|---|
minBattery |
Integer |
setNullDeviceRequested
public void setNullDeviceRequested (boolean nullDeviceRequested)
Sets the null device requested flag
Parameters | |
---|---|
nullDeviceRequested |
boolean |
setRequireBatteryCheck
public void setRequireBatteryCheck (boolean requireCheck)
Sets whether battery check is required for devices with unknown battery level
Parameters | |
---|---|
requireCheck |
boolean |
setRequireBatteryTemperatureCheck
public void setRequireBatteryTemperatureCheck (boolean requireCheckTemprature)
Sets whether battery temp check is required for devices with unknown battery temperature
Parameters | |
---|---|
requireCheckTemprature |
boolean |
setSerial
public void setSerial (String... serialNumber)
Set the serial numbers inclusion list, replacing any existing values.
Parameters | |
---|---|
serialNumber |
String |
setStubEmulatorRequested
public void setStubEmulatorRequested (boolean stubEmulatorRequested)
Sets the stub emulator requested flag
Parameters | |
---|---|
stubEmulatorRequested |
boolean |
stubEmulatorRequested
public boolean stubEmulatorRequested ()
Returns | |
---|---|
boolean |