ManagedTestDeviceFactory

public class ManagedTestDeviceFactory
extends Object implements IManagedTestDeviceFactory

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


Factory to create the different kind of devices that can be monitored by Tf

Summary

Constants

String CHECK_PM_CMD

String EXPECTED_ERROR

String EXPECTED_RES

int FRAMEWORK_CHECK_MAX_RETRY

long FRAMEWORK_CHECK_SLEEP_MS

Fields

protected IDeviceMonitor mAllocationMonitor

protected IDeviceManager mDeviceManager

protected boolean mFastbootEnabled

Public constructors

ManagedTestDeviceFactory(boolean fastbootEnabled, IDeviceManager deviceManager, IDeviceMonitor allocationMonitor)

Public methods

IManagedTestDevice createDevice(IDevice idevice)

Create a IManagedTestDevice based on the IDevice passed to it.

void setFastbootEnabled(boolean enable)

Enable or not fastboot support for the device created.

Protected methods

boolean checkFrameworkSupport(IDevice idevice)

Helper that return true if device has framework support.

CollectingOutputReceiver createOutputReceiver()

Create a CollectingOutputReceiver.

IRunUtil getRunUtil()

Return the default IRunUtil instance.

boolean isTcpDeviceSerial(String serial)

Helper to device if it's a serial from a remotely connected device.

Constants

CHECK_PM_CMD

String CHECK_PM_CMD

Constant Value: "ls %s"

EXPECTED_ERROR

String EXPECTED_ERROR

Constant Value: "No such file or directory"

EXPECTED_RES

String EXPECTED_RES

Constant Value: "/system/bin/pm"

FRAMEWORK_CHECK_MAX_RETRY

int FRAMEWORK_CHECK_MAX_RETRY

Constant Value: 3 (0x00000003)

FRAMEWORK_CHECK_SLEEP_MS

long FRAMEWORK_CHECK_SLEEP_MS

Constant Value: 500 (0x00000000000001f4)

Fields

mAllocationMonitor

IDeviceMonitor mAllocationMonitor

mDeviceManager

IDeviceManager mDeviceManager

mFastbootEnabled

boolean mFastbootEnabled

Public constructors

ManagedTestDeviceFactory

ManagedTestDeviceFactory (boolean fastbootEnabled, 
                IDeviceManager deviceManager, 
                IDeviceMonitor allocationMonitor)

Parameters
fastbootEnabled boolean

deviceManager IDeviceManager

allocationMonitor IDeviceMonitor

Public methods

createDevice

IManagedTestDevice createDevice (IDevice idevice)

Create a IManagedTestDevice based on the IDevice passed to it.

Parameters
idevice IDevice: that will define the type of device created

Returns
IManagedTestDevice a IManagedTestDevice created base on the IDevice

setFastbootEnabled

void setFastbootEnabled (boolean enable)

Enable or not fastboot support for the device created.

Parameters
enable boolean: value set the support.

Protected methods

checkFrameworkSupport

boolean checkFrameworkSupport (IDevice idevice)

Helper that return true if device has framework support.

Parameters
idevice IDevice

Returns
boolean

createOutputReceiver

CollectingOutputReceiver createOutputReceiver ()

Create a CollectingOutputReceiver. Exposed for testing.

Returns
CollectingOutputReceiver

getRunUtil

IRunUtil getRunUtil ()

Return the default IRunUtil instance. Exposed for testing.

Returns
IRunUtil

isTcpDeviceSerial

boolean isTcpDeviceSerial (String serial)

Helper to device if it's a serial from a remotely connected device. serial format of tcp device is :

Parameters
serial String

Returns
boolean