Skip to content

[BUG] Error Loading PDF when activity is restored after being killed #219

@Ameya-Garg

Description

@Ameya-Garg

🚶 Steps to Reproduce
Launch the PDF viewer with a local file path:

PdfViewerActivity.Companion.launchPdfFromPath(
    context,
    pathValue,
    titleValue,
    saveTo.ASK_EVERYTIME,
    true,
    true,
    null,
    CacheStrategy.MAXIMIZE_PERFORMANCE
)
  • The PDF loads successfully.
  • Exit the activity (or the entire app).
  • Let Android kill the process while the activity is in the background.
  • Re-open the app and restore the previous activity.
  • Observe the “Error Loading PDF” screen.

🤔 Observed Behavior

  • The viewer shows an Error Loading PDF message.
  • The detailed error reads:
  • An unexpected error occurred: Invalid URL Scheme: ‘insert_filepath’. Expected HTTP or HTTPS.
  • The placeholder text insert_filepath is not displayed literally its shows the actual file path.

🎯 Expected Behavior

  • The PDF should re-open from the same file path after process restoration.

📱 Device & Environment

  • Any android device tested from android 14/15/16

💻 Code Snippet

  • java
startActivity(
    PdfViewerActivity.Companion.launchPdfFromPath(
        context,
        pathValue,
        titleValue,
        saveTo.ASK_EVERYTIME,
        true,
        true,
        null,
        CacheStrategy.MAXIMIZE_PERFORMANCE
    )
);

📝 Additional Context
The issue only occurs when the activity is restored after Android kills the process.

A fresh launch of the activity always succeeds.

Possible root cause: the viewer’s state restoration logic treats the file path as a URL and fails to re-hydrate it correctly.

Any guidance on handling local file schemes during state restoration would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions