Skip to content

Support Storage Access Framework and Media Store - #317

Open
madadam wants to merge 28 commits into
FossifyOrg:mainfrom
madadam:saf
Open

madadam wants to merge 28 commits into
FossifyOrg:mainfrom
madadam:saf

Conversation

@madadam

@madadam madadam commented Feb 5, 2026

Copy link
Copy Markdown

Type of change(s)

  • Bug fix
  • Feature / enhancement
  • Infrastructure / tooling (CI, build, deps, tests)
  • Documentation

What changed and why

This PR changes the way recordings are stored by using Storage Access Framework and Media Store. The native file/directory picker is now used so the user can chose any folder on their device, or any document provider exposed by other apps. By default, recordings are stored using Media Store to avoid forcing the user to manually pick the folder on the first app run.

Main motivations for this change:

  • Storage Access Framework and Media Store are the only way to access external files since Android SDK 30 but they are also supported on all previous version this app supports, so it seems natural to use them instead of using various hacks and workarounds.
  • Storage Access Framework allows to save files into document providers exposed by other apps which allows saving recordings into cloud storage or similar, in addition to saving them locally.
  • I'm one of the developers of Ouisync (a free, open source, peer-to-peer secure file syncing app) and Ouisync exposes a documents provider allowing other apps to save files directly into Ouisync repository and have them instantly synced with other devices and/or peers. We needed a demo app to showcase this feature. We decided to modify this apps because it is open source and generally useful. But apart from serving as a Ouisync demo, we believe this feature is useful for other people and so we decided to contribute it back.

Implementation notes:

The main change is the introduction of the RecordingStore class which implements an abstraction layer on top of Storage Access Framework and Media Store. This class exposes a unified interface so the rest of the app doesn't have to worry about how the files are actually stored. This class is currently tailor made for this app, but as a future work (if accepted) it can be generalized and extracted into the commons library, so other Fossify apps can also benefit from it.

Tests performed

Manually tested on all supported Android versions on the emulator. Also wrote comprehensive test suite for the RecordingStore class and made sure it passes on all supported Android versions (on the emulator).

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator (if applicable).
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • I understand every change in this pull request.

@madadam
madadam requested a review from naveensingh as a code owner February 5, 2026 11:16
Main reason is to be able to test `RecordingStore` against mock documents provider. Doing this in the app module was throwing `SecurityException`s due to permission issues for some reason.
longregen pushed a commit to longregen/Voice-Recorder that referenced this pull request Mar 7, 2026
…rk and Media Store

Review covers the architectural changes introducing RecordingStore abstraction
with SAF and MediaStore backends. Identifies 3 blocking issues (allDocuments
performance, hash collision risk in IDs, missing upgrade migration) and several
medium/low severity items.

https://claude.ai/code/session_01WYNJZAX7zFjRqHajnHvPBh
fhajji added a commit to fhajji/Voice-Recorder that referenced this pull request Oct 25, 2026
Imports upstream PR FossifyOrg#317 (Storage Access
Framework and MediaStore via RecordingStore). Conflicts resolved in
favour of main: keep Commons 7.1.3, and drop the feature-lock calls
(addLockedLabelIfNeeded, FeatureLockedDialog) that main has removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fhajji fhajji mentioned this pull request Oct 25, 2026
5 tasks done
@fhajji

fhajji commented Oct 25, 2026

Copy link
Copy Markdown

If someone is interested, I've fixed the merge issues and also made this PR more robust, in case the external drive gets ejected while the app is running, like e.g. properly closing the .m4a file with an index etc: #443 This PR got closed without review for some reason, but it does work.

@MassEast

Copy link
Copy Markdown

So, what's wrong here? Why was it closed? The Voice Recorder app should really have this^^

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

Labels

None yet

Projects

None yet

3 participants