Catfriend1 / syncthing-android

Syncthing-Fork - A Syncthing Wrapper for Android.
Mozilla Public License 2.0
1.13k stars 40 forks source link

All files access switch greyed out when trying to grant files permissions #704

Closed theredbaron05 closed 3 years ago

theredbaron05 commented 3 years ago

EDIT BY CATFRIEND1; TL;DR: To everyone reading this issue. You are advised to switch to the GitHub release (APK can be downloaded from here) or the F-Droid release to get the full features of the Syncthing-Fork app without G's restrictions.

If you're stuck on the welcome assistant because of Android restrictions, please read https://github.com/Catfriend1/syncthing-android/pull/747 and use the emergency config export button to export your existing Syncthing config to "/storage/emulated/0/Android/media/com.github.catfriend1.syncthingandroid[.debug]/" for migration to another release channel of the app.

======== ORIGINAL POST ==============

Description of the issue

all files access switch greyed out when trying to grant files permissions

Reproducer

open a fresh install of syncthing fork and try to grant files permissions

Version Information

App Version: 1.9.0.2
Syncthing Version: v1.9.0
Android Version: Android 11 full release
Device manufacturer: Google
Device model: Pixel 2 G011A
``` ### Device platform info [ro.product.board]: [walleye] [ro.product.brand]: [google] [ro.product.build.date]: [Wed Jul 29 23:26:21 UTC 2020] [ro.product.build.date.utc]: [1596065181] [ro.product.build.fingerprint]: [google/walleye/walleye:11/RP1A.200720.009/6720564:user/release-keys] [ro.product.build.id]: [RP1A.200720.009] [ro.product.build.tags]: [release-keys] [ro.product.build.type]: [user] [ro.product.build.version.incremental]: [6720564] [ro.product.build.version.release]: [11] [ro.product.build.version.release_or_codename]: [11] [ro.product.build.version.sdk]: [30] [ro.product.cpu.abi]: [arm64-v8a] [ro.product.cpu.abilist]: [arm64-v8a,armeabi-v7a,armeabi] [ro.product.cpu.abilist32]: [armeabi-v7a,armeabi] [ro.product.cpu.abilist64]: [arm64-v8a] [ro.product.device]: [walleye] [ro.product.first_api_level]: [26] [ro.product.locale]: [en-US] [ro.product.manufacturer]: [Google] [ro.product.model]: [Pixel 2] [ro.product.name]: [walleye] [ro.product.odm.brand]: [google] [ro.product.odm.device]: [walleye] [ro.product.odm.manufacturer]: [Google] [ro.product.odm.model]: [Pixel 2] [ro.product.odm.name]: [walleye] [ro.product.product.brand]: [google] [ro.product.product.device]: [walleye] [ro.product.product.manufacturer]: [Google] [ro.product.product.model]: [Pixel 2] [ro.product.product.name]: [walleye] [ro.product.system.brand]: [google] [ro.product.system.device]: [walleye] [ro.product.system.manufacturer]: [Google] [ro.product.system.model]: [Pixel 2] [ro.product.system.name]: [walleye] [ro.product.system_ext.brand]: [google] [ro.product.system_ext.device]: [walleye] [ro.product.system_ext.manufacturer]: [Google] [ro.product.system_ext.model]: [Pixel 2] [ro.product.system_ext.name]: [walleye] [ro.product.vendor.brand]: [google] [ro.product.vendor.device]: [walleye] [ro.product.vendor.manufacturer]: [Google] [ro.product.vendor.model]: [Pixel 2] [ro.product.vendor.name]: [walleye] ``` ### Android Log [android log.txt](https://github.com/Catfriend1/syncthing-android/files/5190810/android.log.txt) ![image](https://user-images.githubusercontent.com/70977962/92521708-979b6500-f215-11ea-8456-14eb2e90de4e.png)
Catfriend1 commented 3 years ago

TL;dr Dear Android 11 user!

If you are experiencing trouble please upgrade to: https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.3/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.3_304261d3.apk


Hi,

Which release channel did you get it from? https://github.com/Catfriend1/syncthing-android/wiki/Switch-between-releases_Verify-APK-is-genuine

theredbaron05 commented 3 years ago

I got it from the Google Play Store

Catfriend1 commented 3 years ago

