summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.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/EipCommand.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/EipCommand.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java
index 7f330f0d..46704419 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java
@@ -76,12 +76,15 @@ public class EipCommand {
execute(context, EIP_ACTION_STOP);
}
- public static void launchVPNProfile(@NonNull Context context, VpnProfile vpnProfile) {
+ public static void launchVPNProfile(@NonNull Context context, VpnProfile vpnProfile, Integer closestGateway) {
Intent baseIntent = new Intent();
baseIntent.putExtra(PROVIDER_PROFILE, vpnProfile);
+ baseIntent.putExtra(EIP_N_CLOSEST_GATEWAY, closestGateway);
execute(context, EIP_ACTION_LAUNCH_VPN, null, baseIntent);
}
+ public static void launchVoidVPN(@NonNull Context context) { execute(context, EIP_ACTION_START_BLOCKING_VPN);}
+
@VisibleForTesting
public static void stopVPN(@NonNull Context context, ResultReceiver resultReceiver) {
execute(context, EIP_ACTION_STOP, resultReceiver, null);