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)

Gets the given devices product type

String getDeviceProductVariant(IDevice device)

取得指定裝置的產品子類

DeviceSelectionOptions.DeviceRequestedType getDeviceTypeRequested()
Collection<String> getExcludeSerials()

取得序號排除清單副本

Integer getMaxBatteryLevel()

取得要求的電池電量上限

Integer getMaxBatteryTemperature()

取得要求的電池電量上限

Integer getMinBatteryLevel()

取得要求的最低電池電量

Map<String, String> getNoMatchReason()

傳回裝置未相符的原因。

Collection<String> getProductTypes()

取得產品類型清單副本

Map<String, String> getProperties()

傳回屬性清單的地圖

boolean getRequireBatteryCheck()

取得電池電量不明的裝置是否需要檢查電池

boolean getRequireBatteryTemperatureCheck()

取得裝置是否需要檢查電池溫度 (電池溫度不明)

Collection<String> getSerials(IDevice device)

取得序號副本

List<String> 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)

設定要求的空值裝置旗標

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 值,或空值 (如果沒有)。

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 Collection<String> getExcludeSerials ()

取得序號排除清單副本

傳回
Collection<String> 一組序號Collection

getMaxBatteryLevel

public Integer getMaxBatteryLevel ()

取得要求的電池電量上限

傳回
Integer

getMaxBatteryTemperature

public Integer getMaxBatteryTemperature ()

取得要求的電池電量上限

傳回
Integer

getMinBatteryLevel

public Integer getMinBatteryLevel ()

取得要求的最低電池電量

傳回
Integer

getNoMatchReason

public Map<String, String> getNoMatchReason ()

傳回裝置未相符的原因。

傳回
Map<String, String> 序號對應未分配原因的對應項

getProductTypes

public Collection<String> getProductTypes ()

取得產品類型清單副本

傳回
Collection<String> Collection 個產品類型

getProperties

public Map<String, String> getProperties ()

傳回屬性清單的地圖

傳回
Map<String, String> 裝置屬性名稱對應值的 Map

getRequireBatteryCheck

public boolean getRequireBatteryCheck ()

取得電池電量不明的裝置是否需要檢查電池

傳回
boolean

getRequireBatteryTemperatureCheck

public boolean getRequireBatteryTemperatureCheck ()

取得裝置是否需要檢查電池溫度 (電池溫度不明)

傳回
boolean

getSerials

public Collection<String> getSerials (IDevice device)

取得序號副本

參數
device IDevice:代表要納入選取程序的裝置的 IDevice

傳回
Collection<String> 一組序號Collection

getSerials

public List<String> getSerials ()

傳回所要求序號的清單。

傳回
List<String>

localVirtualDeviceRequested

public boolean localVirtualDeviceRequested ()

傳回
boolean

完全相符

public boolean matches (IDevice device)

參數
device IDevice

傳回
boolean true:如果提供的選項與指定的 IDevice 相符。 其他情況則為 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)

設定要求的空值裝置旗標

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