AdbSshConnection

public class AdbSshConnection
extends AdbTcpConnection

java.lang.Object
   ↳ com.android.tradefed.device.connection.AbstractConnection
     ↳ com.android.tradefed.device.connection.DefaultConnection
       ↳ com.android.tradefed.device.connection.AdbTcpConnection
         ↳ com.android.tradefed.device.connection.AdbSshConnection


通过 SSH 桥接的 ADB 连接。

摘要

公共构造函数

AdbSshConnection(DefaultConnection.ConnectionBuilder builder)

公共方法

HostOrchestratorUtil createHostOrchestratorUtil(GceAvdInfo gceAvdInfo)

用于创建主机编排器实用程序的辅助程序。

DeviceInspectionResult debugDeviceNotAvailable()

检查宿主虚拟机并在 DeviceInspectionResult 中检索更多详细信息。

CommandResult deleteSnapshotGce(String user, String snapshotId)

尝试删除 Cuttlefish 实例的快照

GceAvdInfo getAvdInfo()

返回所创建远程虚拟机的 GceAvdInfo

CuttlefishControl getCuttlefishControl()
AbstractTunnelMonitor getGceTunnelMonitor()

返回设备的 AbstractTunnelMonitor

String getHOBaseURL()

用于返回宿主编排器基本网址的辅助函数

void getSshBugreport()

通过直接 SSH 连接到设备来捕获远程 bug 报告。

List<File> getTombstones()

Cuttlefish 具有一项特殊功能,可将墓碑文件带到远程主机,以便我们直接获取这些文件。

void initializeConnection()

初始化设备的连接。

void notifyAdbRebootCalled()

在调用 doAdbReboot 时发送通知。

CommandResult powerwash()

尝试对 GCE 实例执行 Powerwash

CommandResult powerwashGce(String user, Integer offset)

尝试对 GCE 实例执行 Powerwash

void reconnect(String serial)

重新连接到设备。

void reconnectForRecovery(String serial)

重新连接到设备,以进行恢复例程。

CommandResult restoreSnapshotGce(String user, Integer offset, String snapshotId)

尝试恢复 Cuttlefish 实例的快照

CommandResult snapshotGce(String user, Integer offset, String snapshotId)

尝试拍摄 Cuttlefish 实例的快照

void tearDownConnection()

清理连接。

受保护的方法

long getCurrentTime()

返回当前系统时间。

void launchGce(IBuildInfo buildInfo, MultiMap<String, String> attributes)

根据 build 信息启动实际的 GCE 设备。

void waitForTunnelOnline(long waitTime)

检查隧道监控器是否正在运行。

公共构造函数

AdbSshConnection

public AdbSshConnection (DefaultConnection.ConnectionBuilder builder)

参数
builder DefaultConnection.ConnectionBuilder

公共方法

createHostOrchestratorUtil

public HostOrchestratorUtil createHostOrchestratorUtil (GceAvdInfo gceAvdInfo)

用于创建主机编排器实用程序的辅助程序。

参数
gceAvdInfo GceAvdInfo

返回
HostOrchestratorUtil

debugDeviceNotAvailable

public DeviceInspectionResult debugDeviceNotAvailable ()

检查宿主虚拟机,并在 DeviceInspectionResult 中检索更多详细信息。

返回
DeviceInspectionResult DeviceInspectionResult

deleteSnapshotGce

public CommandResult deleteSnapshotGce (String user, 
                String snapshotId)

尝试删除 Cuttlefish 实例的快照

参数
user String:AVD 的运行用户,如果不可用,则为 null

snapshotId String

返回
CommandResult 返回删除快照尝试的 CommandResult

抛出
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

getAvdInfo

public GceAvdInfo getAvdInfo ()

返回所创建远程虚拟机的 GceAvdInfo。无论状态如何,都会返回,以便我们可以检查信息。

返回
GceAvdInfo

getCuttlefishControl

public CuttlefishControl getCuttlefishControl ()

返回
CuttlefishControl

getGceTunnelMonitor

public AbstractTunnelMonitor getGceTunnelMonitor ()

返回设备的 AbstractTunnelMonitor

返回
AbstractTunnelMonitor

getHOBase网址

public String getHOBaseURL ()

用于返回宿主编排器基本网址的辅助函数

返回
String

getSshBugreport

public void getSshBugreport ()

通过直接 SSH 连接到设备来捕获远程 bug 报告。

getTombstones

public List<File> getTombstones ()

Cuttlefish 有一项特殊功能,可将 tombstone 带到远程主机,以便我们直接获取它们。

返回
List<File>

initializeConnection

public void initializeConnection ()

初始化设备的连接。

抛出
DeviceNotAvailableException
TargetSetupError

notifyAdbRebootCalled

public void notifyAdbRebootCalled ()

在调用 doAdbReboot 时发送通知。

执行 Powerwash 操作 : 通过 Powerwash 恢复出厂设置 (please be flexible)

public CommandResult powerwash ()

尝试对 GCE 实例执行 Powerwash

返回
CommandResult 返回 powerwash 尝试的 CommandResult

抛出
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

powerwashGce

public CommandResult powerwashGce (String user, 
                Integer offset)

尝试对 GCE 实例执行 Powerwash

参数
user String:AVD 的运行用户,如果不可用,则为 null

offset Integer:主机中 AVD 的设备编号偏移量,null 表示不适用

返回
CommandResult 返回 powerwash 尝试的 CommandResult

抛出
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

重新连接

public void reconnect (String serial)

重新连接到设备。

参数
serial String:设备序列号。

抛出
DeviceNotAvailableException

reconnectForRecovery

public void reconnectForRecovery (String serial)

重新连接设备以进行恢复例程。

参数
serial String:设备序列号。

抛出
DeviceNotAvailableException

restoreSnapshotGce

public CommandResult restoreSnapshotGce (String user, 
                Integer offset, 
                String snapshotId)

尝试恢复 Cuttlefish 实例的快照

参数
user String:AVD 的运行用户,如果不可用,则为 null

offset Integer:主机中 AVD 的设备编号偏移量,null 表示不适用

snapshotId String:快照 ID

返回
CommandResult 返回恢复快照尝试的 CommandResult

抛出
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

snapshotGce

public CommandResult snapshotGce (String user, 
                Integer offset, 
                String snapshotId)

尝试拍摄 Cuttlefish 实例的快照

参数
user String:AVD 的运行用户,如果不可用,则为 null

offset Integer:主机中 AVD 的设备编号偏移量,null 表示不适用

snapshotId String

返回
CommandResult 返回快照尝试的 CommandResult

抛出
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

tearDownConnection

public void tearDownConnection ()

清理连接。

受保护的方法

getCurrentTime

protected long getCurrentTime ()

返回当前系统时间。公开以供测试。

返回
long

launchGce

protected void launchGce (IBuildInfo buildInfo, 
                MultiMap<String, String> attributes)

根据 build 信息启动实际的 GCE 设备。

参数
buildInfo IBuildInfo

attributes MultiMap

抛出
TargetSetupError

waitForTunnelOnline

protected void waitForTunnelOnline (long waitTime)

检查隧道监控器是否正在运行。

参数
waitTime long

抛出
DeviceNotAvailableException