Google Play - at the moment - disallows this feature (all files access) to be used according to their docs. You'll need to download the fdroid or github release apk ( https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.2/com.github.catfriend1.syncthingandroid_v1.9.0.2_7249908a.apk ). It's of course not convenient like this but also not my fault. Alternative app stores or download places may not be referenced on gplay because of theoretical security risks.

From my view of things we can say "Android 11 is not a supported platform to run Syncthing at the moment" but installing a debug version could help you here because it uses the new all files access feature to begin early tests and verify what will work in the future of 11.

Again, I'm very sorry that Google released an OS version 11 without making all features accessible it contains whilst there is no other way to get SyncthingNative working with appropriate storage access.

Source : https://support.google.com/googleplay/android-developer/answer/9956427

To switch between releases: https://github.com/Catfriend1/syncthing-android/wiki/Switch-between-releases_Verify-APK-is-genuine

rhamzeh commented 3 years ago

@Catfriend1, would it be possible to fix the export/import feature on Android 11, so that we can switch releases without losing data?

I empathize with how completely unnecessary this feels. Thanks for taking the time to make work in any capacity on 11 (and before) despite Google's best efforts to break it.

Also maybe it would be a good idea to add a warning on the README as a heads up for other people not to upgrade?

Catfriend1 commented 3 years ago

@rhamzeh Yes, I currently have little time for this but I'll try to find a window where I can make an "emergency export" possible on the welcome assistant somehow. It's indeed only required during the "transition time" until Google allows uploading of the "real" APK.

rhamzeh commented 3 years ago

Oh I don't think that's needed. The app works normally if you open it from the notifications, and it does sync, though I believe, the folders have become read only so it's a one way sync.

So the export menu can be accessed, but when you press the export button, that's when it fails because I think the directory it's writing the export to is also read only.

I added a few logs and screenshots below. I hope that helps.

