←back to thread

410 points morsch | 3 comments | | HN request time: 0s | source
Show context
jeroenhd ◴[] No.43982964[source]
> SAF cannot be used, as it is for sharing/exposing our files to other apps

SAF can be used. There are reasons why this wouldn't be a good fit for NextCloud (you can't share your entire internal storage, your download folder, or the root of an SD card, for instance), but I don't think NextCloud's statement makes sense.

replies(3): >>43983014 #>>43983158 #>>43985264 #
jasonlotito ◴[] No.43985264[source]
Just to make sure: Google software has the same exact permission structure across the board? e.g. No Google product uses the same permissions NextCloud is seeking, and instead, they are using SAF? Especially for things that do what NextCloud is doing here.

I just want to be sure that Google is playing by the same rules they they put out for NextCloud and other app developers.

replies(3): >>43986860 #>>43987759 #>>43987858 #
tadfisher ◴[] No.43987858[source]
Open the Drive app, tap the "New" button, and select "Upload". You get a file picker UI. This UI is provided by the Storage Access Framework that Nextcloud says they cannot use.
replies(2): >>43988618 #>>43990217 #
Macha ◴[] No.43988618{3}[source]
This is not the same functionality that Nextcloud provides though. This is one time upload of manually selected files, not ongoing passive sync of an entire directory tree.
replies(2): >>43988745 #>>43989417 #
1. tadfisher ◴[] No.43988745{4}[source]
Ongoing sync is still possible through ACTION_OPEN_DOCUMENT_TREE [0], and using ContentResolver.takePersistableUriPermission [1] to maintain long-lived access to that directory. Enumerating files is slow but that is not a major concern when the use-case is a background sync, and you can drop down to ContentResolver APIs to reduce the number of IPC calls when enumerating.

[0]: https://developer.android.com/training/data-storage/shared/d...

[1]: https://developer.android.com/reference/android/content/Cont...

replies(1): >>43989806 #
2. apitman ◴[] No.43989806[source]
> Enumerating files is slow but that is not a major concern when the use-case is a background sync

Slow means it's probably burning a lot of CPU, and that is a problem for background tasks, especially on mobile.

replies(1): >>43990388 #
3. tadfisher ◴[] No.43990388[source]
No, the call is going through ContentProvider, which happens over Binder IPC, which entails context switching and other I/O overhead. Compared to local file operations (java.io and friends) this is massive; compared to anything else your device does, it's not a big deal at all, and it's not CPU-bound.