Esempio n. 1
0
 public static String runRoot(FTShell shell, boolean log) throws Exception {
   FTShell s = new FTShell("sysrun");
   s.save();
   push(s.getPath(), GlobalConfig.getProperty("deviceworkdir") + "/sysrun", false);
   s.clean();
   push(shell.getPath(), GlobalConfig.getProperty("deviceworkdir") + "/runscript", false);
   if (log) MyLogger.getLogger().info("Running " + shell.getName() + "  as root thru sysrun");
   else MyLogger.getLogger().debug("Running " + shell.getName() + "  as root thru sysrun");
   ProcessBuilderWrapper command;
   if (rootnative)
     command =
         new ProcessBuilderWrapper(
             new String[] {
               adbpath, "shell", "sh " + GlobalConfig.getProperty("deviceworkdir") + "/sysrun"
             },
             false);
   else
     command =
         new ProcessBuilderWrapper(
             new String[] {
               adbpath,
               "shell",
               "su -c 'sh " + GlobalConfig.getProperty("deviceworkdir") + "/sysrun'"
             },
             false);
   return command.getStdOut();
 }
Esempio n. 2
0
 public static String run(FTShell shell, boolean debug) throws Exception {
   push(shell.getPath(), GlobalConfig.getProperty("deviceworkdir") + "/" + shell.getName(), false);
   if (debug) MyLogger.getLogger().debug("Running " + shell.getName());
   else MyLogger.getLogger().info("Running " + shell.getName());
   ProcessBuilderWrapper command =
       new ProcessBuilderWrapper(
           new String[] {
             adbpath,
             "shell",
             "sh " + GlobalConfig.getProperty("deviceworkdir") + "/" + shell.getName() + ";exit $?"
           },
           false);
   if (command.getStdOut().contains("FTError"))
     throw new Exception(command.getStdErr() + " " + command.getStdOut());
   return command.getStdOut();
 }