From 3d31821eadd240ad855a1caad2d80280dd5bffef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 22 Apr 2014 17:21:57 +0200 Subject: If no vpn is running, cancel notifications. --- app/src/main/java/se/leap/openvpn/OpenVpnService.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/se/leap/openvpn/OpenVpnService.java b/app/src/main/java/se/leap/openvpn/OpenVpnService.java index ccac72c7..deec8518 100644 --- a/app/src/main/java/se/leap/openvpn/OpenVpnService.java +++ b/app/src/main/java/se/leap/openvpn/OpenVpnService.java @@ -470,11 +470,16 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac public void updateState(String state,String logmessage, int resid) { // If the process is not running, ignore any state, // Notification should be invisible in this state - if(mProcessThread==null) - return; - if("CONNECTED".equals(state)) { - mNotificationManager.cancel(OPENVPN_STATUS); - } else if(!"BYTECOUNT".equals(state)) { + android.util.Log.d("OpenVpnService", "updateState(" + state + ","+logmessage); + + if(mProcessThread==null) { + if(mNotificationManager != null) + mNotificationManager.cancel(OPENVPN_STATUS); + return; + } + if("CONNECTED".equalsIgnoreCase(state)) { + mNotificationManager.cancel(OPENVPN_STATUS); + } else if(!"BYTECOUNT".equals(state)) { // Other notifications are shown, // This also mean we are no longer connected, ignore bytecount messages until next -- cgit v1.2.3