ManagedTestDeviceFactory

public class ManagedTestDeviceFactory
extends Object implements IManagedTestDeviceFactory

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


用于创建可由 Tf 监控的不同类型设备的工厂

摘要

常量

String CHECK_PM_CMD

String EXPECTED_ERROR

String EXPECTED_RES

int FRAMEWORK_CHECK_MAX_RETRY

long FRAMEWORK_CHECK_SLEEP_MS

String IPADDRESS_PATTERN

String NOTIFY_AS_NATIVE

字段

protected IDeviceMonitor mAllocationMonitor

protected IDeviceManager mDeviceManager

protected boolean mFastbootEnabled

公共构造函数

ManagedTestDeviceFactory(boolean fastbootEnabled, IDeviceManager deviceManager, IDeviceMonitor allocationMonitor)

公共方法

IManagedTestDevice createDevice(IDevice idevice)

根据传递给它的 IDevice 创建 IManagedTestDevice

IManagedTestDevice createRequestedDevice(IDevice idevice, IDeviceSelection options)

专门创建符合规范的设备

static boolean isTcpDeviceSerial(String serial)

如果序列号来自远程连接的设备,则为设备的辅助程序。

void setFastbootEnabled(boolean enable)

是否为创建的设备启用 fastboot 支持。

受保护的方法

CollectingOutputReceiver createOutputReceiver()

创建 CollectingOutputReceiver

IRunUtil getRunUtil()

返回默认的 IRunUtil 实例。

boolean isRemoteEnvironment()

如果我们目前在远程环境中运行,则返回 true。

常量

CHECK_PM_CMD

protected static final String CHECK_PM_CMD

常量值: "ls %s"

EXPECTED_ERROR

protected static final String EXPECTED_ERROR

常量值: “No such file or directory”(不存在此类文件或目录)

EXPECTED_RES

protected static final String EXPECTED_RES

常量值: "/system/bin/pm"

FRAMEWORK_CHECK_MAX_RETRY

protected static final int FRAMEWORK_CHECK_MAX_RETRY

常量值: 3 (0x00000003)

FRAMEWORK_CHECK_SLEEP_MS

protected static final long FRAMEWORK_CHECK_SLEEP_MS

常量值: 500 (0x00000000000001f4)

IPADDRESS_PATTERN

public static final String IPADDRESS_PATTERN

常量值: "((^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5]))|(localhost)){1}"

NOTIFY_AS_NATIVE

public static final String NOTIFY_AS_NATIVE

常量值: "NOTIFY_AS_NATIVE"

字段

mAllocationMonitor

protected IDeviceMonitor mAllocationMonitor

mDeviceManager

protected IDeviceManager mDeviceManager

mFastbootEnabled

protected boolean mFastbootEnabled

公共构造函数

ManagedTestDeviceFactory

public ManagedTestDeviceFactory (boolean fastbootEnabled, 
                IDeviceManager deviceManager, 
                IDeviceMonitor allocationMonitor)

参数
fastbootEnabled boolean

deviceManager IDeviceManager

allocationMonitor IDeviceMonitor

公共方法

createDevice

public IManagedTestDevice createDevice (IDevice idevice)

根据传递给它的 IDevice 创建 IManagedTestDevice

参数
idevice IDevice:用于定义所创建设备的类型

返回
IManagedTestDevice 基于 IDevice 创建的 IManagedTestDevice

createRequestedDevice

public IManagedTestDevice createRequestedDevice (IDevice idevice, 
                IDeviceSelection options)

专门创建符合规范的设备

参数
idevice IDevice

options IDeviceSelection

返回
IManagedTestDevice

isTcpDeviceSerial

public static boolean isTcpDeviceSerial (String serial)

如果设备是远程连接的设备的序列,则辅助设备。TCP 设备的序列格式为 :

参数
serial String

返回
boolean

setFastbootEnabled

public void setFastbootEnabled (boolean enable)

为所创建的设备启用或不启用 fastboot 支持。

参数
enable boolean:设置支持的值。

受保护的方法

createOutputReceiver

protected CollectingOutputReceiver createOutputReceiver ()

创建 CollectingOutputReceiver

返回
CollectingOutputReceiver

getRunUtil

protected IRunUtil getRunUtil ()

返回默认的 IRunUtil 实例。

返回
IRunUtil

isRemoteEnvironment

protected boolean isRemoteEnvironment ()

如果我们目前在远程环境中运行,则返回 true。这会改变设备行为。

返回
boolean