It starts with this repeated many times ``` 09-09 07:28:23.769 10068 30638 D Util : runShellCommandGetOutput: ps 09-09 07:28:23.786 10068 30638 I Util : runShellCommandGetOutput: Exited with code 0 ``` Then ``` 09-09 07:28:23.819 10068 26094 I SyncthingNativeCode: [G6XDM] WARNING: Database failed to stop within 10s 09-09 07:28:23.819 10068 26094 I SyncthingNativeCode: [G6XDM] INFO: Exiting 09-09 07:28:23.838 10068 30638 D Util : runShellCommandGetOutput: ps 09-09 07:28:23.854 10068 30638 I Util : runShellCommandGetOutput: Exited with code 0 09-09 07:28:23.854 10068 30638 D SyncthingRunnable: killSyncthing: Complete. 09-09 07:28:24.014 10068 26090 I SyncthingRunnable: Syncthing was shut down normally via API or SIGKILL. Exit code = 0 09-09 07:28:24.014 10068 30638 D SyncthingService: Finished mSyncthingRunnableThread. 09-09 07:28:24.020 3676 28756 E MediaProvider: Creating a non-default top level directory or deleting an existing one is not allowed! 09-09 07:28:24.020 3676 28753 E MediaProvider: Creating a non-default top level directory or deleting an existing one is not allowed! 09-09 07:28:24.025 10068 30638 W SyncthingService: Failed to export config 09-09 07:28:24.025 10068 30638 W SyncthingService: java.io.FileNotFoundException: /storage/emulated/0/backups/syncthing/config.xml: open failed: ENOENT (No such file or directory) 09-09 07:28:24.025 10068 30638 W SyncthingService: at libcore.io.IoBridge.open(IoBridge.java:492) 09-09 07:28:24.025 10068 30638 W SyncthingService: at java.io.FileOutputStream.(FileOutputStream.java:236) 09-09 07:28:24.025 10068 30638 W SyncthingService: at com.google.common.io.Files$FileByteSink.openStream(Files.java:193) 09-09 07:28:24.025 10068 30638 W SyncthingService: at com.google.common.io.Files$FileByteSink.openStream(Files.java:181) 09-09 07:28:24.025 10068 30638 W SyncthingService: at com.google.common.io.ByteSource.copyTo(ByteSource.java:265) 09-09 07:28:24.025 10068 30638 W SyncthingService: at com.google.common.io.Files.copy(Files.java:326) 09-09 07:28:24.025 10068 30638 W SyncthingService: at com.nutomic.syncthingandroid.service.SyncthingService.exportConfig(SyncthingService.java:859) 09-09 07:28:24.025 10068 30638 W SyncthingService: at com.nutomic.syncthingandroid.activities.SettingsActivity$SettingsFragment$ExportConfigTask.doInBackground(SettingsActivity.java:1019) 09-09 07:28:24.025 10068 30638 W SyncthingService: at com.nutomic.syncthingandroid.activities.SettingsActivity$SettingsFragment$ExportConfigTask.doInBackground(SettingsActivity.java:1002) 09-09 07:28:24.025 10068 30638 W SyncthingService: at android.os.AsyncTask$3.call(AsyncTask.java:394) 09-09 07:28:24.025 10068 30638 W SyncthingService: at java.util.concurrent.FutureTask.run(FutureTask.java:266) 09-09 07:28:24.025 10068 30638 W SyncthingService: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 09-09 07:28:24.025 10068 30638 W SyncthingService: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 09-09 07:28:24.025 10068 30638 W SyncthingService: at java.lang.Thread.run(Thread.java:923) 09-09 07:28:24.025 10068 30638 W SyncthingService: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) 09-09 07:28:24.025 10068 30638 W SyncthingService: at libcore.io.Linux.open(Native Method) 09-09 07:28:24.025 10068 30638 W SyncthingService: at libcore.io.ForwardingOs.open(ForwardingOs.java:166) 09-09 07:28:24.025 10068 30638 W SyncthingService: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254) 09-09 07:28:24.025 10068 30638 W SyncthingService: at libcore.io.ForwardingOs.open(ForwardingOs.java:166) 09-09 07:28:24.025 10068 30638 W SyncthingService: at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542) 09-09 07:28:24.025 10068 30638 W SyncthingService: at libcore.io.IoBridge.open(IoBridge.java:478) 09-09 07:28:24.025 10068 30638 W SyncthingService: ... 13 more 09-09 07:28:24.026 10068 30638 E SyncthingService: exportConfig: Failed to export SharedPreferences #1 09-09 07:28:24.026 10068 30638 E SyncthingService: java.io.FileNotFoundException: /storage/emulated/0/backups/syncthing/sharedpreferences.dat: open failed: ENOENT (No such file or directory) 09-09 07:28:24.026 10068 30638 E SyncthingService: at libcore.io.IoBridge.open(IoBridge.java:492) 09-09 07:28:24.026 10068 30638 E SyncthingService: at java.io.FileOutputStream.(FileOutputStream.java:236) 09-09 07:28:24.026 10068 30638 E SyncthingService: at java.io.FileOutputStream.(FileOutputStream.java:186) 09-09 07:28:24.026 10068 30638 E SyncthingService: at com.nutomic.syncthingandroid.service.SyncthingService.exportConfig(SyncthingService.java:876) 09-09 07:28:24.026 10068 30638 E SyncthingService: at com.nutomic.syncthingandroid.activities.SettingsActivity$SettingsFragment$ExportConfigTask.doInBackground(SettingsActivity.java:1019) 09-09 07:28:24.026 10068 30638 E SyncthingService: at com.nutomic.syncthingandroid.activities.SettingsActivity$SettingsFragment$ExportConfigTask.doInBackground(SettingsActivity.java:1002) 09-09 07:28:24.026 10068 30638 E SyncthingService: at android.os.AsyncTask$3.call(AsyncTask.java:394) 09-09 07:28:24.026 10068 30638 E SyncthingService: at java.util.concurrent.FutureTask.run(FutureTask.java:266) 09-09 07:28:24.026 10068 30638 E SyncthingService: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 09-09 07:28:24.026 10068 30638 E SyncthingService: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 09-09 07:28:24.026 10068 30638 E SyncthingService: at java.lang.Thread.run(Thread.java:923) 09-09 07:28:24.026 10068 30638 E SyncthingService: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) 09-09 07:28:24.026 10068 30638 E SyncthingService: at libcore.io.Linux.open(Native Method) 09-09 07:28:24.026 10068 30638 E SyncthingService: at libcore.io.ForwardingOs.open(ForwardingOs.java:166) 09-09 07:28:24.026 10068 30638 E SyncthingService: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254) 09-09 07:28:24.026 10068 30638 E SyncthingService: at libcore.io.ForwardingOs.open(ForwardingOs.java:166) 09-09 07:28:24.026 10068 30638 E SyncthingService: at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542) 09-09 07:28:24.026 10068 30638 E SyncthingService: at libcore.io.IoBridge.open(IoBridge.java:478) 09-09 07:28:24.026 10068 30638 E SyncthingService: ... 10 more 09-09 07:28:24.026 10068 30638 D SyncthingService: exportConfig: Exporting index database ``` then a bunch of ``` 09-09 07:28:24.028 10068 30638 E SyncthingService: Failed to copy file '/data/user/0/com.github.catfriend1.syncthingandroid/files/index-v0.14.0.db' to '/storage/emulated/0/backups/syncthing/index-v0.14.0.db' ``` for several ldb files and finally, ``` 09-09 07:28:24.094 10068 30638 D SyncthingService: exportConfig END ``` I then manually created the `backups/syncthing` directory and retried the export, and the logs were mostly the same, except for a few new error logs like this ``` 09-09 07:37:41.976 3676 29505 W MediaProvider: Forgot to handle a top level directory in getContentUriForFile? 09-09 07:37:41.980 3676 29505 E MediaProvider: insertFileIfNecessary failed 09-09 07:37:41.980 3676 29505 E MediaProvider: java.lang.IllegalArgumentException: Primary directory backups not allowed for content://media/external_primary/file; allowed directories are [Download, Documents] 09-09 07:37:41.980 3676 29505 E MediaProvider: at com.android.providers.media.MediaProvider.ensureFileColumns(MediaProvider.java:2672) 09-09 07:37:41.980 3676 29505 E MediaProvider: at com.android.providers.media.MediaProvider.ensureUniqueFileColumns(MediaProvider.java:2337) 09-09 07:37:41.980 3676 29505 E MediaProvider: at com.android.providers.media.MediaProvider.insertFile(MediaProvider.java:2947) 09-09 07:37:41.980 3676 29505 E MediaProvider: at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:3470) 09-09 07:37:41.980 3676 29505 E MediaProvider: at com.android.providers.media.MediaProvider.insert(MediaProvider.java:3198) 09-09 07:37:41.980 3676 29505 E MediaProvider: at com.android.providers.media.MediaProvider.insertFileForFuse(MediaProvider.java:6625) 09-09 07:37:41.980 3676 29505 E MediaProvider: at com.android.providers.media.MediaProvider.insertFileIfNecessaryForFuse(MediaProvider.java:6708) 09-09 07:37:41.981 10068 30638 E SyncthingService: Failed to copy file '/data/user/0/com.github.catfriend1.syncthingandroid/files/index-v0.14.0.db/013929.ldb' to '/storage/emulated/0/backups/syncthing/index-v0.14.0.db' ``` ![Screenshot_20200909-072448](https://user-images.githubusercontent.com/536147/92594893-82ecba80-f271-11ea-9056-17b8afe0c784.png) ![Screenshot_20200909-072825](https://user-images.githubusercontent.com/536147/92594889-81bb8d80-f271-11ea-94d0-f8a897ec50ee.png)
Catfriend1 commented 3 years ago

@rhamzeh wow , many thanks for filling this thread up with useful debug info and pictures. :-) That's definitely a motivation to try during the next dev session if I can solve or improve on the issue. But no promise, because I'm stuck on Android 10 with my private phone (mi8). So only the emulator is there to work on this :-/

