public interface IShellEnabledDevice
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.String getName()
void executeShellCommand(java.lang.String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, java.util.concurrent.TimeUnit maxTimeUnits) throws TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, java.io.IOException
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.
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.maxTimeUnits
- Units for non-zero maxTimeToOutputResponse
values.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()
@NonNull java.util.concurrent.Future<java.lang.String> getSystemProperty(@NonNull java.lang.String name)
name
- the name of the value to return.Future
which can be used to retrieve value of property. Future#get() can
return null if property can not be retrieved.