IManagedTestDevice

public interface IManagedTestDevice
implements ITestDevice

com.android.tradefed.device.IManagedTestDevice
LocalAndroidVirtualDevice 用于在 TradeFed 主机上运行的本地虚拟设备的类。 
ManagedRemoteDevice 在虚拟机内运行的设备,我们通过虚拟机内的 Tradefed 实例远程管理该设备。 
NativeDevice ITestDevice 非完整堆栈 Android 设备的默认实现。 
NestedRemoteDevice 表示在远程 Cuttlefish 虚拟机内运行的设备。 
RemoteAndroidDevice 为通过 adb connect 连接的完整堆栈 Android 设备实现 ITestDevice。 
RemoteAndroidVirtualDevice 为在 Google Compute Engine (GCE) 中运行的全栈 Android 设备扩展了 RemoteAndroidDevice 行为。 
TestDevice 为完整堆栈 Android 设备实现 ITestDevice 


生命周期受管理的 ITestDevice。

摘要

公共方法

abstract DeviceInspectionResult debugDeviceNotAvailable()

检查设备,并在设备不可用时返回详细信息。

abstract DeviceAllocationState getAllocationState()

返回设备的当前分配状态

abstract Process getEmulatorProcess()

返回与此模拟器对应的 Process

abstract String getFastbootPath()

返回正在使用的 fastboot 二进制文件的路径。

abstract String getFastbootVersion()

返回正在使用的 fastboot 二进制文件的版本字符串。

abstract String getMacAddress()

返回设备的 MAC 地址,如果无法从设备中查询,则返回 null。

abstract IDeviceStateMonitor getMonitor()

返回与设备关联的 IDeviceStateMonitor

abstract String getSimOperator()

返回 SIM 卡运营商;如果没有可用信息或设备不可用,则返回 null。

abstract String getSimState()

返回 SIM 卡状态,如果不可用或设备不可用,则返回 null。

abstract IManagedTestDevice.DeviceEventResponse handleAllocationEvent(DeviceEvent event)

处理给定的 DeviceEvent。

abstract boolean isFastbootEnabled()

返回设备是否支持 fastboot。

abstract boolean recoverDevice()

在设备上调用恢复模式。

abstract void setDeviceState(TestDeviceState deviceState)

更新设备的状态。

abstract void setEmulatorProcess(Process p)

当此设备为模拟器时,设置 Process

abstract void setFastbootEnabled(boolean fastbootEnabled)

为设备设置 fastboot 选项。

abstract void setFastbootPath(String fastbootPath)

设置应使用的 fastboot 二进制文件的路径。

abstract void setIDevice(IDevice device)

更新与此 ITestDevice 关联的 IDevice。

公共方法

debugDeviceNotAvailable

public abstract DeviceInspectionResult debugDeviceNotAvailable ()

检查设备,并在设备不可用时返回详细信息。

getAllocationState

public abstract DeviceAllocationState getAllocationState ()

返回设备的当前分配状态

getEmulatorProcess

public abstract Process getEmulatorProcess ()

返回与此模拟器对应的 Process

返回
Process Processnull

getFastbootPath

public abstract String getFastbootPath ()

返回正在使用的 fastboot 二进制文件的路径。仍需要将 isFastbootEnabled() 设为 true,才能启用 fastboot 功能。

返回
String

getFastbootVersion

public abstract String getFastbootVersion ()

返回正在使用的 fastboot 二进制文件的版本字符串。或者,如果出现问题,则为 null。

返回
String

getMacAddress

public abstract String getMacAddress ()

返回设备的 MAC 地址,如果无法从设备中查询,则返回 null。

返回
String

getMonitor

public abstract IDeviceStateMonitor getMonitor ()

返回与设备关联的 IDeviceStateMonitor

getSimOperator

public abstract String getSimOperator ()

返回 SIM 卡运营商,如果不可用或设备不可用,则返回 null。

返回
String

getSimState

public abstract String getSimState ()

返回 SIM 卡状态,如果不可用或设备不可用,则返回 null。

返回
String

handleAllocationEvent

public abstract IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

处理给定的 DeviceEvent。可能会将设备转换为新状态。会通知 IDeviceMonitor 任何状态转换。

参数
event DeviceEvent

isFastbootEnabled

public abstract boolean isFastbootEnabled ()

返回设备是否支持 fastboot。

返回
boolean

recoverDevice

public abstract boolean recoverDevice ()

在设备上调用恢复。

返回
boolean 如果尝试恢复且成功,则返回 true;如果跳过了恢复,则返回 false

抛出
DeviceNotAvailableException 如果恢复未成功

setDeviceState

public abstract void setDeviceState (TestDeviceState deviceState)

更新设备的状态。

参数
deviceState TestDeviceStateTestDeviceState

setEmulatorProcess

public abstract void setEmulatorProcess (Process p)

当此设备为模拟器时,设置 Process

参数
p Process

setFastbootEnabled

public abstract void setFastbootEnabled (boolean fastbootEnabled)

为设备设置 fastboot 选项。应在首次分配设备时进行设置。

参数
fastbootEnabled boolean:设备是否支持 fastboot

setFastbootPath

public abstract void setFastbootPath (String fastbootPath)

设置应使用的 fastboot 二进制文件的路径。 仍需要将 isFastbootEnabled() 设为 true,才能启用 fastboot 功能。

参数
fastbootPath String

setIDevice

public abstract void setIDevice (IDevice device)

更新与此 ITestDevice 关联的 IDevice。

新的 IDevice 必须引用与当前引用相同的物理设备。如果 DDMS 分配了新的 IDevice,系统会调用此方法

参数
device IDeviceIDevice