diff options
author | Parménides GV <parmegv@sdf.org> | 2014-04-22 17:21:57 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-04-22 17:21:57 +0200 |
commit | 3d31821eadd240ad855a1caad2d80280dd5bffef (patch) | |
tree | d8675fcda26b7e265420734f1c8a121046c6d7fb | |
parent | 3b74a663480d9d241816f0eeaf44bb326c2b8b9c (diff) |
If no vpn is running, cancel notifications.
-rw-r--r-- | app/src/main/java/se/leap/openvpn/OpenVpnService.java | 15 |
1 files changed, 10 insertions, 5 deletions
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 |