syncthing/syncthing-android

Unable to run in background -- unable to set battery usage to Unrestricted

tarkeez opened this issue · 4 comments

Version Information

App Version: 1.27.3
Syncthing Version: v1.27.3
Android Version: Android 12 (Onyx Boox software version 3.5)
Device: Onyx Boox Note Air 3 C

Description

(The following only happens for syncthing; all other apps I've tested work)

Syncthing is constantly killed and can't run in the background; other apps can, e.g. KDE connect

I am unable to set "Manage battery usage" to "Unrestricted" (see pics below); for other apps, I can set the setting just fine

running adb shell dumpsys deviceidle whitelist +com.nutomic.syncthingandroid succeeds in command but does not change setting. For other apps this works

I have another Boox device, running Android 11 -- there syncthing works as expected.

Syncthing-fork behaves exactly the same way.

Strange behaviour when changing battery settings: Picking Unrestricted turns blank, picking Optimized turns to Restricted, picking Restricted stays Restricted.

Set unrestricted:
image

Back out of menu and back in to find it unset:
image

Set "optimized":
image

and find it reset to "Restricted":
image

This looks like some peculiar restrictions imposed by the specific Android device manufacturer. I would try to keep Syncthing set to "optimized" (or blank), and then in the Syncthing app, try enabling "Keep the CPU awake while Syncthing is running" in the Experimental settings.

I guess it's a device/manufacturing specific thing, but it's really strange that only syncthing (of the apps I've tested) does this, and interesting that it doesn't happen on the A11 build.

Makes you wonder what is causing it, something specific about how syncthing reports its background service? Any idea how to debug this? Can provide logs etc.

Maybe look at how KDE connect dealt with it in comparison? I know it has a "persistent notification" setting. Maybe it specifically asked to be exempted frok battery opt/allow to run in background during setup, can't remember.

try enabling "Keep the CPU awake while Syncthing is running" in the Experimental settings.

Will try this

So it seems that with enabling "Keep the CPU awake while Syncthing is running" syncthing stays active but loses notification.

Closing as I'm not able to debug this and at least the syncing is working. Will reopen and try to debug if I find the time or syncthing stops working.

Btw the system's "start on boot" setting also works for other apps but not syncthing, so maybe the same reason there for why battery settings won't stick.

Figured it out for anyone with a boox device who should happen to have done what I did -- I added syncthing to auto start on boot in the android/boox settings, instead of in the syncthing app.