DeviceTracker

class DeviceTracker
extends Object

java.lang.Object
   ↳ com.android.tradefed.command.remote.DeviceTracker


Singleton class that tracks devices that have been remotely allocated.

Summary

Public methods

void allocateDevice(ITestDevice d)

Mark given device as remotely allocated.

Collection<ITestDevice> freeAll()

Mark all remotely allocated devices as freed.

ITestDevice freeDevice(String serial)

Mark given device serial as freed and clear the command result if any.

ITestDevice getDeviceForSerial(String serial)

Return a previously allocated device that matches given serial.

static DeviceTracker getInstance()
ExecCommandTracker getLastCommandResult(String deviceSerial)

Retrieve the last Future command result for given device.

void setCommandTracker(String deviceSerial, ExecCommandTracker tracker)

Sets the command result tracker for given device.

Public methods

allocateDevice

void allocateDevice (ITestDevice d)

Mark given device as remotely allocated.

Parameters
d ITestDevice

freeAll

Collection<ITestDevice> freeAll ()

Mark all remotely allocated devices as freed.

Returns
Collection<ITestDevice> a Collection of all remotely allocated devices

freeDevice

ITestDevice freeDevice (String serial)

Mark given device serial as freed and clear the command result if any.

Parameters
serial String

Returns
ITestDevice the corresponding ITestDevice or null if device with given serial cannot be found

getDeviceForSerial

ITestDevice getDeviceForSerial (String serial)

Return a previously allocated device that matches given serial.

Returns
ITestDevice the ITestDevice or null if it cannot be found

getInstance

DeviceTracker getInstance ()

Returns
DeviceTracker

getLastCommandResult

ExecCommandTracker getLastCommandResult (String deviceSerial)

Retrieve the last Future command result for given device.

Returns
ExecCommandTracker the Future or null if no result exists for device. Note results are cleared on freeDevice(String).

setCommandTracker

void setCommandTracker (String deviceSerial, 
                ExecCommandTracker tracker)

Sets the command result tracker for given device.