summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-02-26 13:13:29 +0100
committercyBerta <cyberta@riseup.net>2021-02-26 13:13:29 +0100
commit704bdf92e6265ee4bdb7e177c7d09284ebc29868 (patch)
treec2adecb59abc4fd344272d55e1829ad03d5e07fd /app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
parente1b6c1a9c4e9cf9849ceb37bf775ba28cc539bff (diff)
Bigger refactoring:
* always use a bound service connection to start a vpn service as foreground service to fix remote excptions. These appeared if the system wasn't able to set the service as forground shortly after it was started * move vpn start logic from LaunchVPN activity to EIP service. LaunchVPN/VoidVPNLauncher is only used in case we need to ask the user for a permission. It reduces visual glitches when the transparent LaunchVPN activity appears and disappears
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
index 4b7498e2..4706d550 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
@@ -59,6 +59,7 @@ import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_PREPARE_VPN
import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START;
import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_ALWAYS_ON_VPN;
import static se.leap.bitmaskclient.base.models.Constants.EIP_EARLY_ROUTES;
+import static se.leap.bitmaskclient.base.models.Constants.EIP_N_CLOSEST_GATEWAY;
import static se.leap.bitmaskclient.base.models.Constants.EIP_REQUEST;
import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY;
import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE;
@@ -260,20 +261,19 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
return;
}
setupVpnProfile = vpnProfile;
- setupNClosestGateway.set(event.getIntExtra(Gateway.KEY_N_CLOSEST_GATEWAY, 0));
+ setupNClosestGateway.set(event.getIntExtra(EIP_N_CLOSEST_GATEWAY, 0));
Log.d(TAG, "bitmaskapp add state listener");
VpnStatus.addStateListener(this);
-
- launchVPN(setupVpnProfile);
}
private void launchVPN(VpnProfile vpnProfile) {
+ EipCommand.launchVPNProfile(context, vpnProfile, setupNClosestGateway.get());
Intent intent = new Intent(context.getApplicationContext(), LaunchVPN.class);
intent.setAction(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(LaunchVPN.EXTRA_HIDELOG, true);
intent.putExtra(PROVIDER_PROFILE, vpnProfile);
- intent.putExtra(Gateway.KEY_N_CLOSEST_GATEWAY, setupNClosestGateway.get());
+ intent.putExtra(EIP_N_CLOSEST_GATEWAY, setupNClosestGateway.get());
context.startActivity(intent);
}