I’m currently playing with Google’s new feature “all files access”. Going through Android settings and searching for “special app access”, then tapping on “all files access” and granting my test build this permission unfortunately does not allow SyncthingNative to write any single file to storage. Screenshots can be found in the references github issue.
I’ve also enabled STTRACE=fs model and was surprised SyncthingNative did not report anything like “failed to write file blabla, path is read-only”. It just shows 0/0 files synced and out of sync + revert. If I revert, the sendOnly side (PC) does show the override changes button. If I hit it on PC, the Android shows the revert button and so on.
I’m opening this topic to help preparing the compatibility with Android 11 enforced Scoped Storage feature and maintain file-write access by something still required to figure out.
If anyone reads this and has useful input or information to help me, please post. We still have a lot of time until Android 11 will hit - and hopefully - Google will make the all “files access” better during next betas.
Oh my bad, I did my patch of code so fast that it starts up on 11 I didn’t notice my sendreceive and later receiveonly folder setting got overwritten by some other piece of code. The problem here is, our current SAF implementation fails on 11 because getVolumePath is no longer available. I’ll try again later with disabled “sendonly auto decision code” and report back.
Wow, thanks a lot for that link. This is a 180deg turn on google side, lets hope it stays that way (I even think this would include external SD storage o.O):
Apps can access these files using either the MediaStore API or raw file paths. If your app uses the Storage Access Framework, you cannot use it to access the additional files and directories that the All Files Access permission makes available.
Not sure if this is of any help, but I found this information in the article “Small steps and a big leap - First pre-release of Android 11 and new features for pixel phones released” on page 42 of issue 07/2020 of the German computer magazine c’t:
“The Scoped Storage introduced with Android 10 has been improved in terms of security and privacy. The sandbox principle of the internal memory is extended to the shared memory or SD card: apps can no longer access any data there either. The API innovations suggest that for extended access, an app must first request the necessary authorization from the user.”
We know that, that’s the problem making Syncthing on android much less useful. However the above (Android 11 "All files access" for the Syncthing App) sounds like android 11 will bring a new special permission to access files outside of scope storage directly, which would be a life-safer.
Well when scoped storage was announced we expected it to no longer work on 10. Then Google made a last-minute decision to keep the opt-out of this feature alive in release builds of android 10 which saved us. Now they announced 11 with that feature enforced. It’s up to them if Syncthing will work or not on 11. Things today not working may change in future 11 preview’s.
Not yet, the manifest has still the opt-out by requirelegacystorage in place. Will try it when time :-). I hope if it works there is some compatibility because requiring requirelegacystorage in the manifest for 10 and not for 11 sounds ugly. My aim is to avoid having two apps targeting specific android versions.
Enabled Scoped Storage in the app manifest and followed Google’s advice to enable it via developer options, too. All files access has also been enabled and I’ve built the app upon R-rc.2 SDK and NDK r21.
Internal sdcard: I can create a new folder with Android UI when a new ST folder is added.
External sdcard: I CANNOT create a new folder with Android UI when a new ST folder is added. Icon “+” is greyed out.
If it stays like this, we just need to figure out how to make the wrapper right. It’s now upside down world because SyncthingNative can write to SDCARD and the wrapper can NOT.
Ok, there must be something wrong with the preview R-rc2 image of Android. When I use Android’s builtin file manager (without the ST app) and try to create a new folder on the external sdcard, it’s also greyed out.