Class RootShell


  • public class RootShell
    extends java.lang.Object
    Helper class for running commands as root.
    • Constructor Summary

      Constructors 
      Constructor Description
      RootShell​(android.content.Context context)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int run​(java.util.Collection<java.lang.String> output, java.lang.String command)
      Run a command in a root shell.
      void start()  
      void stop()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RootShell

        public RootShell​(android.content.Context context)
    • Method Detail

      • run

        public int run​(@Nullable
                       java.util.Collection<java.lang.String> output,
                       java.lang.String command)
                throws java.io.IOException,
                       RootShell.RootShellException
        Run a command in a root shell.
        Parameters:
        output - Lines read from stdout are appended to this list. Pass null if the output from the shell is not important.
        command - Command to run as root.
        Returns:
        The exit value of the command.
        Throws:
        java.io.IOException
        RootShell.RootShellException
      • stop

        public void stop()