summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/EIP.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIP.java28
1 files changed, 4 insertions, 24 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 0e6d9b95..29e2199f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -43,12 +43,13 @@ import java.util.Observer;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
-import de.blinkt.openvpn.LaunchVPN;
+import de.blinkt.openvpn.core.ConnectionStatus;
import de.blinkt.openvpn.core.IOpenVPNServiceInternal;
import de.blinkt.openvpn.core.OpenVPNService;
import de.blinkt.openvpn.core.ProfileManager;
import de.blinkt.openvpn.core.VpnStatus;
import se.leap.bitmaskclient.OnBootReceiver;
+import se.leap.bitmaskclient.R;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK;
@@ -175,7 +176,6 @@ public final class EIP extends JobIntentService implements Observer {
}
}
-
/**
* Initiates an EIP connection by selecting a gateway and preparing and sending an
* Intent to {@link de.blinkt.openvpn.LaunchVPN}.
@@ -216,13 +216,10 @@ public final class EIP extends JobIntentService implements Observer {
* The {@link OnBootReceiver} will care if there is no profile.
*/
private void startEIPAlwaysOnVpn() {
- Log.d(TAG, "startEIPAlwaysOnVpn vpn");
-
GatewaysManager gatewaysManager = gatewaysFromPreferences();
Gateway gateway = gatewaysManager.select(0);
if (gateway != null && gateway.getProfile() != null) {
- Log.d(TAG, "startEIPAlwaysOnVpn eip launch closest gateway.");
launchActiveGateway(gateway, 0);
} else {
Log.d(TAG, "startEIPAlwaysOnVpn no active profile available!");
@@ -245,18 +242,9 @@ public final class EIP extends JobIntentService implements Observer {
* @param gateway to connect to
*/
private void launchActiveGateway(@NonNull Gateway gateway, int nClosestGateway) {
- /*Intent gatewaySetupWatcherIntent = new Intent(BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT);
- gatewaySetupWatcherIntent.putExtra(EIP_REQUEST, )
- gatewaySetupWatcherIntent.putExtra(LaunchVPN.EXTRA_TEMP_VPN_PROFILE, gateway.getProfile());*/
-
-
- Intent intent = new Intent(BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT); //new Intent(this, LaunchVPN.class);
- //intent.setAction(Intent.ACTION_MAIN);
- //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- //intent.putExtra(LaunchVPN.EXTRA_HIDELOG, true);
+ Intent intent = new Intent(BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT);
intent.putExtra(EXTRA_TEMP_VPN_PROFILE, gateway.getProfile());
intent.putExtra(Gateway.KEY_N_CLOSEST_GATEWAY, nClosestGateway);
- //startActivity(intent);
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}
@@ -267,6 +255,7 @@ public final class EIP extends JobIntentService implements Observer {
* terminates EIP if currently connected or connecting
*/
private void stopEIP() {
+ VpnStatus.updateStateString("STOPPING", "STOPPING VPN", R.string.state_exiting, ConnectionStatus.LEVEL_STOPPING);
int resultCode = stop() ? RESULT_OK : RESULT_CANCELED;
tellToReceiverOrBroadcast(EIP_ACTION_STOP, resultCode);
}
@@ -295,14 +284,6 @@ public final class EIP extends JobIntentService implements Observer {
}
/**
- * Updates the eip.json. It containes information about the vpn service of a provider such as
- * available gateways, supported protocols and open ports.
- */
- private void updateEipJson() {
-
- }
-
- /**
* read VPN certificate from preferences and check it
* broadcast result
*/
@@ -409,7 +390,6 @@ public final class EIP extends JobIntentService implements Observer {
startService(stopVoidVpnIntent);
}
-
/**
* creates a OpenVpnServiceConnection if necessary
* then terminates OpenVPN