public String sendCommand(String commandString) { String result = ""; if (checkRoot()) { CommandCapture command = new CommandCapture(0, commandString); try { RootTools.getShell(true).add(command).waitForFinish(); result = command.toString(); LAST_COMMAND_OUTPUT = result; LAST_EXIT_CODE = command.exitCode(); } catch (InterruptedException e) { // TODO: Do something useful with the exceptions // e.printStackTrace(); } catch (IOException e) { // e.printStackTrace(); } catch (TimeoutException e) { // e.printStackTrace(); } catch (RootDeniedException e) { // e.printStackTrace(); } } return result; }
@Override public void commandTerminated(int id, String reason) { super.commandTerminated(id, reason); ACRA.getErrorReporter().handleSilentException(new Exception(reason)); }