DeviceSelectionOptions

public class DeviceSelectionOptions
extends Object implements IDeviceSelection

java.lang.Object
   ↳ com.android.tradefed.device.DeviceSelectionOptions


用于存储设备选择条件的容器。

摘要

公共构造函数

DeviceSelectionOptions()

公共方法

void addExcludeSerial(String serialNumber)

将序列号添加到排除列表中。

void addProductType(String productType)

向设备选择选项添加了商品类型。

void addProperty(String propertyKey, String propValue)

向设备选择选项添加了属性条件

void addSerial(String serialNumber)

向设备选择选项添加了序列号。

static IDeviceSelection createForSerial(String serial)

用于创建 IDeviceSelection 的辅助工厂方法,该方法仅匹配具有指定序列号的设备

boolean deviceRequested()

boolean emulatorRequested()

String fetchEnvironmentVariable(String name)

用于获取环境变量的辅助函数。

boolean gceDeviceRequested()

IDeviceSelection.BaseDeviceType getBaseDeviceTypeRequested()

返回应使用的设备类型。

Integer getBatteryLevel(IDevice device)

检索指定设备的电池电量

String getDeviceProductType(IDevice device)

获取指定设备的商品类型

String getDeviceProductVariant(IDevice device)

获取指定设备的商品款式/规格

DeviceSelectionOptions.DeviceRequestedType getDeviceTypeRequested()
getExcludeSerials()

获取序列号排除列表的副本

Integer getMaxBatteryLevel()

获取请求的最大电池电量

Integer getMaxBatteryTemperature()

获取请求的最大电池电量

Integer getMinBatteryLevel()

获取请求的最低电池电量

getNoMatchReason()

返回设备未匹配的原因。

getProductTypes()

获取商品类型列表的副本

getProperties()

返回属性列表的映射

boolean getRequireBatteryCheck()

获取电量未知的设备是否需要进行电池检查

boolean getRequireBatteryTemperatureCheck()

获取是否需要对电池温度未知的设备进行电池温度检查

getSerials(IDevice device)

获取序列号的副本

getSerials()

返回所请求的序列的列表。

boolean localVirtualDeviceRequested()
boolean matches(IDevice device)
boolean nullDeviceRequested()

boolean remoteDeviceRequested()
void setBaseDeviceTypeRequested(IDeviceSelection.BaseDeviceType type)

设置应使用的设备类型。

void setDeviceRequested(boolean deviceRequested)

设置模拟器请求标志

void setDeviceTypeRequested(DeviceSelectionOptions.DeviceRequestedType requestedType)
void setEmulatorRequested(boolean emulatorRequested)

设置模拟器请求标志

void setGceDeviceRequested(boolean gceDeviceRequested)
void setMaxBatteryLevel(Integer maxBattery)

设置最大电池电量

void setMaxBatteryTemperature(Integer maxBatteryTemperature)

设置最大电池电量

void setMinBatteryLevel(Integer minBattery)

设置最低电池电量

void setNullDeviceRequested(boolean nullDeviceRequested)

设置了请求的 null 设备标志

void setRequireBatteryCheck(boolean requireCheck)

设置是否需要对电池电量未知的设备进行电池检查

void setRequireBatteryTemperatureCheck(boolean requireCheckTemprature)

设置是否需要对电池温度未知的设备进行电池温度检查

void setSerial(String... serialNumber)

设置序列号包含列表,替换所有现有值。

void setStubEmulatorRequested(boolean stubEmulatorRequested)

设置所请求的桩模拟器标志

boolean shouldCreateTemporarilyPlaceholder()

根据元数据创建临时占位符。

boolean stubEmulatorRequested()

公共构造函数

DeviceSelectionOptions

public DeviceSelectionOptions ()

公共方法

addExcludeSerial

public void addExcludeSerial (String serialNumber)

将序列号添加到排除列表中。

addProductType

public void addProductType (String productType)

向设备选择选项添加商品类型。

addProperty

public void addProperty (String propertyKey, 
                String propValue)

向设备选择选项添加了属性条件

参数
propertyKey String

propValue String

addSerial

public void addSerial (String serialNumber)

向设备选择选项添加了序列号。

createForSerial

public static IDeviceSelection createForSerial (String serial)

用于创建 IDeviceSelection 的辅助工厂方法,该方法仅匹配具有指定序列号的设备

参数
serial String

返回
IDeviceSelection

deviceRequested

public boolean deviceRequested ()

返回
boolean

emulatorRequested

public boolean emulatorRequested ()

返回
boolean

fetchEnvironmentVariable

public String fetchEnvironmentVariable (String name)

用于获取环境变量的辅助函数。它本质上是 System.getenv(String) 的封装容器,这样做是为了进行单元测试。

参数
name String:要提取的环境变量。

返回
String 环境变量的 String 值,如果不可用,则为 null。

gceDeviceRequested

public boolean gceDeviceRequested ()

返回
boolean

getBaseDeviceTypeRequested

public IDeviceSelection.BaseDeviceType getBaseDeviceTypeRequested ()

返回应使用的设备类型。

返回
IDeviceSelection.BaseDeviceType

