summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2017-12-14 10:19:03 -0800
committercyberta <cyberta@riseup.net>2017-12-14 10:19:03 -0800
commit67ff3447f10c43770dc9ee4dccf358321063d131 (patch)
treecb29df26bec196f8628947897a5fe9977b00a229 /app/src/main/java/de/blinkt
parent18e24819eed388d349dbf6d7cd21534d7074bf5d (diff)
parent25d215400d500bdb7537e604ed91ced586821ef2 (diff)
Merge branch '8742_always-on_VPN' into '0.9.8'
8742 always on vpn See merge request leap/bitmask_android!20
Diffstat (limited to 'app/src/main/java/de/blinkt')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/ConnectionStatus.java1
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java24
2 files changed, 23 insertions, 2 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/ConnectionStatus.java b/app/src/main/java/de/blinkt/openvpn/core/ConnectionStatus.java
index 03d842e3..3e6d23f7 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/ConnectionStatus.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/ConnectionStatus.java
@@ -21,6 +21,7 @@ public enum ConnectionStatus implements Parcelable {
LEVEL_START,
LEVEL_AUTH_FAILED,
LEVEL_WAITING_FOR_USER_INPUT,
+ LEVEL_BLOCKING, // used for Bitmask's VoidVPN
UNKNOWN_LEVEL;
@Override
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 ded7490a..f52c30d9 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -115,6 +115,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
public boolean stopVPN(boolean replaceConnection) throws RemoteException {
return OpenVPNService.this.stopVPN(replaceConnection);
}
+
+ @Override
+ public boolean isVpnRunning() throws RemoteException {
+ return OpenVPNService.this.isVpnRunning();
+ }
};
// From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
@@ -238,8 +243,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
//noinspection NewApi
nbuilder.setChannelId(channel);
if (mProfile != null)
- //noinspection NewApi
- nbuilder.setShortcutId(mProfile.getUUIDString());
+ //noinspection NewApi
+ nbuilder.setShortcutId(mProfile.getUUIDString());
}
@@ -412,6 +417,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
}
+ @Override
public void userPause(boolean shouldBePaused) {
if (mDeviceStateReceiver != null)
mDeviceStateReceiver.userPause(shouldBePaused);
@@ -425,6 +431,20 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
return false;
}
+ /**
+ * used in Bitmask
+ */
+ @Override
+ public boolean isVpnRunning() {
+ boolean hasVPNProcessThread = false;
+ synchronized (mProcessLock) {
+ hasVPNProcessThread = mProcessThread != null && mProcessThread.isAlive();
+ }
+
+ return hasVPNProcessThread;
+
+ }
+
@Override
public int onStartCommand(Intent intent, int flags, int startId) {