summaryrefslogtreecommitdiff
path: root/app/src/main/java/se
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-01-25 12:58:53 +0100
committercyBerta <cyberta@riseup.net>2021-01-25 12:58:53 +0100
commit8528dcc31f95c48264f6ca2ef1fb085be332e201 (patch)
tree5985e8751aac3ac6c167c045444cff0485ea3462 /app/src/main/java/se
parentd2cfd37e8380f47cf450fff59867c87b6327a735 (diff)
Android O+ devices: only launch VPN on boot if always-on is enabled. For pre Android O: evaluate last connection state in OnBootReceiver
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/OnBootReceiver.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/OnBootReceiver.java b/app/src/main/java/se/leap/bitmaskclient/base/OnBootReceiver.java
index df1d3e5a..3b534a7d 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/OnBootReceiver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/OnBootReceiver.java
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.os.Build;
import android.util.Log;
import de.blinkt.openvpn.core.VpnStatus;
@@ -27,7 +28,7 @@ public class OnBootReceiver extends BroadcastReceiver {
}
preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE);
boolean providerConfigured = !preferences.getString(PROVIDER_VPN_CERTIFICATE, "").isEmpty();
- boolean startOnBoot = preferences.getBoolean(EIP_RESTART_ON_BOOT, false);
+ boolean startOnBoot = preferences.getBoolean(EIP_RESTART_ON_BOOT, false) && Build.VERSION.SDK_INT < Build.VERSION_CODES.O;
boolean isAlwaysOnConfigured = VpnStatus.isAlwaysOn();
Log.d("OpenVPN", "OpenVPN onBoot intent received. Provider configured? " + providerConfigured + " Start on boot? " + startOnBoot + " isAlwaysOn feature configured: " + isAlwaysOnConfigured);
if (providerConfigured) {