Exemplo n.º 1
0
  public boolean checkRoot() {
    boolean result = true;

    // No need to do more shell calls if we already did the checks
    if (CHECKED_ROOT && !ROOT_AVAILABLE)
      // We already checked root and it wasn't available
      return false;

    if (!ROOT_AVAILABLE) {
      if (!RootTools.isRootAvailable()) {
        // TODO: Make a new dialog class that explains root access
        RootTools.log("Root access isn't available");
        result = false;
      } else if (!RootTools.isAccessGiven()) {
        RootTools.log("Root access denied by user");
        result = false;
      } else {
        ROOT_AVAILABLE = true;
      }
    }

    CHECKED_ROOT = true;
    return result;
  }