eclair-mobile
eclair-mobile copied to clipboard
Guard against aggressive/broken battery optimization implemented by some Android vendors
As far as I know, some Android vendors have implemented very aggressive policies against apps which stay in the background. Such policies once caused some problems, like https://github.com/shadowsocks/shadowsocks-android/pull/594
Not all those measures can be avoided: https://dontkillmyapp.com/
Thanks for the link @andronoob. As mentioned by @dbrgn, it's not always possible to protect against vendors' battery optimization mechanisms. That's the way these devices are intended to work.
However most vendors provide a whitelist feature where the user can disable optimization for a given app. So we've designed a mechanism that can detect aggressive battery optimizations and will display a message to the user telling him that the app should be whitelisted.
Note that devices using a stock android are not affected by all this.
So we've designed a mechanism that can detect aggressive battery optimizations and will display a message to the user telling him that the app should be whitelisted.
The current situation is so bad that I don't think a "warning mechanism" will work - maybe we need a more "scary" warning when the receiving feature is activated, or we should check availability of background process before the user receives the first LN payment.
Even some experienced users are still confused about how to whitelist an app - otherwise devs of shadowsocks won't implement things like "GuardedProcess" - IIRC they implemented this workaround due to their own demand😂.
AFAIK, the reason why such aggresive battery-saving policy exists is not simple as "squeeze a little more battery life" - the ecosystem issues of Android has been criticised for long. Countless "rogue" Android apps tend to use trickier and trickier techniques to circumvent battery saving policies, merely serving for their own shady "business" (like pushing garbage ads to the user) incomes. I once heard that some SDKs provided by "mobile ad unions" even enable the devs to "help each other by waking up each other on the user's phone", in other words, a series of "rogue" apps would be woke up if only one of them is woke up.😂 Things might be worse if such policies don't exist - the battery life might shrunk very significantly, like, halving down.
Also, I wonder if watchtower mechanisms can solve this problem in the future?