com.android.ddmlib
Interface IShellEnabledDevice

All Known Subinterfaces:
IDevice

public interface IShellEnabledDevice

An abstract device that can receive shell commands.


Method Summary
 void executeShellCommand(java.lang.String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, java.util.concurrent.TimeUnit maxTimeUnits)
          Executes a shell command on the device, and sends the result to a receiver.
 java.lang.String getName()
          Returns a (humanized) name for this device.
 java.util.concurrent.Future<java.lang.String> getSystemProperty(java.lang.String name)
          Do a potential asynchronous query for a system property.
 

Method Detail

getName

java.lang.String getName()
Returns a (humanized) name for this device. Typically this is the AVD name for AVD's, and a combination of the manufacturer name, model name & serial number for devices.


executeShellCommand

void executeShellCommand(java.lang.String command,
                         IShellOutputReceiver receiver,
                         long maxTimeToOutputResponse,
                         java.util.concurrent.TimeUnit maxTimeUnits)
                         throws TimeoutException,
                                AdbCommandRejectedException,
                                ShellCommandUnresponsiveException,
                                java.io.IOException
Executes a shell command on the device, and sends the result to a receiver.

maxTimeToOutputResponse is used as a maximum waiting time when expecting the command output from the device.
At any time, if the shell command does not output anything for a period longer than maxTimeToOutputResponse, then the method will throw 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.

Parameters:
command - the shell command to execute
receiver - the IShellOutputReceiver that will receives the output of the shell command
maxTimeToOutputResponse - 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.
maxTimeUnits - Units for non-zero maxTimeToOutputResponse values.
Throws:
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.
See Also:
DdmPreferences.getTimeOut()

getSystemProperty

@NonNull
java.util.concurrent.Future<java.lang.String> getSystemProperty(@NonNull
                                                                        java.lang.String name)
Do a potential asynchronous query for a system property.

Parameters:
name - the name of the value to return.
Returns:
a Future which can be used to retrieve value of property. Future#get() can return null if property can not be retrieved.