Conversation
…ixed bug where failing to setup power user mode kept connect switch set to true
|
The dialog given when starting power user mode makes it seem like disabling battery optimizations is a requirement for everyone using power user mode. I think this would be best explained only when enabling the battery exemption in the settings, not always forcing battery optimization exemption while using power user mode. |
tladesignz
left a comment
There was a problem hiding this comment.
This looks all very reasonable to me. I stumbled over an unrelated typo. You might fix it with this PR or outside. Your choice.
|
|
||
| // remove accent marks and characters from a String, useful when searching | ||
| fun String.normalizie() : String = | ||
| fun String.normalizie(): String = |
There was a problem hiding this comment.
Nitpicking: While at it, can you fix that typo?
AFAIU, there's VPN mode, where most all Android versions and distributions will leave the app / the VPN process alone anyway. But when in power user mode, (so not using VPN entitlements), many Android versions and distributions exhibit a high chance of killing the service somewhere in between to save battery. Is there a third scenario? |
There may be some devices already using power user mode without any issues so it would not be favorable to force battery optimization exception on them. This is why I suggest a preference for that. |
|
I suppose the next question is, should forcing battery optimization exemption on power user mode be opt-in or opt-out. |
|
I'm applying the small corrections you all have made. You have a point @syphyr, I changed the dialog to be like this: |

While I still do feel that for most users running most builds of Android 30+ setting "Always-on VPN" solves the problem of needing to exempt your app from battery optimizations, this setting is being added for users who, for whatever reason, absolutely need to force Orbot to stay open no matter what level of OS/Device/Vendor/API Level/etc, etc they may be running...
This work is loosely inspired off of #1639 which brought this issue to our attention.
There are now two ways to disable battery optimizations:
1. The Passive Approach, Allows Any User to Disable Optimizations From Orbot's Settings
A new item for disabling battery optimizations is added to the settings, which the user can access whenever they want.
The rhetoric around disabling battery optimizations through this path is a bit tedious - this is to ensure that users don't mistakenly set disable this reasonable system default when they don't need to. This pathway to disabling battery optimizations is primarily there for users who know they need it, or for users who through a support channel are instructed to turn off battery optimizations for whatever reason...
It looks like this:

Clicking it opens a dialog (the last sentence in the dialog updates depending on if the user has battery optimizations for Orbot or not).
If the user decides to disable battery optimizations, they have to click through several Android settings screens to disable battery optimizations. And they may go back to re-enable them the same way. (note: these settings may look different across different Android versions)


And on screen 3, it's disabled 🏴 🪫 🥷 🏴 🪫 🥷 🏴 🪫 🥷

2. A More Direct Approach, Directly Disable Background Optimizations in Power User Mode
For users with power user mode enabled,
OrbotServiceis configured to stay running indefinitely in the background. However across all the various devices we support, I'm assuming that it's more likely for certain systems to kill a longrunning background service that's not acting as aVPNService.If you start Tor in Power User mode, you are given this dialog which explains that you have to disable battery optimizations. When you use Orbot as a VPN disabling battery optimizations is optional and stays hidden in the settings, but in power user mode it's required in order to start Tor.
Clicking it opens this System dialog, where if you click "Allow" Orbot automatically is marked as unrestricted.

Instead of making them dig through menus, power users are confronted with a dialog that directly sets Orbot to be unrestricted. This system dialog requires a pretty ugly permission, but luckily we already have it due to having previously nudged users into disabling battery optimizations many years ago in a way that was directed @ supporting users who host long running onion services via Orbot.