summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-06-20 00:35:08 +0200
committerParménides GV <parmegv@sdf.org>2014-06-20 12:44:02 +0200
commitd0383a325d3ec81be8dc354cb806f74b8d047c23 (patch)
treefdf0ac7c939e41c9ce70131be78446cea4a59dfe /app
parentf47cacd3a8ea7727f2f8577effef34271b9ff96c (diff)
Removed isRunning from OpenVpnService.
We use the broadcasted eip status from ics-openvpn to know if we're connected or not.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java7
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EIP.java10
2 files changed, 7 insertions, 10 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
index b5bba5d4..f08684b6 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
@@ -72,13 +72,6 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
private String mLastTunCfg;
private String mRemoteGW;
- //TODO We should know if this is running or not without this method
- public boolean isRunning() {
- if (mStarting == true || mProcessThread != null)
- return true;
- else
- return false;
- }
// From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
public static String humanReadableByteCount(long bytes, boolean mbit) {
if (mbit)
diff --git a/app/src/main/java/se/leap/bitmaskclient/EIP.java b/app/src/main/java/se/leap/bitmaskclient/EIP.java
index a7a17e5f..c439d6b7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EIP.java
@@ -142,7 +142,7 @@ public final class EIP extends IntentService {
return bindService(bindIntent, mVpnServiceConn, BIND_AUTO_CREATE);
}
- private static ServiceConnection mVpnServiceConn = new ServiceConnection() {
+ private ServiceConnection mVpnServiceConn = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
LocalBinder binder = (LocalBinder) service;
@@ -151,7 +151,7 @@ public final class EIP extends IntentService {
if (mReceiver != null && mPending != null) {
- boolean running = mVpnService.isRunning();
+ boolean running = isConnected();
int resultCode = Activity.RESULT_CANCELED;
@@ -202,7 +202,7 @@ public final class EIP extends IntentService {
Bundle resultData = new Bundle();
resultData.putString(REQUEST_TAG, ACTION_IS_EIP_RUNNING);
int resultCode = Activity.RESULT_CANCELED;
- boolean is_connected = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getString(STATUS, "").equalsIgnoreCase("LEVEL_CONNECTED");
+ boolean is_connected = isConnected();
if (mBound) {
resultCode = (is_connected) ? Activity.RESULT_OK : Activity.RESULT_CANCELED;
@@ -228,6 +228,10 @@ public final class EIP extends IntentService {
}
}
}
+
+ private boolean isConnected() {
+ return getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getString(STATUS, "").equalsIgnoreCase("LEVEL_CONNECTED");
+ }
/**
* Initiates an EIP connection by selecting a gateway and preparing and sending an