Catfriend1 commented 3 years ago

Just a quick follow up: The line

runShellCommandGetOutput: Exited with code 0

doesn't point to a problem. It just tells that the shell wrapping succeeded on the device as "0" indicates NO_ERROR.

whs commented 3 years ago

Upgraded to Android 11 yesterday and lost my Keepass files! I believe as Syncthing cannot read the files, it broadcasted to other devices that they were deleted.

Luckily, the same fault resulting in Syncthing unable to delete the file from the phone, so I just have to manually copy the files back to other devices.

I wish the sync would fail in this case instead of destructively removing it.

Catfriend1 commented 3 years ago

@whs I doubt Syncthing would do this because the folder marker needs to be there and readable from SyncthingNative's view before the sync operation on a folder would start. That's upstream's protection against the data loss scenario you've described. If this really failed, you should tell the core dev team about it raising a ticket there.

Furthermore independent from this: the fork wrapper has a second protection that it won't start the native if storage read access is reported as denied by Android.

whs commented 3 years ago

I've raised https://github.com/syncthing/syncthing/issues/6984 at upstream, and they points to the forked application.

turmoni commented 3 years ago

Not knowing exactly where to put this (new issue, forum post?), I've also had the data loss issue, which moderately terrified me until I verified I still had copies.

Catfriend1 commented 3 years ago

