public static class Shell


Allows to execute commands. This class builds on top of ShellProcess and abstracts the shell streams to focus on the output of a single command execution. A ShellProcess is created for each executed command, using a ShellServer that can be reset by Shell.setShellServer.

Summary

Nested types

public final class Shell.CommandOutput

The output of a shell command executed via Shell.command.

Public fields

static @NonNull Shell

Public methods

final @NonNull ApplicationCommands
application(@NonNull String packageName)

Commands for application.

final @NonNull Shell.CommandOutput

Executes a given command and returns the ongoing CommandOutput.

final @NonNull PermissionCommands
permission(@NonNull String packageName)

Commands for permissions.

final @NonNull ProcessCommands

Commands for processes.

final @NonNull RecorderCommands

Commands for screen recorder.

final @NonNull ScreenCommands

Commands for screen.

final void

Allows configuring the underlying ShellProcess utilized to execute the commands.

final @NonNull WifiCommands

Commands for wifi.

Public fields

INSTANCE

Added in 1.0.0-alpha02
public static @NonNull Shell INSTANCE

Public methods

application

Added in 1.0.0-alpha02
public final @NonNull ApplicationCommands application(@NonNull String packageName)

Commands for application.

Parameters
@NonNull String packageName

the application package name

command

Added in 1.0.0-alpha02
public final @NonNull Shell.CommandOutput command(@NonNull String command)

Executes a given command and returns the ongoing CommandOutput.

Parameters
@NonNull String command

a string containing the command to launch.

Returns
@NonNull Shell.CommandOutput

a CommandOutput that allows to access the stream of the command output.

permission

Added in 1.0.0-alpha02
public final @NonNull PermissionCommands permission(@NonNull String packageName)

Commands for permissions.

Parameters
@NonNull String packageName

the application package name

Returns
@NonNull PermissionCommands

an instance of PermissionCommands.

process

Added in 1.0.0-alpha02
public final @NonNull ProcessCommands process()

Commands for processes.

Returns
@NonNull ProcessCommands

an instance of ProcessCommands.

recorder

Added in 1.0.0-alpha02
public final @NonNull RecorderCommands recorder()

Commands for screen recorder.

Returns
@NonNull RecorderCommands

an instance of RecorderCommands.

screen

Added in 1.0.0-alpha02
public final @NonNull ScreenCommands screen()

Commands for screen.

setShellServer

Added in 1.0.0-alpha02
public final void setShellServer(@NonNull ShellServer shellServer)

Allows configuring the underlying ShellProcess utilized to execute the commands. The current ShellServer backing Shell is always closed when setting a new one.

Parameters
@NonNull ShellServer shellServer

The new shell server to produce ShellProcess to launch commands.

wifi

Added in 1.0.0-alpha02
public final @NonNull WifiCommands wifi()

Commands for wifi.

Returns
@NonNull WifiCommands

an instance of WifiCommands.