Use Storage Access Framework for best privacy & compatibility

Android has a robust system for securely handling files that has been about since Android 4.4 known as the Storage Access Framework (SAF). For years few apps have used it well, but Android 10, 11 and 12 have been pushing app developers to use SAF with the introduction of scoped storage so an increasing number of apps are now using it.

If logseq implements a Document Provider (see the SAF link above) it would allow users to create graphs within the apps private storage where the files are not available to every other app with storage or ā€˜all filesā€™ permission. Sadly some apps wont work or lack functionality without this permission (as is the case currently with logseq - it would be good for privacy if this would change and there is no reason it can not) and effectively force the user to grant this permission leaking all their private files in the devices shared internal storage to the app.

The files in logseqs private storage would be presented in the system file manager (in most cases, a few androids dont do this) and be available in the system file and directory pickers that other apps can call. This allows users to grant other apps fine grained access to files or directories, allowing them to keep any files or directories they wish private. Its becoming increasingly common for apps to call these pickers when they need to access a file or directory due to Androids push of scoped storage.

When creating a graph in logseq the system directory picker is called. Currently (on Android 12) I can create a graph in the phones internal shared storage, but it fails if I try to create a graph in the private storage of an app that offers a Document Provider. I appreciate theres currently a bug with logseq where graph creation fails completely on some phones. Hopefully when this is fixed it will also be possible to create graphs inside apps that offer the a Document Provider. This will provide the possibility for extra privacy and security by using apps like EDS Lite or Anemo which offer encrypted storage and a Document Provider
You can see how Document Provider apps presented their storage in file/directory pickers in this image -

I didnā€™t know about Anemo, thanks for mentioning it.

I suppose that this would make it possible to pick a folder from the Nextcloud entry that would appear in that menu too, am I right?

Nextcloud act as a full document provider so if you have the app installed you see each Nextcloud account you have set up on the device in that menu.

Alternatively you can use the DAVxāµ app to connect to a Nextcloud accounts storage via webDAV (or to connect to any other type of file server offering webDAV connections) and see that listed in that menu.

The developer of Anemo has also made a nice, simple notes app (I think only available on their github) that works well with SAF - can open and save notes in the shared storage in the device, but also from any app that offers a documents provider

1 Like

I mean, with the proposed change to Logseq there will be any changes (pros & con) to how we use it with the following apps?

  • Nextcloud (has its folder and itā€™s a document provider)
  • Syncthing (itā€™s supposed to have access to all folders, like a third-party file manager)

Nextcloud has reasonable support for SAF
It is however not possible to sync files from another document provider app to Nextcloud so you couldnt sync data from Logseqs private storage if it was changed to act as a document provider.
If logseq supported creating graphs in a document provider you could create (or access) graphs in your nextcloud storage.

Syncthing doesnt really work within the SAF. It can only really work with files that are in shared storage.
There was some interest some years ago to start to support SAF using Syncthing Lite (as its a java app that would have been easier to do). But Syncthing Lite has been abandoned.
With Syncthing Fork it is possible to sync with the apps private storage (have to use the web UI to set this up), but there would need to be work on syncthing fork to set it up as a Document Provider so that users could let other apps access the synced data. If that was done and logseq was changed to support create or accessing document provider apps you could keep graphs there

1 Like

Thatā€™s exactly what I wanted to know, thank you!

1 Like

Ah, just filed this very related ticket:

Android app requests Manage All Files access, which allows Logseq to read/write/delete every file on the userā€™s filesystem. This is dangerous. A bug in this app could cause it to delete files and folders unrelated to Logseq.

Instead, it should use less permissive access like this to asked for access to restricted to folders.

1 Like

In my opinion this is a priority issue. Thanks for bringing it to the fore.

Added a request for this as well before seeing this one:

+1 for me on SAF support

any news on this? I think this would be an essential feature for using logseq on Android for many

2 Likes

Just dropped in here to keep this Discussion alive. I have seen a long thread about this issue on GitHub but it (at least) seems like this is not on the agenda? However this would make live much easier for people using Nextcloud or something similar.
Edit: nvm there is an active discussion going on over here with talks about building a solution.

2 Likes

Is there some alternate for SAF? SAF not supported in my android device. Any way figured out on how to get access of directories in shared storage?