pacien / tincapp

Android binding and user interface for the tinc mesh VPN daemon.
https://tincapp.euxane.net
GNU General Public License v3.0
165 stars 31 forks source link

Battery Optimization causes unstable connection #101

Closed jalius closed 4 years ago

jalius commented 4 years ago

Battery Optimization on my Android 9 device was breaking the tinc connection whenever the Tinc App was minimized for a period of time. This created a confusing and unstable connection during the setup process. I would go to load a web service and it would load halfway and then break connection. I had to disable Battery Optimization in Android settings for Tinc App and now everything is fine.

I have no idea how to address this, as I'm not familiar with the Android api and what is possible from an app. Can there be a setup step to disable battery optimization or at least prompt the user to disable it to improve the user experience?

jalius commented 4 years ago

https://developer.android.com/reference/android/provider/Settings#ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS

jalius commented 4 years ago

I suppose this could also be noted in the Troubleshooting Guide

pacien commented 4 years ago

Hello and thank you for the suggestions; I've added an entry in the FAQ section of the website.

Adapting the underlying tinc daemon for Android's specific battery-optimised network scheduling might be quite complicated.

It would indeed be sufficient to display a prompt within the application if the "battery optimisation" feature is enabled for the app.

pacien commented 4 years ago

Note: Google Play seems to be kicking applications which make use of the ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS intent.


I couldn't replicate the problematic behaviour with both the "App Standby" and "Doze" mode on AOSP from version 6 to 11. @jalius On which device (manufacturer and model) are you experiencing the described issue?

pacien commented 4 years ago

The problem only seems to affect some device manufacturers who ship customised Android ROMs with more aggressive power management rules than the ones in AOSP.

Detecting which particular devices are affected doesn't seem straightforward, making it hard to display a warning only when needed.

I added some extra details and remediation procedures to the documentation which should be enough to guide the users who are experiencing this issue.

jalius commented 4 years ago

Ok, thanks pacien. Just for reference I'm on OnePlus 6t with stock manufacturer firmware. This phone does ship with a custom Android 9 ROM called OxygenOS 9.0.17.