FileDocCategorySizeDatePackage
IDevice.javaAPI DocAndroid 1.5 API6252Wed May 06 22:41:08 BST 2009com.android.ddmlib

IDevice

public interface IDevice
A Device. It can be a physical device or an emulator.

Fields Summary
public static final String
PROP_BUILD_VERSION
public static final String
PROP_BUILD_VERSION_NUMBER
public static final String
PROP_DEBUGGABLE
public static final String
FIRST_EMULATOR_SN
Serial number of the first connected emulator.
public static final int
CHANGE_STATE
Device change bit mask: {@link DeviceState} change.
public static final int
CHANGE_CLIENT_LIST
Device change bit mask: {@link Client} list change.
public static final int
CHANGE_BUILD_INFO
Device change bit mask: build info change.
Constructors Summary
Methods Summary
public booleancreateForward(int localPort, int remotePort)
Creates a port forwarding between a local and a remote port.

param
localPort the local port to forward
param
remotePort the remote port.
return
true if success.

public voidexecuteShellCommand(java.lang.String command, IShellOutputReceiver receiver)
Executes a shell command on the device, and sends the result to a receiver.

param
command The command to execute
param
receiver The receiver object getting the result from the command.
throws
IOException

public java.lang.StringgetAvdName()
Returns the name of the AVD the emulator is running.

This is only valid if {@link #isEmulator()} returns true.

If the emulator is not running any AVD (for instance it's running from an Android source tree build), this method will return "<build>".

return
the name of the AVD or null if there isn't any.

public ClientgetClient(java.lang.String applicationName)
Returns a {@link Client} by its application name.

param
applicationName the name of the application
return
the Client object or null if no match was found.

public java.lang.StringgetClientName(int pid)
Returns the name of the client by pid or null if pid is unknown

param
pid the pid of the client.

public Client[]getClients()
Returns the array of clients.

public FileListingServicegetFileListingService()
Returns a {@link FileListingService} for this device.

public java.util.MapgetProperties()
Returns the device properties. It contains the whole output of 'getprop'

public java.lang.StringgetProperty(java.lang.String name)
Returns a property value.

param
name the name of the value to return.
return
the value or null if the property does not exist.

public intgetPropertyCount()
Returns the number of property for this device.

public RawImagegetScreenshot()
Takes a screen shot of the device and returns it as a {@link RawImage}.

return
the screenshot as a RawImage or null if something went wrong.
throws
IOException

public java.lang.StringgetSerialNumber()
Returns the serial number of the device.

public com.android.ddmlib.Device.DeviceStategetState()
Returns the state of the device.

public SyncServicegetSyncService()
Returns a {@link SyncService} object to push / pull files to and from the device.

return
null if the SyncService couldn't be created.

public booleanhasClients()
Returns whether the {@link Device} has {@link Client}s.

public booleanisBootLoader()
Returns if the device is in bootloader mode.

return
true if {@link #getState()} returns {@link DeviceState#BOOTLOADER}.

public booleanisEmulator()
Returns true if the device is an emulator.

public booleanisOffline()
Returns if the device is offline.

return
true if {@link #getState()} returns {@link DeviceState#OFFLINE}.

public booleanisOnline()
Returns if the device is ready.

return
true if {@link #getState()} returns {@link DeviceState#ONLINE}.

public booleanremoveForward(int localPort, int remotePort)
Removes a port forwarding between a local and a remote port.

param
localPort the local port to forward
param
remotePort the remote port.
return
true if success.

public voidrunEventLogService(com.android.ddmlib.log.LogReceiver receiver)
Runs the event log service and outputs the event log to the {@link LogReceiver}.

param
receiver the receiver to receive the event log entries.
throws
IOException

public voidrunLogService(java.lang.String logname, com.android.ddmlib.log.LogReceiver receiver)
Runs the log service for the given log and outputs the log to the {@link LogReceiver}.

param
logname the logname of the log to read from.
param
receiver the receiver to receive the event log entries.
throws
IOException