Should we remove the gplay version of the app? Because of google not allowing the app to ask for the required permission before January 2021 we can't help anyone with this google induced issue. We would then still be publishing the fork via F-Droid and GitHub releases.

Catfriend1 commented 3 years ago

Todo:

Catfriend1 commented 3 years ago

We could try this: "preserveLegacyExternalStorage=true"

But I'm not sure if it's too late for devices that already got the upgrade. I'll try to build a 1.9.0.3 containing the additional flag. It's really a problem here I don't have a real device to test hands-on. Because I cannot upgrade the Android virtual device from 10 to 11 with the app previously installed to investigate what happens on your devices ... :-(

Sources:

Catfriend1 commented 3 years ago

commit # https://github.com/Catfriend1/syncthing-android/commit/6cf0ec6b27094cbdd3c79ab7ba2b5a9bddb84217

Catfriend1 commented 3 years ago

@whs @turmoni I've taken a second closer look at the code and I'm sorry I still have no clue why you had that data loss and others didn't.

In https://github.com/Catfriend1/syncthing-android/blob/6cf0ec6b27094cbdd3c79ab7ba2b5a9bddb84217/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java#L242 , there is an additional check in place already since a long time ago which blocks starting SyncthingNative if write access permissions are missing. Plus, the FirstStartActivity (you'd better know it as the welcome assistant) executes on every app start and checks if the file write permission is in place correctly. On Android 11 it has been extended to also check for all files access permission to be granted.

All in all, you've got three protections against data loss: SyncthingNative's built-in .stfolder checks, the SyncthingService.java write permission check and the welcome assistant checks. I don't want to argue your data loss isn't real, but would be really interested if you could backup your data and try to reproduce the loss then capturing some "adb logcat v" logs for us to investigate.

Catfriend1 commented 3 years ago

@whs @turmoni I need your help again on a second topic. I've implemented the preserveLegacyExternalStorage flag and don't know if this also helps against encountering problems after you've already had one. If you did NOT uninstall and reinstall the app since upgrading to Android 11, the following test would shed some light: Could you please upgrade to this APK ( https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.3/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.3_304261d3.apk ) and let me know if syncing "read/write" works again?

@rhamzeh @theredbaron05 What happens for you, if you upgrade to this APK ( https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.3/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.3_304261d3.apk ). Does Android accept this APK as an upgrade to the originally GPlay distributed bundle? Does it revive "read/write" access and syncing for you so can open the app the normal way by clicking its icon on the launcher screen again?

Catfriend1 commented 3 years ago

Btw, is any F-Droid user reading this? Especially anyone that has a problem with the recent Android 11 releases starting with APK version 1.8.0.x? I guess they rock, because they don't implement the same restrictions the G Play Store has.

whs commented 3 years ago

Thanks for looking at the issue so fast.

I've since uninstalled the Play version and tried to install from F-Droid. It seems that the APK on F-Droid (which is still 1.8 btw) returns invalid APK error on my Pixel 3a. I tried installing the same APK from 1) Aurora client 2) Firefox 3) Files by google

Catfriend1 commented 3 years ago

@whs I've put a new release 1.9.0.3 with all files permission manifest into the fdroid build queue. This will take some time until they get to it but it's on its way.

Could you grab a logcat of the invalid apk error occuring? I hope the android logs contain a hint why it is considered invalid.

turmoni commented 3 years ago

I've not done anything to my installation so far, so I can test the APK, but before I do anything I want to make sure I know what I'm looking for - should this APK have the right permissions and so theoretically work whilst also keeping my existing settings? Or am I looking for something else

Catfriend1 commented 3 years ago

@turmoni Yes, the APK https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.3/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.3_304261d3.apk is intended to upgrade your installation to 1.9.0-stable (which is the same as the previous upstream commit 1.9.0-rc.5 from code perspective) and I'd be interested if the preserveLegacyExternalStorage=true that has been added solves your problem. If you did NOT clear app storage or cache via android settings, your settings should still be there.

turmoni commented 3 years ago

Yup, updating to that APK allows me to grant permission and get everything back to working without any reconfiguration needed, thanks!

Catfriend1 commented 3 years ago

