code: public static FileDescriptor open(String path, int flags) throws FileNotFoundException {
          FileDescriptor fd = null;
          try {
              // On Android, we don't want default permissions to allow global access.
              int mode = ((flags & O_ACCMODE) == O_RDONLY) ? 0 : 0600;
              fd = Libcore.os.open(path, flags, mode);
              // Posix open(2) fails with EISDIR only if you ask for write permission.
              // Java disallows reading directories too.
              if (isDirectory(path)) {
                  throw new ErrnoException("open", EISDIR);
              }
              return fd;
          } catch (ErrnoException errnoException) {
              try {
                  if (fd != null) {
                      IoUtils.close(fd);
                  }
              } catch (IOException ignored) {
              }
              FileNotFoundException ex = new FileNotFoundException(path + ": " + errnoException.getMessage());
              ex.initCause(errnoException);
              throw ex;
          }
      }
docs: java.io only throws FileNotFoundException when opening files, regardless of what actually
  went wrong. Additionally, java.io is more restrictive than POSIX when it comes to opening
  directories: POSIX says read-only is okay, but java.io doesn't even allow that. We also
  have an Android-specific hack to alter the default permissions.