本文整理汇总了Java中com.stericson.RootTools.execution.Shell.add方法的典型用法代码示例。如果您正苦于以下问题:Java Shell.add方法的具体用法?Java Shell.add怎么用?Java Shell.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.stericson.RootTools.execution.Shell
的用法示例。
在下文中一共展示了Shell.add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBamboo
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
private void initBamboo() {
try {
Shell shell = RootTools.getShell(true);
shell.useCWD(this);
JavaCommandCapture cmd = new JavaCommandCapture(
43,
false,
Garden.this,
"com.voilaweb.mobile.bamboogarden.RootHelper"
+ " init") {
};
shell.add(cmd);
}
catch(Exception e) {
e.printStackTrace();
}
}
示例2: createNewBamboo
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
private void createNewBamboo(final BambooInfo bamboo) {
try {
Shell shell = RootTools.getShell(true);
JavaCommandCapture cmd = new JavaCommandCapture(
43,
false,
Garden.this,
"com.voilaweb.mobile.bamboogarden.RootHelper"
+ " create "
+ bamboo.getName()) {
};
shell.add(cmd);
}
catch(Exception e) {
e.printStackTrace();
}
}
示例3: updateBambooColor
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
protected void updateBambooColor(BambooInfo bamboo, int color) {
try {
Shell shell = RootTools.getShell(true);
JavaCommandCapture cmd = new JavaCommandCapture(
43,
false,
Garden.this,
"com.voilaweb.mobile.bamboogarden.RootHelper"
+ " color "
+ bamboo.getName()
+ " " + color) {
@Override
public void commandCompleted(int id, int exitCode) {
super.commandCompleted(id, exitCode);
refreshBambooGarden();
}
};
shell.add(cmd);
}
catch(Exception e) {
e.printStackTrace();
}
}
示例4: deleteBamboo
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
private void deleteBamboo(final BambooInfo bamboo) {
if(bamboo != null) {
try {
Shell shell = RootTools.getShell(true);
JavaCommandCapture cmd = new JavaCommandCapture(
43,
false,
Garden.this,
"com.voilaweb.mobile.bamboogarden.RootHelper"
+ " delete "
+ bamboo.getName()) {
@Override
public void commandCompleted(int id, int exitCode) {
super.commandCompleted(id, exitCode);
refreshBambooGarden();
}
};
shell.add(cmd);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
示例5: unmount
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
public void unmount(Shell shell, final UnmountListener listener) throws IOException {
Command mountCommand = new CommandCapture(0, "umount " + getTarget()) {
@Override
public void commandCompleted(int id, int exitcode) {
super.commandCompleted(id, exitcode);
if (exitcode == 0) {
getDevice().removeMount(Mount.this);
listener.onUnmountSuccess(Mount.this);
} else {
listener.onUnmountError(Mount.this, null);
}
}
};
shell.add(mountCommand);
}
示例6: runCommand
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
private static CommandResult runCommand(String command) throws IOException, CommandException
{
final WaitCommand cmd = new WaitCommand(command);
final Shell shell = Shell.getOpenShell();
if (shell == null) throw new NullPointerException("Must start a shell before adding a command.");
shell.add(cmd);
final CommandResult result = cmd.waitForFinish();
CommandNotFoundException.throwIfNotFound(result);
if (result.terminated) throw new CommandException(result);
return result;
}
示例7: setSettingForce
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
public void setSettingForce(String path, String value) throws Exception {
Shell shell = RootTools.getShell(true);
CommandCapture command = new CommandCapture(0, "chmod 777 " + path);
shell.add(command);
commandWait(command);
try {
CommandCapture command2 = new CommandCapture(0, "echo " + value + " > " + path);
shell.add(command2);
commandWait(command2);
} catch (Exception e) {
}
}
示例8: setFilePermissions
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
protected int setFilePermissions(Shell shell, String permissions, String file) throws Exception{
if (shell == null) shell = RootTools.getShell(true);
CommandCapture command = new CommandCapture(0, "chmod " + permissions + " " + file);
shell.add(command);
commandWait(command);
return command.getExitCode();
}
示例9: execute
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
public boolean execute(@NonNull final Command command) {
final Shell shell = getShell();
if (shell == null) {
Log.w("ShellHolder", "No shell. Execution aborted.");
return false;
}
try {
shell.add(command);
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
示例10: switchToBook
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
private void switchToBook(final BambooInfo bamboo) {
if(bamboo != null) {
// Kill Bamboo so that it doesn't get
// all mixed up.
RootTools.killProcess("com.wacom.bamboopaper");
try {
Shell shell = RootTools.getShell(true);
JavaCommandCapture cmd = new JavaCommandCapture(
43,
false,
Garden.this,
"com.voilaweb.mobile.bamboogarden.RootHelper"
+ " switch "
+ bamboo.getName()) {
@Override
public void commandCompleted(int id, int exitCode) {
super.commandCompleted(id, exitCode);
runOnUiThread(new Runnable() {
@Override
public void run() {
maybeOpenBamboo();
}
});
refreshBambooGarden();
}
};
shell.add(cmd);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
示例11: runShellCommand
import com.stericson.RootTools.execution.Shell; //导入方法依赖的package包/类
/**
* Executes a given command with root access or without depending on the value of the boolean passed.
* This will also start a root shell or a standard shell without you having to open it specifically.
* <p/>
* You will still need to close the shell after you are done using the shell.
*
* @param shell The shell to execute the command on, this can be a root shell or a standard shell.
* @param command The command to execute in the shell
* @throws IOException
*/
public static void runShellCommand(Shell shell, Command command) throws IOException {
shell.add(command);
}