summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java12
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java4
7 files changed, 20 insertions, 20 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java
index 4a8b1236..65355a67 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java
@@ -43,9 +43,9 @@ public class BitmaskTileService extends TileService implements Observer {
private void onTileTap() {
EipStatus eipStatus = EipStatus.getInstance();
if (eipStatus.isConnecting() || eipStatus.isBlocking() || eipStatus.isConnected() || eipStatus.isReconnecting()) {
- EipCommand.stopVPN(getApplicationContext());
+ EipCommand.stopVPN(this);
} else {
- EipCommand.startVPN(getApplicationContext(), false);
+ EipCommand.startVPN(this, false);
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
index 77743eac..aea397fb 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
@@ -217,14 +217,14 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener,
switch (requestCode) {
case REQUEST_CODE_SWITCH_PROVIDER:
- EipCommand.stopVPN(this.getApplicationContext());
- EipCommand.startVPN(this.getApplicationContext(), false);
+ EipCommand.stopVPN(this);
+ EipCommand.startVPN(this, false);
break;
case REQUEST_CODE_CONFIGURE_LEAP:
Log.d(TAG, "REQUEST_CODE_CONFIGURE_LEAP - onActivityResult - MainActivity");
break;
case REQUEST_CODE_LOG_IN:
- EipCommand.startVPN(this.getApplicationContext(), true);
+ EipCommand.startVPN(this, true);
break;
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
index 9d689e5d..1ea574ff 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
@@ -189,11 +189,11 @@ public class StartActivity extends Activity{
} else {
Log.d(TAG, "vpn provider is configured");
if (getIntent() != null && getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false)) {
- EipCommand.startVPN(this.getApplicationContext(), true);
+ EipCommand.startVPN(this, true);
finish();
} else if (PreferenceHelper.getRestartOnUpdate(this.getApplicationContext())) {
PreferenceHelper.restartOnUpdate(this.getApplicationContext(), false);
- EipCommand.startVPN(this.getApplicationContext(), false);
+ EipCommand.startVPN(this, false);
showMainActivity();
finish();
} else {
@@ -224,7 +224,7 @@ public class StartActivity extends Activity{
Provider provider = data.getParcelableExtra(Provider.KEY);
storeProviderInPreferences(preferences, provider);
ProviderObservable.getInstance().updateProvider(provider);
- EipCommand.startVPN(this.getApplicationContext(), false);
+ EipCommand.startVPN(this, false);
showMainActivity();
} else if (resultCode == RESULT_CANCELED) {
finish();
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java
index 14673874..24b31108 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java
@@ -338,7 +338,7 @@ public class EipFragment extends Fragment implements Observer {
bundle.putBoolean(EIP_EARLY_ROUTES, false);
ProviderAPICommand.execute(getContext().getApplicationContext(), DOWNLOAD_GEOIP_JSON, bundle, provider);
} else {
- EipCommand.startVPN(context.getApplicationContext(), false);
+ EipCommand.startVPN(context, false);
}
EipStatus.getInstance().updateState("UI_CONNECTING", "", 0, ConnectionStatus.LEVEL_START);
}
@@ -349,7 +349,7 @@ public class EipFragment extends Fragment implements Observer {
Log.e(TAG, "context is null when trying to stop EIP");
return;
}
- EipCommand.stopVPN(context.getApplicationContext());
+ EipCommand.stopVPN(context);
}
private void askPendingStartCancellation() {
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 46704419..b5229b0a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java
@@ -28,7 +28,7 @@ import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE;
public class EipCommand {
private static void execute(@NonNull Context context, @NonNull String action) {
- execute(context.getApplicationContext(), action, null, null);
+ execute(context, action, null, null);
}
/**
@@ -46,7 +46,7 @@ public class EipCommand {
vpnIntent.setAction(action);
if (resultReceiver != null)
vpnIntent.putExtra(EIP_RECEIVER, resultReceiver);
- EIP.enqueueWork(context, vpnIntent);
+ EIP.enqueueWork(context.getApplicationContext(), vpnIntent);
}
public static void startVPN(@NonNull Context context, boolean earlyRoutes) {
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 4e5016f0..beed35d1 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
@@ -193,14 +193,14 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
ProviderObservable.getInstance().updateProvider(provider);
PreferenceHelper.storeProviderInPreferences(preferences, provider);
if (EipStatus.getInstance().isDisconnected()) {
- EipCommand.startVPN(context.getApplicationContext(), false);
+ EipCommand.startVPN(context, false);
}
break;
case CORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE:
provider = resultData.getParcelable(PROVIDER_KEY);
ProviderObservable.getInstance().updateProvider(provider);
PreferenceHelper.storeProviderInPreferences(preferences, provider);
- EipCommand.startVPN(context.getApplicationContext(), false);
+ EipCommand.startVPN(context, false);
break;
case CORRECTLY_DOWNLOADED_GEOIP_JSON:
provider = resultData.getParcelable(PROVIDER_KEY);
@@ -235,7 +235,7 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
private void maybeStartEipService(Bundle resultData) {
if (resultData.getBoolean(EIP_ACTION_START)) {
boolean earlyRoutes = resultData.getBoolean(EIP_EARLY_ROUTES);
- EipCommand.startVPN(context.getApplicationContext(), earlyRoutes);
+ EipCommand.startVPN(context, earlyRoutes);
}
}
@@ -262,7 +262,7 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
switch (error) {
case NO_MORE_GATEWAYS:
finishGatewaySetup(false);
- EipCommand.startBlockingVPN(context.getApplicationContext());
+ EipCommand.startBlockingVPN(context);
break;
case ERROR_INVALID_PROFILE:
selectNextGateway();
@@ -364,7 +364,7 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
private void selectNextGateway() {
changingGateway.set(true);
reconnectTry.set(0);
- EipCommand.startVPN(context.getApplicationContext(), false, setupNClosestGateway.get() + 1);
+ EipCommand.startVPN(context, false, setupNClosestGateway.get() + 1);
}
private void finishGatewaySetup(boolean changingGateway) {
@@ -396,7 +396,7 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
case SHAPESHIFTER:
VpnProfile profile = VpnStatus.getLastConnectedVpnProfile();
if (profile == null) {
- EipCommand.startVPN(context.getApplicationContext(), false, 0);
+ EipCommand.startVPN(context, false, 0);
} else {
GatewaysManager gatewaysManager = new GatewaysManager(context.getApplicationContext());
int position = gatewaysManager.getPosition(profile);
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java
index e2cd86b9..a8494e2b 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java
@@ -30,14 +30,14 @@ public class VoidVpnLauncher extends Activity {
startActivityForResult(blockingIntent, VPN_USER_PERMISSION);
}
else {
- EipCommand.startBlockingVPN(getApplicationContext());
+ EipCommand.startBlockingVPN(this);
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == VPN_USER_PERMISSION) {
if (resultCode == RESULT_OK) {
- EipCommand.launchVoidVPN(getApplicationContext());
+ EipCommand.launchVoidVPN(this);
}
}
finish();