@turmoni yes, thats the pity we have because you have one line of code more in it than the gplay store has in its bundle which fixes access. As soon as I put this line in google blocks upload to the store with 403 :-/. Well let's see if the preserve... flag can help other users on gplay as this is allowed by now already. Google's btw also nice : they state in the gplay console "release 1.9.0.3 is being reviewed, will take approx 7days or longer".

The line in question is MANAGE_EXTERNAL_STORAGE to be precise.

rhamzeh commented 3 years ago

Does Android accept this APK as an upgrade to the originally GPlay distributed bundle? Does it revive "read/write" access and syncing for you so can open the app the normal way by clicking its icon on the launcher screen again?

@Catfriend1 apologies for the late reply!

I tried this build and it upgraded fine. It allowed me to properly grant the all file access, and everything seems to be working fine right now.

Thank you for taking the time to figure this out and providing a workaround. It's much appreciated.

It allowed my to export my keys, and I will be switching to the F-Droid version as soon as I can.

Let me know if there's any more feedback or logs you need, or anything I need to watch out for in particular.

rhamzeh commented 3 years ago

I've since uninstalled the Play version and tried to install from F-Droid. It seems that the APK on F-Droid (which is still 1.8 btw) returns invalid APK error on my Pixel 3a. I tried installing the same APK from 1) Aurora client 2) Firefox 3) Files by google

@Catfriend1 @whs I don't believe this is from your end, but because of F-Droid not properly handling the new apk signing requirements enforced by Android 11 (don't quote me on this, this is a quick summary of what I understood, but I could be way of the mark)

Here's the relevant issue tracking the changes Sign apks with apksig v2/v3

It seemed like they merged the fix, but I'm not sure if it is deployed yet, and whether it is retroactive or only newer builds coming after the deployment will have the proper v2 signature.

Some other apps are affected, like NetGaurd and ShadowSocks FOSS are similarly affected.

The author of NetGuard in particular is understandably frustrated

rhamzeh commented 3 years ago

I've taken a second closer look at the code and I'm sorry I still have no clue why you had that data loss and others didn't.

@Catfriend1 I'm so sorry, because I didn't notice this before, but apparently one of my synced folders was wiped out (I have versioning enabled, so recovering them was a simple task) What is surprising is why one folder only was wiped out and the rest didn't, as my folder structure is fairly similar /emulated/0/Documents/synced/folder1 <- was wiped /emulated/0/Documents/synced/folder2 <- was working /emulated/0/Documents/synced/folder3 <- was working

also, as send only folders /emulated/0/Signal <- was wiped /emulated/0/WhatsApp <- kept syncing properly

(These were on the older Google Play build, they're all working fine now on the build linked above)

rhamzeh commented 3 years ago

...

  • Get back on google play in January 2021

I'm not sure how hard this will be to a) implement and b) maintain, and I know it will have side-effects for people who upgrade from version 10 to 11 and suddenly lose access to syncthing, but as only a suggestion for you to consider: Instead of unpublishing from the Play Store, set maxSdkVersion to be version less than 30, that way users of older Android versions will still be able to use the app, and get your updates, while those on version 11 would not be able to install it until Jan 2021 (if Google manages to make it happen by that time)

Catfriend1 commented 3 years ago

@rhamzeh thanks for the useful insights and suggestions! :-)

We could at least try to set maxSdkVersion 29 and see if gplay store accepts the apk. But somehow I guess they will say "dear dev, your sdk level is already 30, you should do that"

JLJTGR commented 3 years ago

About the data loss issue... I had it happen to me as well. It was fairly strange as it wasn't a complete wipe... but 90% of files and some folders? My only plausible guess is that Android wasn't blocking the existence of the .stfolder or perhaps any folders, but it was blocking files. So Syncthing could see folders, but no files... so it thought the files were deleted. My Camera sync was mostly okay because I think Android allows media file access...

Catfriend1 commented 3 years ago

@JLJTGR Good observation! Unfortunately I doubt the core Syncthing team will make an extra protection based on checking for files as they sounded pretty lucky when moving away from the .stfolder marker file to using a marker folder?!

materemias commented 3 years ago

@Catfriend1 could you please package and sign a version which has higher version number than the one on the play store? if I sideload this version it gets updated from play store

Catfriend1 commented 3 years ago

Ahem.. no. That's not good in case I update gplay store then github again and github and then store... It would mess up a lot the knowing in which apk was which code released. If you don't want the google stuff, turn auto updates of the app off or e.g. use AuroraStore where you can control which app auto updates and which is ignored. To get it easy and silent, exporting config and migrating to the github or fdroid builds is more convenient in the longrun.

