{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
interface ShellExecutor
Executes a shell command in a similar manner and environment as #executeShellCommand , (i.e. as either root or shell user).
Unlike UiAutomation this is available on all API levels and will not conflict with other instances of UiAutomation.
Public methods |
|
|---|---|
abstract @NonNull InputStream |
executeShellCommand(Execute a command with elevated permissions and return immediately. |
abstract @NonNull InputStream |
executeShellCommand(Execute a command with elevated permissions and return immediately. |
abstract @NonNull String |
executeShellCommandSync(Execute a command with elevated permissions and block. |
abstract @NonNull String |
executeShellCommandSync(Execute a command with elevated permissions and block. |
abstract @NonNull String |
|
@NonNull
public abstract InputStream executeShellCommand(
@NonNull String command,
@NonNull List<@NonNull String> parameters,
@NonNull Map<@NonNull String, @NonNull String> shellEnv,
@NonNull boolean executeThroughShell,
@NonNull long timeoutMs
)
Execute a command with elevated permissions and return immediately.
| Parameters | |
|---|---|
@NonNull String command |
The shell command to be executed. |
@NonNull List<@NonNull String> parameters |
A |
@NonNull Map<@NonNull String, @NonNull String> shellEnv |
A |
@NonNull boolean executeThroughShell |
If set to true, the command string will be executed through the shell with parameters given as additional shell arguments. |
@NonNull long timeoutMs |
Optional, destroys the executing subprocess if it runs longer than this timeout. |
| Returns | |
|---|---|
InputStream |
|
| Throws | |
|---|---|
java.io.IOException |
if cannot execute command on executor service. |
@NonNull
public abstract InputStream executeShellCommand(
@NonNull String command,
@NonNull List<@NonNull String> parameters,
@NonNull Map<@NonNull String, @NonNull String> shellEnv,
@NonNull boolean executeThroughShell
)
Execute a command with elevated permissions and return immediately.
| Parameters | |
|---|---|
@NonNull String command |
The shell command to be executed. |
@NonNull List<@NonNull String> parameters |
A |
@NonNull Map<@NonNull String, @NonNull String> shellEnv |
A |
@NonNull boolean executeThroughShell |
If set to true, the command string will be executed through the shell with parameters given as additional shell arguments. |
| Returns | |
|---|---|
InputStream |
|
| Throws | |
|---|---|
java.io.IOException |
if cannot execute command on executor service. |
@NonNull
public abstract String executeShellCommandSync(
@NonNull String command,
@NonNull List<@NonNull String> parameters,
@NonNull Map<@NonNull String, @NonNull String> shellEnv,
@NonNull boolean executeThroughShell,
@NonNull long timeoutMs
)
Execute a command with elevated permissions and block.
| Parameters | |
|---|---|
@NonNull String command |
The shell command to be executed. |
@NonNull List<@NonNull String> parameters |
A |
@NonNull Map<@NonNull String, @NonNull String> shellEnv |
A |
@NonNull boolean executeThroughShell |
If set to true, the command string will be executed through the shell with parameters given as additional shell arguments. |
@NonNull long timeoutMs |
Optional, destroys the executing subprocess if it runs longer than this timeout. |
| Throws | |
|---|---|
java.io.IOException |
if cannot execute command on executor service. |
@NonNull
public abstract String executeShellCommandSync(
@NonNull String command,
@NonNull List<@NonNull String> parameters,
@NonNull Map<@NonNull String, @NonNull String> shellEnv,
@NonNull boolean executeThroughShell
)
Execute a command with elevated permissions and block.
| Parameters | |
|---|---|
@NonNull String command |
The shell command to be executed. |
@NonNull List<@NonNull String> parameters |
A |
@NonNull Map<@NonNull String, @NonNull String> shellEnv |
A |
@NonNull boolean executeThroughShell |
If set to true, the command string will be executed through the shell with parameters given as additional shell arguments. |
| Throws | |
|---|---|
java.io.IOException |
if cannot execute command on executor service. |