public class

DeviceSelectionOptions

extends Object
implements IDeviceSelection
java.lang.Object
   ↳ com.android.tradefed.device.DeviceSelectionOptions

Class Overview

Container for for device selection criteria.

Summary

Constants
String DEVICE_PRODUCT_PROPERTY
String DEVICE_VARIANT_PROPERTY
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 propertyKeyValue)
Add a property criteria to the device selection options
void addSerial(String serialNumber)
Add a serial number to the device selection options.
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
boolean stubEmulatorRequested()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.device.IDeviceSelection
From interface com.android.tradefed.util.ConditionPriorityBlockingQueue.IMatcher

Constants

public static final String DEVICE_PRODUCT_PROPERTY

Constant Value: "ro.hardware"

public static final String DEVICE_VARIANT_PROPERTY

Constant Value: "ro.product.device"

Public Constructors

public DeviceSelectionOptions ()

Public Methods

public void addExcludeSerial (String serialNumber)

Add a serial number to exclusion list.

public void addProductType (String productType)

Add a product type to the device selection options.

public void addProperty (String propertyKeyValue)

Add a property criteria to the device selection options

Parameters
propertyKeyValue a property to match. Expected format propertykey=propertyvalue

public void addSerial (String serialNumber)

Add a serial number to the device selection options.

public boolean deviceRequested ()

public boolean emulatorRequested ()

public Integer getBatteryLevel (IDevice device)

Retrieves the battery level for the given device

Parameters
device the IDevice
Returns
  • the device battery level or null if unknown

public String getDeviceProductType (IDevice device)

Gets the given devices product type

Parameters
device the IDevice
Returns
  • the device product type or null if unknown

public String getDeviceProductVariant (IDevice device)

Gets the given devices product variant

Parameters
device the IDevice
Returns
  • the device product variant or null if unknown

public Collection<String> getExcludeSerials ()

Gets a copy of the serial numbers exclusion list

Returns

public Integer getMaxBatteryLevel ()

Gets the requested maximum battery level

public Integer getMinBatteryLevel ()

Gets the requested minimum battery level

public Collection<String> getProductTypes ()

Gets a copy of the product type list

Returns

public Map<String, String> getProperties ()

Returns a map of the property list

Returns
  • a Map of device property names to values

public boolean getRequireBatteryCheck ()

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

public Collection<String> getSerials ()

Gets a copy of the serial numbers

Returns

public boolean matches (IDevice device)

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

public boolean nullDeviceRequested ()

public void setDeviceRequested (boolean deviceRequested)

Sets the emulator requested flag

public void setEmulatorRequested (boolean emulatorRequested)

Sets the emulator requested flag

public void setMaxBatteryLevel (Integer maxBattery)

Sets the maximum battery level

public void setMinBatteryLevel (Integer minBattery)

Sets the minimum battery level

public void setNullDeviceRequested (boolean nullDeviceRequested)

Sets the null device requested flag

public void setRequireBatteryCheck (boolean requireCheck)

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

public void setSerial (String... serialNumber)

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

public void setStubEmulatorRequested (boolean stubEmulatorRequested)

Sets the stub emulator requested flag

public boolean stubEmulatorRequested ()