summaryrefslogtreecommitdiff
path: root/src/se/leap/openvpn
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-11-15 13:04:35 -0800
committerSean Leonard <meanderingcode@aetherislands.net>2013-11-15 13:04:35 -0800
commit42d075e993fc345b7684ed4e0e89b732563f7a0c (patch)
tree9133c29cb27e8e3e0acc0a7fa81d2758589ed523 /src/se/leap/openvpn
parenta95cc0fc7c364e60f2d82dd9ef6749c30a3b229f (diff)
parentd0f6818f93a3978647336191aa104325879cfa13 (diff)
Merge branch 'feature/disconnect-notification-icon' into develop
Diffstat (limited to 'src/se/leap/openvpn')
-rw-r--r--src/se/leap/openvpn/OpenVpnService.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java
index bec7dcee..620de204 100644
--- a/src/se/leap/openvpn/OpenVpnService.java
+++ b/src/se/leap/openvpn/OpenVpnService.java
@@ -7,7 +7,6 @@ import java.util.Vector;
import se.leap.bitmaskclient.Dashboard;
import se.leap.bitmaskclient.R;
-
import android.annotation.TargetApi;
import android.app.Notification;
import android.app.NotificationManager;
@@ -103,12 +102,16 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
}
- private void showNotification(String msg, String tickerText, boolean lowpriority, long when, boolean persistant) {
+ private void showNotification(String state, String msg, String tickerText, boolean lowpriority, long when, boolean persistant) {
String ns = Context.NOTIFICATION_SERVICE;
mNotificationManager = (NotificationManager) getSystemService(ns);
-
-
- int icon = R.drawable.ic_stat_vpn;
+ int icon;
+ if (state.equals("NOPROCESS") || state.equals("AUTH_FAILED") || state.equals("NONETWORK")){
+ icon = R.drawable.ic_vpn_disconnected;
+ }else{
+ icon = R.drawable.ic_stat_vpn;
+ }
+
android.app.Notification.Builder nbuilder = new Notification.Builder(this);
nbuilder.setContentTitle(getString(R.string.notifcation_title,mProfile.mName));
@@ -465,8 +468,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
// If the process is not running, ignore any state,
// Notification should be invisible in this state
if(mProcessThread==null)
- return;
-
+ return;
if("CONNECTED".equals(state)) {
mNotificationManager.cancel(OPENVPN_STATUS);
} else if(!"BYTECOUNT".equals(state)) {
@@ -475,8 +477,14 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
// This also mean we are no longer connected, ignore bytecount messages until next
// CONNECTED
String ticker = getString(resid);
- boolean persist = ("NOPROCESS".equals(state)) ? false : true;
- showNotification(getString(resid) +" " + logmessage,ticker,false,0,persist);
+ boolean persist = false;
+ if (("NOPROCESS".equals(state) ) || ("EXIT").equals(state)){
+ showNotification(state, getString(R.string.eip_state_not_connected), ticker, false, 0, persist);
+ }
+ else{
+ persist = true;
+ showNotification(state, getString(resid) +" " + logmessage,ticker,false,0,persist);
+ }
}
}