Skip to content

Show a clear error if the Network permission is revoked (GrapheneOS) #752

Closed

Description

@andiwand

🤖 Generated with Claude Code

A user on GrapheneOS (Pixel 6 Pro, Android 17, app 4.24.0) reports that no PDF opens anymore. The app shows only a generic error. The same files open on Linux and Windows.

Cause

The logcat that the user sent shows that the app cannot create any socket, not even on loopback:

E ODR : java.io.IOException: core server cannot bind 127.0.0.1:29665
Caused by: app.opendocument.core.OdrException: server bind failed: 127.0.0.1:29665
E ODR : java.io.IOException: core server cannot bind any port
E ODR : app.opendocument.core.OdrException: server is not bound
...
E chromium: [ERROR:net/socket/socket_posix.cc:121] CreatePlatformSocket() failed: Operation not permitted (1)
E ODR : java.lang.RuntimeException: loading http://localhost:29665/file/odr0/document.html failed: -1 net::ERR_ACCESS_DENIED

socket() returns EPERM. GrapheneOS does this when the user turns off the Network permission of an app, because it removes the inet group from the app. The core HTTP server and the WebView both need a loopback socket, so every document fails, not only PDFs.

This is the same failure as #411, where the F-Droid build had no INTERNET permission. Here the user revoked the permission at runtime.

Proposal

  1. If the core server cannot bind, show a specific message, for example: "Allow the Network permission. The app uses it only on this device, to show documents."
  2. Optionally, link to the settings page of the app from that message.
  3. Optionally, check for the failure before the user opens a file, so the user sees the message at start.

The app cannot tell EPERM from other bind failures today, because the core drops the errno. See the core follow-up below. Until then, a failed bind on both the fixed port and port 0 is a strong signal for a missing Network permission.

Related

  • Core: ServerBindFailed in src/odr/http_server.cpp does not keep the errno. A core change can expose it, so that the app can match EPERM exactly.
  • The log reports odrcore unknown version (fae77ff7…) [dirty] for the 4.24.0 release. The release build seems to come from a dirty tree without a version tag.

Activity

  1. andiwand commented on Nov 14, 2026

    @andiwand
    MemberAuthor

    should be fixed after #757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions