diff options
author | cyberta <cyberta@riseup.net> | 2020-02-27 22:44:50 -0600 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2020-02-27 22:44:50 -0600 |
commit | d41561376321d04ce585ac1f45221cb93446e55f (patch) | |
tree | f8ab5cf219fb613c47cf9a7e77d413d520132732 /app | |
parent | c5d5494e0e0d3cb8bb9c97583af3205143f5dea1 (diff) |
disable battery save mode while tethering is enabled
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java | 5 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/tethering/TetheringState.java | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java b/app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java index eeed29bc..02184f03 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java +++ b/app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java @@ -17,6 +17,7 @@ import android.preference.PreferenceManager; import se.leap.bitmaskclient.R; import de.blinkt.openvpn.core.VpnStatus.ByteCountListener; +import se.leap.bitmaskclient.tethering.TetheringObservable; import java.util.LinkedList; import java.util.Objects; @@ -143,8 +144,8 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL networkStateChange(context); } else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { boolean screenOffPause = prefs.getBoolean("screenoff", false); - - if (screenOffPause) { + boolean isTethering = TetheringObservable.getInstance().getTetheringState().isVpnTetheringRunning(); + if (screenOffPause && !isTethering) { if (VpnStatus.getLastConnectedVpnProfile() != null && !VpnStatus.getLastConnectedVpnProfile().mPersistTun) VpnStatus.logError(R.string.screen_nopersistenttun); diff --git a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringState.java b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringState.java index 8ef237c6..103462cc 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringState.java +++ b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringState.java @@ -41,5 +41,9 @@ public class TetheringState implements Cloneable { return isVpnWifiTetheringAllowed || isVpnUsbTetheringAllowed || isVpnBluetoothTetheringAllowed; } + public boolean isVpnTetheringRunning() { + return tetherWifiVpn() || tetherUsbVpn() || tetherBluetoothVpn(); + } + } |