Request battery optimization exemption to prevent low-memory kills#1639
Request battery optimization exemption to prevent low-memory kills#1639syphyr wants to merge 1 commit intoguardianproject:masterfrom
Conversation
|
This is a start, but it might be possible to return Otherwise, this is regrettable, but necessary... If we want to merge this, I want there to be UI wrapped around it and not something that the user is immediately nudged with every time they open the app, especially on first launch. Not merging this yet, but not closing either. Will update here soon... |
|
@bitmold I have reworked the commit to use a toggle to enable/disable the battery optimization exemption request. From my testing, I have noticed a few things with this: There appears to be a known issue with Android's battery optimization system. The problem stems from how Android handles repeated changes to battery optimization exemptions for the same process.
The underlying cause seems to be that Android maintains some internal state about optimization exemptions that doesn't properly reset without a full process termination. |
|
Although, I have noticed that when the battery optimization exemption is enabled, Orbot does not crash with that |
|
I'll discuss this with Nathan tomorrow. When you say "Android" do you mean on Nougat/API 24 as you often seem to be using that version. In any case, just noting it's likely that the battery exemption and your observations may behave differently on different versions of Android. This is all very interesting though... Will update you more here after discussing... |
|
I'm testing with cm-14.1 (nougat). |
|
Related recommendations from other VPNs: https://www.astrill.com/wiki/Astrill_Setup_Manual:How_to_disable_Android_battery_optimization |
|
This PR is superseded by #1648 |
Orbot should always request battery optimization exemption to prevent low-memory kills. If Orbot is killed by low-memory, this can expose the users real IP address when not using power user mode.
Orbot's VPN mode and Power User Mode also require uninterrupted operation. Even transient SOCKS/HTTP proxy usage suffers from battery-killed circuits. Tor circuit rebuilds are also much faster when not restricted by battery optimizations.