diff options
author | Fup Duck <fupduck@sacknagel.com> | 2018-02-08 19:48:31 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2018-02-08 19:48:31 +0100 |
commit | 73854e7fcdab77eaa408741b7353dea35b4803e1 (patch) | |
tree | e770c6f4130b358316e4f9266ec0491fec373a3d /app/src/main/java/se/leap/bitmaskclient/eip | |
parent | a14bfd300dccd79dbd3685710e5d8b40b5906a41 (diff) | |
parent | 95039d6444fc84908a0d4399947738f0399108c7 (diff) |
Merge branch 'leap_0.9.8' into 8827_handle_switch_provider
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/EIP.java | 18 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index cec917f7..474bf045 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -38,11 +38,12 @@ import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; import static se.leap.bitmaskclient.Constants.EIP_ACTION_CHECK_CERT_VALIDITY; import static se.leap.bitmaskclient.Constants.EIP_ACTION_IS_RUNNING; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_EIP; +import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; import static se.leap.bitmaskclient.Constants.EIP_ACTION_UPDATE; import static se.leap.bitmaskclient.Constants.EIP_RECEIVER; import static se.leap.bitmaskclient.Constants.EIP_REQUEST; +import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; @@ -97,8 +98,8 @@ public final class EIP extends IntentService { case EIP_ACTION_START: startEIP(); break; - case EIP_ACTION_START_ALWAYS_ON_EIP: - startAlwaysOnEIP(); + case EIP_ACTION_START_ALWAYS_ON_VPN: + startEIPAlwaysOnVpn(); break; case EIP_ACTION_STOP: stopEIP(); @@ -121,6 +122,9 @@ public final class EIP extends IntentService { * It also sets up early routes. */ private void startEIP() { + if (!preferences.getBoolean(EIP_RESTART_ON_BOOT, false)){ + preferences.edit().putBoolean(EIP_RESTART_ON_BOOT, true).commit(); + } if (gatewaysManager.isEmpty()) updateEIPService(); if (!EipStatus.getInstance().isBlockingVpnEstablished()) { @@ -139,8 +143,8 @@ public final class EIP extends IntentService { * Tries to start the last used vpn profile when the OS was rebooted and always-on-VPN is enabled. * The {@link OnBootReceiver} will care if there is no profile. */ - private void startAlwaysOnEIP() { - Log.d(TAG, "startAlwaysOnEIP vpn"); + private void startEIPAlwaysOnVpn() { + Log.d(TAG, "startEIPAlwaysOnVpn vpn"); if (gatewaysManager.isEmpty()) updateEIPService(); @@ -148,10 +152,10 @@ public final class EIP extends IntentService { gateway = gatewaysManager.select(); if (gateway != null && gateway.getProfile() != null) { - Log.d(TAG, "startAlwaysOnEIP eip launch avtive gateway vpn"); + Log.d(TAG, "startEIPAlwaysOnVpn eip launch avtive gateway vpn"); launchActiveGateway(); } else { - Log.d(TAG, "startAlwaysOnEIP no active profile available!"); + Log.d(TAG, "startEIPAlwaysOnVpn no active profile available!"); } } diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java index 6d49d83d..76d5fb8e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java @@ -33,7 +33,7 @@ import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.VpnNotificationManager; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_EIP; +import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_BLOCKING_VPN; import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; import static se.leap.bitmaskclient.Constants.EIP_IS_ALWAYS_ON; @@ -150,7 +150,7 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat private void requestVpnWithLastSelectedProfile() { Intent startEIP = new Intent(getApplicationContext(), EIP.class); - startEIP.setAction(EIP_ACTION_START_ALWAYS_ON_EIP); + startEIP.setAction(EIP_ACTION_START_ALWAYS_ON_VPN); getApplicationContext().startService(startEIP); } |