|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IDevice
A Device. It can be a physical device or an emulator.
| Nested Class Summary | |
|---|---|
static class |
IDevice.DeviceState
The state of a device. |
| Field Summary | |
|---|---|
static java.lang.String |
FIRST_EMULATOR_SN
Serial number of the first connected emulator. |
static int |
CHANGE_BUILD_INFO
Device change bit mask: build info change. |
static int |
CHANGE_CLIENT_LIST
Device change bit mask: Client list change. |
static int |
CHANGE_STATE
Device change bit mask: IDevice.DeviceState change. |
static java.lang.String |
MNT_DATA
|
static java.lang.String |
MNT_EXTERNAL_STORAGE
|
static java.lang.String |
MNT_ROOT
|
static java.lang.String |
PROP_BUILD_API_LEVEL
|
static java.lang.String |
PROP_BUILD_CODENAME
|
static java.lang.String |
PROP_BUILD_VERSION
|
static java.lang.String |
PROP_BUILD_VERSION_NUMBER
Deprecated. Use PROP_BUILD_API_LEVEL. |
static java.lang.String |
PROP_DEBUGGABLE
|
| Method Summary | |
|---|---|
void |
createForward(int localPort,
int remotePort)
Creates a port forwarding between a local and a remote port. |
void |
executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver)
Executes a shell command on the device, and sends the result to a receiver This is similar to calling executeShellCommand(command, receiver, DdmPreferences.getTimeOut()). |
void |
executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver,
int maxTimeToOutputResponse)
Executes a shell command on the device, and sends the result to a receiver. |
java.lang.String |
getAvdName()
Returns the name of the AVD the emulator is running. |
Client |
getClient(java.lang.String applicationName)
Returns a Client by its application name. |
java.lang.String |
getClientName(int pid)
Returns the name of the client by pid or null if pid is unknown |
Client[] |
getClients()
Returns the array of clients. |
FileListingService |
getFileListingService()
Returns a FileListingService for this device. |
java.lang.String |
getMountPoint(java.lang.String name)
Returns a mount point. |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns the device properties. |
java.lang.String |
getProperty(java.lang.String name)
Returns a property value. |
int |
getPropertyCount()
Returns the number of property for this device. |
RawImage |
getScreenshot()
Takes a screen shot of the device and returns it as a RawImage. |
java.lang.String |
getSerialNumber()
Returns the serial number of the device. |
IDevice.DeviceState |
getState()
Returns the state of the device. |
SyncService |
getSyncService()
Returns a SyncService object to push / pull files to and from the device. |
boolean |
hasClients()
Returns whether the Device has Clients. |
java.lang.String |
installPackage(java.lang.String packageFilePath,
boolean reinstall)
Installs an Android application on device. |
java.lang.String |
installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall)
Installs the application package that was pushed to a temporary location on the device. |
boolean |
isBootLoader()
Returns if the device is in bootloader mode. |
boolean |
isEmulator()
Returns true if the device is an emulator. |
boolean |
isOffline()
Returns if the device is offline. |
boolean |
isOnline()
Returns if the device is ready. |
void |
reboot(java.lang.String into)
Reboot the device. |
void |
removeForward(int localPort,
int remotePort)
Removes a port forwarding between a local and a remote port. |
void |
removeRemotePackage(java.lang.String remoteFilePath)
Removes a file from device. |
void |
runEventLogService(LogReceiver receiver)
Runs the event log service and outputs the event log to the LogReceiver. |
void |
runLogService(java.lang.String logname,
LogReceiver receiver)
Runs the log service for the given log and outputs the log to the LogReceiver. |
java.lang.String |
syncPackageToDevice(java.lang.String localFilePath)
Pushes a file to device |
java.lang.String |
uninstallPackage(java.lang.String packageName)
Uninstalls an package from the device. |
| Field Detail |
|---|
static final java.lang.String PROP_BUILD_VERSION
static final java.lang.String PROP_BUILD_API_LEVEL
static final java.lang.String PROP_BUILD_CODENAME
static final java.lang.String PROP_DEBUGGABLE
static final java.lang.String FIRST_EMULATOR_SN
static final int CHANGE_STATE
IDevice.DeviceState change.
static final int CHANGE_CLIENT_LIST
Client list change.
static final int CHANGE_BUILD_INFO
static final java.lang.String PROP_BUILD_VERSION_NUMBER
PROP_BUILD_API_LEVEL.static final java.lang.String MNT_EXTERNAL_STORAGE
static final java.lang.String MNT_ROOT
static final java.lang.String MNT_DATA
| Method Detail |
|---|
java.lang.String getSerialNumber()
java.lang.String getAvdName()
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>".
null if there isn't any.IDevice.DeviceState getState()
java.util.Map<java.lang.String,java.lang.String> getProperties()
int getPropertyCount()
java.lang.String getProperty(java.lang.String name)
name - the name of the value to return.
null if the property does not exist.java.lang.String getMountPoint(java.lang.String name)
name - the name of the mount point to returnMNT_EXTERNAL_STORAGE,
MNT_ROOT,
MNT_DATAboolean isOnline()
true if getState() returns IDevice.DeviceState.ONLINE.boolean isEmulator()
true if the device is an emulator.
boolean isOffline()
true if getState() returns IDevice.DeviceState.OFFLINE.boolean isBootLoader()
true if getState() returns IDevice.DeviceState.BOOTLOADER.boolean hasClients()
Device has Clients.
Client[] getClients()
Client getClient(java.lang.String applicationName)
Client by its application name.
applicationName - the name of the application
Client object or null if no match was found.
SyncService getSyncService()
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
SyncService object to push / pull files to and from the device.
null if the SyncService couldn't be created. This can happen if adb
refuse to open the connection because the IDevice is invalid
(or got disconnected).
TimeoutException - in case of timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException - if the connection with adb failed.FileListingService getFileListingService()
FileListingService for this device.
RawImage getScreenshot()
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
RawImage.
RawImage or null if something
went wrong.
TimeoutException - in case of timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException - in case of I/O error on the connection.
void executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
executeShellCommand(command, receiver, DdmPreferences.getTimeOut()).
command - the shell command to executereceiver - the IShellOutputReceiver that will receives the output of the shell
command
TimeoutException - in case of timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
ShellCommandUnresponsiveException - in case the shell command doesn't send output
for a given time.
java.io.IOException - in case of I/O error on the connection.executeShellCommand(String, IShellOutputReceiver, int),
DdmPreferences.getTimeOut()
void executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver,
int maxTimeToOutputResponse)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
ShellCommandUnresponsiveException.
For commands like log output, a maxTimeToOutputResponse value of 0, meaning
that the method will never throw and will block until the receiver's
IShellOutputReceiver.isCancelled() returns true, should be
used.
command - the shell command to executereceiver - the IShellOutputReceiver that will receives the output of the shell
commandmaxTimeToOutputResponse - the maximum amount of time during which the command is allowed
to not output any response. A value of 0 means the method will wait forever
(until the receiver cancels the execution) for command output and
never throw.
TimeoutException - in case of timeout on the connection when sending the command.
AdbCommandRejectedException - if adb rejects the command.
ShellCommandUnresponsiveException - in case the shell command doesn't send any output
for a period longer than maxTimeToOutputResponse.
java.io.IOException - in case of I/O error on the connection.DdmPreferences.getTimeOut()
void runEventLogService(LogReceiver receiver)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
LogReceiver.
This call is blocking until LogReceiver.isCancelled() returns true.
receiver - the receiver to receive the event log entries.
TimeoutException - in case of timeout on the connection. This can only be thrown if the
timeout happens during setup. Once logs start being received, no timeout will occur as it's
not possible to detect a difference between no log and timeout.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException - in case of I/O error on the connection.
void runLogService(java.lang.String logname,
LogReceiver receiver)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
LogReceiver.
This call is blocking until LogReceiver.isCancelled() returns true.
logname - the logname of the log to read from.receiver - the receiver to receive the event log entries.
TimeoutException - in case of timeout on the connection. This can only be thrown if the
timeout happens during setup. Once logs start being received, no timeout will
occur as it's not possible to detect a difference between no log and timeout.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException - in case of I/O error on the connection.
void createForward(int localPort,
int remotePort)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
localPort - the local port to forwardremotePort - the remote port.
TimeoutException - in case of timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException - in case of I/O error on the connection.
void removeForward(int localPort,
int remotePort)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
localPort - the local port to forwardremotePort - the remote port.
TimeoutException - in case of timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException - in case of I/O error on the connection.java.lang.String getClientName(int pid)
null if pid is unknown
pid - the pid of the client.
java.lang.String installPackage(java.lang.String packageFilePath,
boolean reinstall)
throws InstallException
packageFilePath - the absolute file system path to file on local host to installreinstall - set to true if re-install of app should be performed
String with an error code, or null if success.
InstallException - if the installation fails.
java.lang.String syncPackageToDevice(java.lang.String localFilePath)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException,
SyncException
localFilePath - the absolute path to file on local host
String destination path on device for file
TimeoutException - in case of timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException - in case of I/O error on the connection.
SyncException - if an error happens during the push of the package on the device.
java.lang.String installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall)
throws InstallException
remoteFilePath - absolute file path to package file on devicereinstall - set to true if re-install of app should be performed
InstallException - if the installation fails.
void removeRemotePackage(java.lang.String remoteFilePath)
throws InstallException
remoteFilePath - path on device of file to remove
InstallException - if the installation fails.
java.lang.String uninstallPackage(java.lang.String packageName)
throws InstallException
packageName - the Android application package name to uninstall
String with an error code, or null if success.
InstallException - if the uninstallation fails.
void reboot(java.lang.String into)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
into - the bootloader name to reboot into, or null to just reboot the device.
TimeoutException - in case of timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||