getBatteryLevel

public Integer getBatteryLevel (IDevice device)

检索指定设备的电池电量

参数
device IDeviceIDevice

返回
Integer 设备电池电量或 null(如果未知)

getDeviceProductType

public String getDeviceProductType (IDevice device)

获取指定设备的商品类型

参数
device IDeviceIDevice

返回
String 设备产品类型,如果未知则为 null

getDeviceProductVariant

public String getDeviceProductVariant (IDevice device)

获取指定设备的商品款式/规格

参数
device IDeviceIDevice

返回
String 设备产品变体,如果未知,则为 null

getDeviceTypeRequested

public DeviceSelectionOptions.DeviceRequestedType getDeviceTypeRequested ()

返回
DeviceSelectionOptions.DeviceRequestedType

getExcludeSerials

public  getExcludeSerials ()

获取序列号排除列表的副本

返回
ERROR(/Collection) 个序列号

getMaxBatteryLevel

public Integer getMaxBatteryLevel ()

获取请求的最大电池电量

返回
Integer

getMaxBatteryTemperature

public Integer getMaxBatteryTemperature ()

获取请求的最大电池电量

返回
Integer

getMinBatteryLevel

public Integer getMinBatteryLevel ()

获取请求的最低电池电量

返回
Integer

getNoMatchReason

public  getNoMatchReason ()

返回设备未匹配的原因。

返回
一个从序列号到未分配原因的映射

getProductTypes

public  getProductTypes ()

获取商品类型列表的副本

返回
ERROR(/Collection) 个商品类型

getProperties

public  getProperties ()

返回属性列表的映射

返回
一个 ERROR(/Map),用于将设备属性名称映射到值

getRequireBatteryCheck

public boolean getRequireBatteryCheck ()

获取是否需要对电池电量未知的设备进行电池检查

返回
boolean

getRequireBatteryTemperatureCheck

public boolean getRequireBatteryTemperatureCheck ()

获取是否需要对电池温度未知的设备进行电池温度检查

返回
boolean

getSerials

public  getSerials (IDevice device)

获取序列号的副本

参数
device IDevice:表示要考虑选择的设备的 IDevice

返回
ERROR(/Collection) 个序列号

getSerials

public  getSerials ()

返回所请求的连续剧列表。

返回

localVirtualDeviceRequested

public boolean localVirtualDeviceRequested ()

返回
boolean

匹配

public boolean matches (IDevice device)

参数
device IDevice

返回
boolean 如果给定的 IDevice 与提供的选项匹配,则为 true。 否则为 false

nullDeviceRequested

public boolean nullDeviceRequested ()

返回
boolean

remoteDeviceRequested

public boolean remoteDeviceRequested ()

返回
boolean

setBaseDeviceTypeRequested

public void setBaseDeviceTypeRequested (IDeviceSelection.BaseDeviceType type)

设置应使用的设备类型。

参数
type IDeviceSelection.BaseDeviceType

setDeviceRequested

public void setDeviceRequested (boolean deviceRequested)

设置模拟器请求标志

参数
deviceRequested boolean

setDeviceTypeRequested

public void setDeviceTypeRequested (DeviceSelectionOptions.DeviceRequestedType requestedType)

参数
requestedType DeviceSelectionOptions.DeviceRequestedType

setEmulatorRequested

public void setEmulatorRequested (boolean emulatorRequested)

设置模拟器请求标志

参数
emulatorRequested boolean

setGceDeviceRequested

public void setGceDeviceRequested (boolean gceDeviceRequested)

参数
gceDeviceRequested boolean

setMaxBatteryLevel

public void setMaxBatteryLevel (Integer maxBattery)

设置最大电池电量

参数
maxBattery Integer

setMaxBatteryTemperature

public void setMaxBatteryTemperature (Integer maxBatteryTemperature)

设置最大电池电量

参数
maxBatteryTemperature Integer

setMinBatteryLevel

public void setMinBatteryLevel (Integer minBattery)

设置最低电池电量

参数
minBattery Integer

setNullDeviceRequested

public void setNullDeviceRequested (boolean nullDeviceRequested)

设置了 null 设备请求标志

参数
nullDeviceRequested boolean

setRequireBatteryCheck

public void setRequireBatteryCheck (boolean requireCheck)

设置是否需要对电池电量未知的设备进行电池检查

参数
requireCheck boolean

setRequireBatteryTemperatureCheck

public void setRequireBatteryTemperatureCheck (boolean requireCheckTemprature)

设置是否需要对电池温度未知的设备进行电池温度检查

参数
requireCheckTemprature boolean

setSerial

public void setSerial (String... serialNumber)

设置序列号包含列表,替换所有现有值。

参数
serialNumber String

setStubEmulatorRequested

public void setStubEmulatorRequested (boolean stubEmulatorRequested)

设置了请求的桩模拟器标志

参数
stubEmulatorRequested boolean

shouldCreateTemporarilyPlaceholder

public boolean shouldCreateTemporarilyPlaceholder ()

根据元数据创建临时占位符。

返回
boolean

stubEmulatorRequested

public boolean stubEmulatorRequested ()

返回
boolean