summaryrefslogtreecommitdiff
path: root/ics-openvpn-stripped/main
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-08-18 17:40:03 +0200
committerParménides GV <parmegv@sdf.org>2014-08-18 17:40:03 +0200
commitba091f74b6fe9b621569df3778174ada495cae92 (patch)
tree8b34a89ebc0417380eb7ae8116187de41fe28fd2 /ics-openvpn-stripped/main
parent83382477dfd3a483c42e479ee5f2dabd8c670d89 (diff)
parentd335503ffa00602aaccd1abf0549de50f788cc2d (diff)
Merge branch 'develop' into release-0.6.0
Diffstat (limited to 'ics-openvpn-stripped/main')
-rw-r--r--ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java b/ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
index c9fe3739..0cf93de3 100644
--- a/ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
+++ b/ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
@@ -40,6 +40,8 @@ import de.blinkt.openvpn.core.VpnStatus.StateListener;
import static de.blinkt.openvpn.core.NetworkSpace.ipAddress;
import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_CONNECTED;
+import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_CONNECTING_SERVER_REPLIED;
+import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_NONETWORK;
import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET;
import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT;
@@ -699,15 +701,23 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
} else if (level == LEVEL_CONNECTED) {
mDisplayBytecount = true;
mConnecttime = System.currentTimeMillis();
- lowpriority = true;
+ lowpriority = true;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(OPENVPN_STATUS);
- } else {
+ } else if(!mProfile.mPersistTun || mConnecttime == 0){
mDisplayBytecount = false;
String msg = getString(resid);
String ticker = msg;
showNotification(msg + " " + logmessage, ticker, lowpriority , 0, level);
- }
+ } else if(mProfile.mPersistTun && level == LEVEL_NONETWORK) {
+ NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ mNotificationManager.cancel(OPENVPN_STATUS);
+ } else if(mProfile.mPersistTun && mConnecttime > 0) {
+ mDisplayBytecount = false;
+ String msg = "Traffic is blocked until the VPN becomes active.";
+ String ticker = msg;
+ showNotification(msg, ticker, lowpriority , 0, level);
+ }
}
}