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

Collection<String> getSerials()

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

DeviceSelectionOptions ()

Public methods

addExcludeSerial

void addExcludeSerial (String serialNumber)

Add a serial number to exclusion list.

addProductType

void addProductType (String productType)

Add a product type to the device selection options.

addProperty

void addProperty (String propertyKey, 
                String propValue)

Add a property criteria to the device selection options

Parameters
propertyKey String

propValue String

addSerial

void addSerial (String serialNumber)

Add a serial number to the device selection options.

createForSerial

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

boolean deviceRequested ()

Returns
boolean

emulatorRequested

boolean emulatorRequested ()

Returns
boolean

getBatteryLevel

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

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

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

Collection<String> getExcludeSerials ()

Gets a copy of the serial numbers exclusion list

Returns
Collection<String> a Collection of serial numbers

getMaxBatteryLevel

Integer getMaxBatteryLevel ()

Gets the requested maximum battery level

Returns
Integer

getMinBatteryLevel

Integer getMinBatteryLevel ()

Gets the requested minimum battery level

Returns
Integer

getProductTypes

Collection<String> getProductTypes ()

Gets a copy of the product type list

Returns
Collection<String> a Collection of product types

getProperties

Map<String, String> getProperties ()

Returns a map of the property list

Returns
Map<String, String> a Map of device property names to values

getRequireBatteryCheck

boolean getRequireBatteryCheck ()

Gets whether battery check is required for devices with unknown battery level

Returns
boolean

getSerials

Collection<String> getSerials ()

Gets a copy of the serial numbers

Returns
Collection<String> a Collection of serial numbers

matches

boolean matches (IDevice device)

Parameters
device IDevice

Returns
boolean true if the given IDevice is a match for the provided options. false otherwise

nullDeviceRequested

boolean nullDeviceRequested ()

Returns
boolean

setDeviceRequested

void setDeviceRequested (boolean deviceRequested)

Sets the emulator requested flag

Parameters
deviceRequested boolean

setEmulatorRequested

void setEmulatorRequested (boolean emulatorRequested)

Sets the emulator requested flag

Parameters
emulatorRequested boolean

setMaxBatteryLevel

void setMaxBatteryLevel (Integer maxBattery)

Sets the maximum battery level

Parameters
maxBattery Integer

setMinBatteryLevel

void setMinBatteryLevel (Integer minBattery)

Sets the minimum battery level

Parameters
minBattery Integer

setNullDeviceRequested

void setNullDeviceRequested (boolean nullDeviceRequested)

Sets the null device requested flag

Parameters
nullDeviceRequested boolean

setRequireBatteryCheck

void setRequireBatteryCheck (boolean requireCheck)

Sets whether battery check is required for devices with unknown battery level

Parameters
requireCheck boolean

setSerial

void setSerial (String... serialNumber)

Set the serial numbers inclusion list, replacing any existing values.

Parameters
serialNumber String

setStubEmulatorRequested

void setStubEmulatorRequested (boolean stubEmulatorRequested)

Sets the stub emulator requested flag

Parameters
stubEmulatorRequested boolean

setTcpDeviceRequested

void setTcpDeviceRequested (boolean tcpDeviceRequested)

Sets the tcp device requested flag

Parameters
tcpDeviceRequested boolean

stubEmulatorRequested

boolean stubEmulatorRequested ()

Returns
boolean

tcpDeviceRequested

boolean tcpDeviceRequested ()

Returns
boolean

Protected methods

extraMatching

boolean extraMatching (IDevice device)

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

Parameters
device IDevice

Returns
boolean