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


Adb connection over an ssh bridge.

Summary

Public constructors

AdbSshConnection(DefaultConnection.ConnectionBuilder builder)

Public methods

GceAvdInfo getAvdInfo()

Returns the GceAvdInfo from the created remote VM.

GceSshTunnelMonitor getGceSshMonitor()

Returns the GceSshTunnelMonitor of the device.

void getSshBugreport()

Capture a remote bugreport by ssh-ing into the device directly.

getTombstones()

Cuttlefish has a special feature that brings the tombstones to the remote host where we can get them directly.

void initializeConnection()

Initialize the connection of the device.

void notifyAdbRebootCalled()

Notify when doAdbReboot is called.

CommandResult powerwash()

Attempt to powerwash a GCE instance

CommandResult powerwashGce(String user, Integer offset)

Attempt to powerwash a GCE instance

void reconnect(String serial)

Reconnect the connection to the device.

void reconnectForRecovery(String serial)

Reconnect the connection to the device for the recovery routine.

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

Attempt to restore snapshot of a Cuttlefish instance

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

Attempt to snapshot a Cuttlefish instance

void tearDownConnection()

Clean up the connection.

Protected methods

long getCurrentTime()

Returns the current system time.

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

Launch the actual gce device based on the build info.

void waitForTunnelOnline(long waitTime)

Check if the tunnel monitor is running.

Public constructors

AdbSshConnection

public AdbSshConnection (DefaultConnection.ConnectionBuilder builder)

Parameters
builder DefaultConnection.ConnectionBuilder

Public methods

getAvdInfo

public GceAvdInfo getAvdInfo ()

Returns the GceAvdInfo from the created remote VM. Returns regardless of the status so we can inspect the info.

Returns
GceAvdInfo

getGceSshMonitor

public GceSshTunnelMonitor getGceSshMonitor ()

Returns the GceSshTunnelMonitor of the device.

Returns
GceSshTunnelMonitor

getSshBugreport

public void getSshBugreport ()

Capture a remote bugreport by ssh-ing into the device directly.

getTombstones

public  getTombstones ()

Cuttlefish has a special feature that brings the tombstones to the remote host where we can get them directly.

Returns

initializeConnection

public void initializeConnection ()

Initialize the connection of the device.

Throws
DeviceNotAvailableException
TargetSetupError

notifyAdbRebootCalled

public void notifyAdbRebootCalled ()

Notify when doAdbReboot is called.

powerwash

public CommandResult powerwash ()

Attempt to powerwash a GCE instance

Returns
CommandResult returns CommandResult of the powerwash attempts

Throws
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

powerwashGce

public CommandResult powerwashGce (String user, 
                Integer offset)

Attempt to powerwash a GCE instance

Parameters
user String: the host running user of AVD, null if not applicable.

offset Integer: the device num offset of the AVD in the host, null if not applicable

Returns
CommandResult returns CommandResult of the powerwash attempts

Throws
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

reconnect

public void reconnect (String serial)

Reconnect the connection to the device.

Parameters
serial String: The device serial number.

Throws
DeviceNotAvailableException

reconnectForRecovery

public void reconnectForRecovery (String serial)

Reconnect the connection to the device for the recovery routine.

Parameters
serial String: The device serial number.

Throws
DeviceNotAvailableException

restoreSnapshotGce

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

Attempt to restore snapshot of a Cuttlefish instance

Parameters
user String: the host running user of AVD, null if not applicable.

offset Integer: the device num offset of the AVD in the host, null if not applicable

snapshotId String: the snapshot ID

Returns
CommandResult returns CommandResult of the restore snapshot attempts

Throws
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

snapshotGce

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

Attempt to snapshot a Cuttlefish instance

Parameters
user String: the host running user of AVD, null if not applicable.

offset Integer: the device num offset of the AVD in the host, null if not applicable

snapshotId String

Returns
CommandResult returns CommandResult of the snapshot attempts

Throws
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

tearDownConnection

public void tearDownConnection ()

Clean up the connection.

Protected methods

getCurrentTime

protected long getCurrentTime ()

Returns the current system time. Exposed for testing.

Returns
long

launchGce

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

Launch the actual gce device based on the build info.

Parameters
buildInfo IBuildInfo

attributes MultiMap

Throws
TargetSetupError

waitForTunnelOnline

protected void waitForTunnelOnline (long waitTime)

Check if the tunnel monitor is running.

Parameters
waitTime long

Throws
DeviceNotAvailableException