MCPcopy Create free account
hub / github.com/Chainfire/libsuperuser / isSU

Method isSU

libsuperuser/src/eu/chainfire/libsuperuser/Shell.java:537–552  ·  view source on GitHub ↗

Attempts to deduce if the shell command refers to a su shell @param shell Shell command to run @return Shell command appears to be su

(String shell)

Source from the content-addressed store, hash-verified

535 * @return Shell command appears to be su
536 */
537 @AnyThread
538 public static boolean isSU(String shell) {
539 // Strip parameters
540 int pos = shell.indexOf(' ');
541 if (pos >= 0) {
542 shell = shell.substring(0, pos);
543 }
544
545 // Strip path
546 pos = shell.lastIndexOf('/');
547 if (pos >= 0) {
548 shell = shell.substring(pos + 1);
549 }
550
551 return shell.toLowerCase(Locale.ENGLISH).equals("su");
552 }
553
554 /**
555 * Constructs a shell command to start a su shell using the supplied uid

Callers 3

runMethod · 0.95
onCommandResultMethod · 0.80
cleanupMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected