public final class

ShellExecutorImpl

extends Object
implements ShellExecutor
java.lang.Object
   ↳ androidx.test.services.shellexecutor.ShellExecutorImpl

Class Overview

Summary

Public Constructors
ShellExecutorImpl(Context context, String binderKey)
Public Methods
InputStream executeShellCommand(String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell)
Execute a command with elevated permissions and return immediately.
InputStream executeShellCommand(String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell, long timeoutMs)
Execute a command with elevated permissions and return immediately.
String executeShellCommandSync(String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell, long timeoutMs)
Execute a command with elevated permissions and block.
String executeShellCommandSync(String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell)
Execute a command with elevated permissions and block.
String getBinderKey()
[Expand]
Inherited Methods
From class java.lang.Object
From interface androidx.test.services.shellexecutor.ShellExecutor

Public Constructors

public ShellExecutorImpl (Context context, String binderKey)

Parameters
context Context
binderKey String

Public Methods

public InputStream executeShellCommand (String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell)

Execute a command with elevated permissions and return immediately.

Parameters
command String: The shell command to be executed.
parameters List: A Map parameters to be given to the shell command
shellEnv Map: A Map of shell environment variables to be set
executeThroughShell boolean: If set to true, the command string will be executed through the shell with parameters given as additional shell arguments.
Returns
InputStream InputStream representing the shell output of the command.
Throws
IOException
RemoteException

public InputStream executeShellCommand (String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell, long timeoutMs)

Execute a command with elevated permissions and return immediately.

Parameters
command String: The shell command to be executed.
parameters List: A Map parameters to be given to the shell command
shellEnv Map: A Map of shell environment variables to be set
executeThroughShell boolean: If set to true, the command string will be executed through the shell with parameters given as additional shell arguments.
timeoutMs long: Optional, destroys the executing subprocess if it runs longer than this timeout.
Returns
InputStream InputStream representing the shell output of the command.
Throws
IOException
RemoteException

public String executeShellCommandSync (String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell, long timeoutMs)

Execute a command with elevated permissions and block.

Parameters
command String: The shell command to be executed.
parameters List: A Map parameters to be given to the shell command
shellEnv Map: A Map of shell environment variables to be set
executeThroughShell boolean: If set to true, the command string will be executed through the shell with parameters given as additional shell arguments.
timeoutMs long: Optional, destroys the executing subprocess if it runs longer than this timeout.
Returns
String String representing the contents of the shell output of the command.
Throws
IOException

public String executeShellCommandSync (String command, List<String> parameters, Map<StringString> shellEnv, boolean executeThroughShell)

Execute a command with elevated permissions and block.

Parameters
command String: The shell command to be executed.
parameters List: A Map parameters to be given to the shell command
shellEnv Map: A Map of shell environment variables to be set
executeThroughShell boolean: If set to true, the command string will be executed through the shell with parameters given as additional shell arguments.
Returns
String String representing the contents of the shell output of the command.
Throws
IOException

public String getBinderKey ()

Returns
String