IDeviceMonitor

public interface IDeviceMonitor

com.android.tradefed.device.IDeviceMonitor


Interface for monitoring state of devices. Intended to be passed to an IDeviceManager instance, at which point the IDeviceManager will invoke callbacks as the related events are triggered. Any caching or batching needs to be performed within the IDeviceMonitor instance.

Summary

Nested classes

class IDeviceMonitor.DeviceLister

A Runnable-like class that should return the known devices and their states. 

Public methods

abstract void notifyDeviceStateChange(String serial, DeviceAllocationState oldState, DeviceAllocationState newState)

Signals the IDeviceMonitor that a device state has been changed.

abstract void run()

A method that will be called after all of the Monitor's @Option fields have been set.

abstract void setDeviceLister(IDeviceMonitor.DeviceLister lister)

Allows the DeviceLister to be set.

abstract void stop()

A method that will be called when the Monitor need to be stopped.

Public methods

notifyDeviceStateChange

public abstract void notifyDeviceStateChange (String serial, 
                DeviceAllocationState oldState, 
                DeviceAllocationState newState)

Signals the IDeviceMonitor that a device state has been changed. Monitor implementations should limit the amount of processing and IDeviceManager/DeviceLister interaction they do in this method.

Parameters
serial String

oldState DeviceAllocationState

newState DeviceAllocationState

run

public abstract void run ()

A method that will be called after all of the Monitor's @Option fields have been set.

setDeviceLister

public abstract void setDeviceLister (IDeviceMonitor.DeviceLister lister)

Allows the DeviceLister to be set. After a successful attempt to set the Lister, implementations may discard all subsequent attempts.

Parameters
lister IDeviceMonitor.DeviceLister

stop

public abstract void stop ()

A method that will be called when the Monitor need to be stopped.