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 IDeviceSelection that will only match device with given serial

boolean deviceRequested()

boolean emulatorRequested()

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

Collection<String> 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

Collection<String> getProductTypes()

Gets a copy of the product type list

Map<String, String> 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

Collection<String> getSerials(IDevice device)

Gets a copy of the serial numbers

boolean matches(IDevice device)
boolean nullDeviceRequested()

void setDeviceRequested(boolean deviceRequested)

Sets the emulator requested flag

void setEmulatorRequested(boolean emulatorRequested)

Sets the emulator requested flag

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

void setTcpDeviceRequested(boolean tcpDeviceRequested)

Sets the tcp device requested flag

boolean stubEmulatorRequested()

boolean tcpDeviceRequested()

Protected methods

boolean extraMatching(IDevice device)

Extra validation step that maybe overridden if it does not make sense.

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

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

getExcludeSerials

public Collection<String> getExcludeSerials ()

Gets a copy of the serial numbers exclusion list

Returns
Collection<String> a 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

getProductTypes

public Collection<String> getProductTypes ()

Gets a copy of the product type list

Returns
Collection<String> a Collection of product types

getProperties

public Map<String, String> getProperties ()

Returns a map of the property list

Returns
Map<String, String> a 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

public Collection<String> getSerials (IDevice device)

Gets a copy of the serial numbers

Parameters
device IDevice: The IDevice representing the device considered for selection.

Returns
Collection<String> a Collection of serial numbers

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

setDeviceRequested

public void setDeviceRequested (boolean deviceRequested)

Sets the emulator requested flag

Parameters
deviceRequested boolean

setEmulatorRequested

public void setEmulatorRequested (boolean emulatorRequested)

Sets the emulator requested flag

Parameters
emulatorRequested 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

setTcpDeviceRequested

public void setTcpDeviceRequested (boolean tcpDeviceRequested)

Sets the tcp device requested flag

Parameters
tcpDeviceRequested boolean

stubEmulatorRequested

public boolean stubEmulatorRequested ()

Returns
boolean

tcpDeviceRequested

public boolean tcpDeviceRequested ()

Returns
boolean

Protected methods

extraMatching

protected boolean extraMatching (IDevice device)

Extra validation step that maybe overridden if it does not make sense.

Parameters
device IDevice

Returns
boolean