summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <richy@cyborgsociety.org>2013-11-14 21:21:26 +0100
committercyBerta <richy@cyborgsociety.org>2013-11-14 21:21:26 +0100
commitd0f6818f93a3978647336191aa104325879cfa13 (patch)
tree1b783fd81c01f33343d0c6ba6b02a840827f7f30
parent7189ef37c5d5973a76ea5cdbc69d826b1abaae63 (diff)
shows the broken key symbol on specific states, not on messages from R.string
-rw-r--r--src/se/leap/openvpn/OpenVpnService.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java
index af807002..620de204 100644
--- a/src/se/leap/openvpn/OpenVpnService.java
+++ b/src/se/leap/openvpn/OpenVpnService.java
@@ -25,7 +25,6 @@ import android.os.Build;
import android.os.IBinder;
import android.os.Message;
import android.os.ParcelFileDescriptor;
-//import android.util.Log;
import se.leap.openvpn.OpenVPN.StateListener;
public class OpenVpnService extends VpnService implements StateListener, Callback {
@@ -103,11 +102,11 @@ 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;
- if (tickerText == getString(R.string.state_noprocess)){
+ if (state.equals("NOPROCESS") || state.equals("AUTH_FAILED") || state.equals("NONETWORK")){
icon = R.drawable.ic_vpn_disconnected;
}else{
icon = R.drawable.ic_stat_vpn;
@@ -469,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)) {
@@ -479,9 +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);
+ }
}
}