From bbc040a05d4c6050248a813f7488c1c59d00d759 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 26 Nov 2021 13:21:51 +0100 Subject: fix save battery feature --- app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'app/src/main') 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 02184f03..d3fc0b4e 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java +++ b/app/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java @@ -137,13 +137,10 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL @Override public void onReceive(Context context, Intent intent) { - SharedPreferences prefs = Preferences.getDefaultSharedPreferences(context); - - if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) { networkStateChange(context); } else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { - boolean screenOffPause = prefs.getBoolean("screenoff", false); + boolean screenOffPause = PreferenceHelper.getSaveBattery(context); boolean isTethering = TetheringObservable.getInstance().getTetheringState().isVpnTetheringRunning(); if (screenOffPause && !isTethering) { if (VpnStatus.getLastConnectedVpnProfile() != null && !VpnStatus.getLastConnectedVpnProfile().mPersistTun) -- cgit v1.2.3