public class StatusBarShellCommand extends ShellCommand
Constructor and Description |
---|
StatusBarShellCommand(StatusBarManagerService service) |
Modifier and Type | Method and Description |
---|---|
int |
onCommand(String cmd)
Implement parsing and execution of a command.
|
void |
onHelp()
Implement this to print help text about your command to
ShellCommand.getOutPrintWriter() . |
exec, getBufferedInputStream, getErrPrintWriter, getNextArg, getNextArgRequired, getNextOption, getOutPrintWriter, getRawErrorStream, getRawInputStream, getRawOutputStream, handleDefaultCommands, init, peekNextArg
public StatusBarShellCommand(StatusBarManagerService service)
public int onCommand(String cmd)
ShellCommand
ShellCommand.handleDefaultCommands(String)
and return its result as a last resort.
User ShellCommand.getNextOption()
, ShellCommand.getNextArg()
, and ShellCommand.getNextArgRequired()
to process additional command line arguments. Command output can be written to
ShellCommand.getOutPrintWriter()
and errors to ShellCommand.getErrPrintWriter()
.
Note that no permission checking has been done before entering this function, so you need to be sure to do your own security verification for any commands you are executing. The easiest way to do this is to have the ShellCommand contain only a reference to your service's aidl interface, and do all of your command implementations on top of that -- that way you can rely entirely on your executing security code behind that interface.
onCommand
in class ShellCommand
cmd
- The first command line argument representing the name of the command to execute.public void onHelp()
ShellCommand
ShellCommand.getOutPrintWriter()
.onHelp
in class ShellCommand