From c9f94cb469f979b4d25eb6ff8728b8972265a21f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 5 Nov 2013 14:17:01 +0100 Subject: broken key icon added + icon is shown on 'not running' notification --- src/se/leap/openvpn/OpenVpnService.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java index bec7dcee..3ce5a5b2 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; @@ -26,6 +25,7 @@ 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 { @@ -63,6 +63,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac private static final int OPENVPN_STATUS = 1; public static final int PROTECT_FD = 0; + private static final String OPEN_VPN_SERVICE_TAG = "OPEN_VPN_SERVICE: "; private final IBinder mBinder = new LocalBinder(); @@ -106,9 +107,13 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac private void showNotification(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 (tickerText == getString(R.string.state_noprocess)){ + 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)); @@ -476,7 +481,9 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac // CONNECTED String ticker = getString(resid); boolean persist = ("NOPROCESS".equals(state)) ? false : true; + Log.d(OPEN_VPN_SERVICE_TAG, ticker); showNotification(getString(resid) +" " + logmessage,ticker,false,0,persist); + } } -- cgit v1.2.3 From 4295a81b6e1d97765155f8dc219338e705f4e088 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 5 Nov 2013 14:37:18 +0100 Subject: debug logs removed --- src/se/leap/openvpn/OpenVpnService.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java index 3ce5a5b2..af807002 100644 --- a/src/se/leap/openvpn/OpenVpnService.java +++ b/src/se/leap/openvpn/OpenVpnService.java @@ -25,7 +25,7 @@ import android.os.Build; import android.os.IBinder; import android.os.Message; import android.os.ParcelFileDescriptor; -import android.util.Log; +//import android.util.Log; import se.leap.openvpn.OpenVPN.StateListener; public class OpenVpnService extends VpnService implements StateListener, Callback { @@ -63,7 +63,6 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac private static final int OPENVPN_STATUS = 1; public static final int PROTECT_FD = 0; - private static final String OPEN_VPN_SERVICE_TAG = "OPEN_VPN_SERVICE: "; private final IBinder mBinder = new LocalBinder(); @@ -481,7 +480,6 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac // CONNECTED String ticker = getString(resid); boolean persist = ("NOPROCESS".equals(state)) ? false : true; - Log.d(OPEN_VPN_SERVICE_TAG, ticker); showNotification(getString(resid) +" " + logmessage,ticker,false,0,persist); } -- cgit v1.2.3 From 7189ef37c5d5973a76ea5cdbc69d826b1abaae63 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 14 Nov 2013 07:03:18 +0100 Subject: status message string from resource, clearer status message for 'not running', bugfix for bug #4477 --- src/se/leap/bitmaskclient/EipServiceFragment.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/se/leap/bitmaskclient/EipServiceFragment.java b/src/se/leap/bitmaskclient/EipServiceFragment.java index daf446a5..1b2cfb20 100644 --- a/src/se/leap/bitmaskclient/EipServiceFragment.java +++ b/src/se/leap/bitmaskclient/EipServiceFragment.java @@ -132,6 +132,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli @Override public void onClick(DialogInterface dialog, int which) { eipCommand(EIP.ACTION_STOP_EIP); + mEipStartPending = false; } }) .setNegativeButton(getResources().getString(R.string.eip_cancel_connect_false), new DialogInterface.OnClickListener() { @@ -177,18 +178,21 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli String statusMessage = ""; String prefix = getString(localizedResId); if (state.equals("CONNECTED")){ - statusMessage = "Connection Secure"; + statusMessage = getString(R.string.eip_state_connected); getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE); mEipStartPending = false; } else if (state.equals("BYTECOUNT")) { statusMessage = logmessage; } else if ( (state.equals("NOPROCESS") && !mEipStartPending ) || state.equals("EXITING")) { - statusMessage = "Not running! Connection not secure!"; + statusMessage = getString(R.string.eip_state_not_connected); getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE); mEipStartPending = false; switchState = false; - } else { - statusMessage = prefix + logmessage; + } else if (state.equals("NOPROCESS")){ + statusMessage = logmessage; + } + else { + statusMessage = prefix + " " + logmessage; } eipAutoSwitched = true; -- cgit v1.2.3 From d0f6818f93a3978647336191aa104325879cfa13 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 14 Nov 2013 21:21:26 +0100 Subject: shows the broken key symbol on specific states, not on messages from R.string --- src/se/leap/openvpn/OpenVpnService.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') 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); + } } } -- cgit v1.2.3