DocumentsProvider does not expose thumbnails for PDF and video files in Android SAF file picker.
- Dominant language
- Kotlin
- Stars
- 5.6k
- Forks
- 2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 92
Description
### ⚠️ Before posting ⚠️
- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### Steps to reproduce
1. Configure a Nextcloud account in the Nextcloud Android app;
2. Have JPEG, PDF and MP4 files stored in Nextcloud;
3. From another Android application, open the Android system file picker using the Storage Access Framework;
4. Select Nextcloud as the document provider;
5. Navigate to a folder containing these file types;
6. Observe that JPEG files can display thumbnails, while PDF and MP4 files are shown only with generic file-type icons;
7. Open the same files directly in the Nextcloud Android app and observe that previews are available there.
### Expected behaviour
PDF and video files should expose thumbnail support through the Nextcloud Android DocumentsProvider when a preview is available or can be generated, allowing Android's system file picker to display thumbnails in the same way it does for image files.
### Actual behaviour
When Nextcloud is accessed through Android's system file picker, JPEG files can display thumbnails, but PDF and MP4 files are shown only with generic file-type icons.
The same PDF and MP4 files display previews correctly when viewed directly inside the Nextcloud Android app.
I also reproduced the behavior while monitoring the Nextcloud DocumentsProvider with ADB. openDocumentThumbnail() is called for JPEG files, but no corresponding thumbnail requests are observed for PDF or MP4 files.
This suggests that thumbnail support is not being exposed to Android SAF for these file types.
### Android version
16
### Device brand and model
Samsung Galaxy S24 FE
### Stock or custom OS?
Stock
### Nextcloud android app version
34.1.0
### Nextcloud server version
33.0.5
### Using a reverse proxy?
I don't know
### Android logs
ADB investigation:
For JPEG files, Android requests thumbnails from the Nextcloud DocumentsProvider:
DocumentsStorageProvider: openDocumentThumbnail(), id=
The provider then attempts to access a cached JPEG thumbnail:
DiskLruImageCacheFileProvider: Error opening file:
/data/user/0/com.nextcloud.client/cache/.jpg
When folders containing PDF and MP4 files are displayed, no corresponding
openDocumentThumbnail() calls are observed for those files.
All account names, server addresses, filenames and document IDs have been
redacted.
### Server error logs
```bash
```
### Additional information
The same PDF and MP4 files have working previews inside the Nextcloud Android app. The issue appears only when Nextcloud is accessed as a document provider through Android's Storage Access Framework.
ADB testing showed that openDocumentThumbnail() is requested for JPEG files, while no equivalent request is made for PDF or MP4 files.
This may indicate that thumbnail capability is not being advertised to Android for PDF and video document types.
Possibly related, but not identical:
#1827 — Thumbnails don't show when NC used as a document provider
#14863 — Incorrect Default Thumbnail for PDF Files
No full logs are attached because they contain account names, server addresses, filenames and document identifiers. Relevant log excerpts were manually redacted above.
Contributor guide
Research direction
Start at the Android DocumentsProvider implementation, especially the openDocumentThumbnail() entry point and how PDF and MP4 MIME types are handled. Reproduce the issue through Android's Storage Access Framework and compare the provider's behavior for JPEG, PDF, and video files; done means eligible PDF and video files request and expose thumbnails when previews are available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100