RemoteAndroidDevice

public class RemoteAndroidDevice
extends TestDevice

java.lang.Object
   ↳ com.android.tradefed.device.NativeDevice
     ↳ com.android.tradefed.device.TestDevice
       ↳ com.android.tradefed.device.RemoteAndroidDevice


Implementation of a ITestDevice for a full stack android device connected via adb connect. Assume the device serial will be in the format : in adb.

Summary

Constants

long DEFAULT_SHORT_CMD_TIMEOUT

int MAX_RETRIES

long RETRY_INTERVAL_MS

long WAIT_FOR_ADB_CONNECT

Public constructors

RemoteAndroidDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Creates a RemoteAndroidDevice.

Public methods

static boolean checkSerialFormatValid(String serialString)

Check if the format of the serial is as expected :port

DeviceDescriptor getDeviceDescriptor()

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

Integer getInitialDeviceNumOffset()

Returns the known device num offset if any.

String getInitialIp()

Returns the initial associated ip to the device if any.

String getInitialSerial()

Returns the initial serial name of the device.

String getInitialUser()

Returns the initial known user if any.

String getMacAddress()

Returns the MAC address of the device, null if it fails to query from the device.

boolean isEncryptionSupported()

Returns if encryption is supported on the device.

void postInvocationTearDown(Throwable exception)

Extra steps for device specific required clean up that will be executed after the invocation is done.

void setAdbLogFile(File adbLogFile)

Give a receiver file where we can store all the adb connection logs for debugging purpose.

Constants

DEFAULT_SHORT_CMD_TIMEOUT

protected static final long DEFAULT_SHORT_CMD_TIMEOUT

Constant Value: 20000 (0x0000000000004e20)

MAX_RETRIES

protected static final int MAX_RETRIES

Constant Value: 5 (0x00000005)

RETRY_INTERVAL_MS

protected static final long RETRY_INTERVAL_MS

Constant Value: 5000 (0x0000000000001388)

WAIT_FOR_ADB_CONNECT

public static final long WAIT_FOR_ADB_CONNECT

Constant Value: 120000 (0x000000000001d4c0)

Public constructors

RemoteAndroidDevice

public RemoteAndroidDevice (IDevice device, 
                IDeviceStateMonitor stateMonitor, 
                IDeviceMonitor allocationMonitor)

Creates a RemoteAndroidDevice.

Parameters
device IDevice: the associated IDevice

stateMonitor IDeviceStateMonitor: the IDeviceStateMonitor mechanism to use

allocationMonitor IDeviceMonitor: the IDeviceMonitor to inform of allocation state changes.

Public methods

checkSerialFormatValid

public static boolean checkSerialFormatValid (String serialString)

Check if the format of the serial is as expected :port

Parameters
serialString String

Returns
boolean true if the format is valid, false otherwise.

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

Returns
DeviceDescriptor

getInitialDeviceNumOffset

public Integer getInitialDeviceNumOffset ()

Returns the known device num offset if any. Returns null if not available.

Returns
Integer

getInitialIp

public String getInitialIp ()

Returns the initial associated ip to the device if any. Returns null if no known initial ip.

Returns
String

getInitialSerial

public String getInitialSerial ()

Returns the initial serial name of the device.

Returns
String

getInitialUser

public String getInitialUser ()

Returns the initial known user if any. Returns null if no initial known user.

Returns
String

getMacAddress

public String getMacAddress ()

Returns the MAC address of the device, null if it fails to query from the device.

Returns
String

isEncryptionSupported

public boolean isEncryptionSupported ()

Returns if encryption is supported on the device.

Returns
boolean true if the device supports encryption.

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Extra steps for device specific required clean up that will be executed after the invocation is done.

Parameters
exception Throwable: if any, the final exception raised by the invocation failure.

setAdbLogFile

public void setAdbLogFile (File adbLogFile)

Give a receiver file where we can store all the adb connection logs for debugging purpose.

Parameters
adbLogFile File