mpalermo73 commented 3 years ago

Running the official syncthing in place of 'fock seems to be working just fine on Android 11.

I guess I'm failing to understand why, if under the hood they're the same thing, 'fork needs different permissions than official. If the "all files" is just there for a few cases of odd/advanced use, why not simply request that permission when the app sees it's needed and just use the usual "storage access" as a default?

JLJTGR commented 3 years ago

Essentially this fork claims it is Android 11 ready, so the OS applies more restrictions on it. The other version doesn't claim this, so the OS is more lax so it doesn't crash the app.

Now that Android 11 is out, soon Google will not allow the other app to upload updates without saying it is ready for Android 11, where it will be restricted in the same way.

For frustrating reasons, not updating the other version made it work better.

mpalermo73 commented 3 years ago

THANK YOU for the "all in one place" reply. I totally get the issue now.

(And sorry to have wasted your time if that's the umpteen millionth time you've typed that... 😉)

JLJTGR commented 3 years ago

I might be crazy, but I feel like the PlayStore is ignoring its settings just to update this app. I have auto-updates off globally for all apps, but I was looking at my available updates and it said it updated Syncthing "1 hr ago" even though nothing else had updated today. I tried opening it and saw the expected permissions wizard and the toggle greyed out. I side-loaded the APK from here again to fix the permission... but if it happened once, I expect it to happen again.

Catfriend1 commented 3 years ago

I think it's time to protest about this nasty cloud behaviour by their issue tracker? Or use MicroG? Edit: this does not mean such comments about gplay mechanisms aren't welcome , indeed I like hearing, learning about it.

JLJTGR commented 3 years ago

I think I'm only half crazy. I caught it trying to do it again. It won't update it if I manually visit the "My apps & games" section... however if I tap the notification saying I have x new/y old updates available, it will bring me to the same screen and start updating only Syncthink-fork. I was able to click the X to cancel it in time.

Catfriend1 commented 3 years ago

The new fdroid build will be delayed because they had the "could not bring up vm builder" error during their last session.

https://f-droid.org/wiki/index.php?title=Special:RecentChanges&limit=100&hidebots=0

https://f-droid.org/wiki/page/com.github.catfriend1.syncthingandroid/lastbuild_1090003

Catfriend1 commented 3 years ago

Here's a new release which should safeguard more against the data loss reported by some users when the Android 11 Update is carried out and the OS presents a filesystem of empty folders to SyncthingNative. We now check the "all files access" to be there in SyncthingService as a fourth safety net.

Stuck with the G-Play version not working anymore: Use this update ( https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.4/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.4_6669dcb9.apk )

Want to leave the G-Play release channel and use the GitHub release: Use this update ( https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.4/com.github.catfriend1.syncthingandroid_github_v1.9.0.4_6669dcb9.apk )

Catfriend1 commented 3 years ago

F-Droid still has problems with the builders: https://f-droid.org/wiki/page/com.github.catfriend1.syncthingandroid/lastbuild_1090005

Nasnl commented 3 years ago

Downloaded the APK from here and tried to install on Android 11, Pixel 2. Applied permissions to install and all that, but the app won't install and ends with: 'app not installed' or 'you can't install the app on your device'. Tried through several file managers including Cx File explorer and Google Files, but no luck.

Any ideas?

Catfriend1 commented 3 years ago

@Nasnl which apk?

Nasnl commented 3 years ago

@Catfriend1 sorry: this one: https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.3/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.3_304261d3.apk and I have the same experience with this one: https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.4/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.4_6669dcb9.apk

JLJTGR commented 3 years ago

Google Play currently sends out v1.9.0.5. You cannot downgrade by sideloading an APK... you will get the app not installed message. https://github.com/Catfriend1/syncthing-android/releases/download/v1.9.0.5/com.github.catfriend1.syncthingandroid_gplay_v1.9.0.5_3e12d64e.apk is current.

Nasnl commented 3 years ago

@JLJTGR Thanks that worked like a charm! Appreciate the help!

cryobry commented 3 years ago

I'm still having this issue in A11 using v1.10.0. v0. 9.13 works fine. Is downgrading still the recommended workaround?

Catfriend1 commented 3 years ago

there is no version 0.9.13