-
@RestrictTo(value = RestrictTo.Scope.LIBRARY) public final class BuilderImpl extends Shell.Builder
-
-
Method Summary
Modifier and Type Method Description Shell.BuildersetTimeout(long t)Set the maximum time to wait for shell verification. Shell.BuildersetFlags(int f)Set flags to control how a new {@code Shell}will be constructed.Shell.BuildersetCommands(Array<String> c)Set the commands that will be used to create a new {@code Shell}.voidsetInitializersImpl(Array<Class<out Shell.Initializer>> clz)ShellImplbuild(Process process)Combine all of the options that have been set and build a new {@code Shell}instancewith the provided process.ShellImplbuild()Combine all of the options that have been set and build a new {@code Shell}instance.-
-
Method Detail
-
setTimeout
@NonNull() Shell.Builder setTimeout(long t)
Set the maximum time to wait for shell verification.
After the timeout occurs and the shell still has no response,the shell process will be force-closed and throw NoShellException.
-
setFlags
@NonNull() Shell.Builder setFlags(int f)
Set flags to control how a new
{@code Shell}will be constructed.
-
setCommands
@NonNull() Shell.Builder setCommands(Array<String> c)
Set the commands that will be used to create a new
{@code Shell}.
-
setInitializersImpl
void setInitializersImpl(Array<Class<out Shell.Initializer>> clz)
-
build
@NonNull() ShellImpl build(Process process)
Combine all of the options that have been set and build a new
{@code Shell}instancewith the provided process.- Parameters:
process- a shell Process that has already been created.
-
build
@NonNull() ShellImpl build()
Combine all of the options that have been set and build a new
{@code Shell}instance.If not setCommands, there are 3 methods to construct a Unix shell;if any method fails, it will fallback to the next method:
- If FLAG_NON_ROOT_SHELL is not set and FLAG_MOUNT_MASTER is set, construct a Unix shell by calling
{@code su --mount-master}.It may fail if the root implementation does not support mount master. - If FLAG_NON_ROOT_SHELL is not set, construct a Unix shell by calling
{@code su}. It may fail if the device is not rooted, or root permission isnot granted. - Construct a Unix shell by calling
{@code sh}. This would never fail in normalconditions, but should it fail, it will throw NoShellException
{@code Shell}with getStatus since it may be constructed with calling{@code sh}.If setCommands is called, the provided commands will be used tocreate a new Process directly. If the process fails to create, or the processis not a valid shell, it will throw NoShellException.
- If FLAG_NON_ROOT_SHELL is not set and FLAG_MOUNT_MASTER is set, construct a Unix shell by calling
-
-
-
-