diff options
Diffstat (limited to 'main')
13 files changed, 165 insertions, 44 deletions
diff --git a/main/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl b/main/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl new file mode 100644 index 00000000..3958bcf3 --- /dev/null +++ b/main/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2012-2016 Arne Schwabe + * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt + */ + +package de.blinkt.openvpn.core; + +/** + * Created by arne on 15.11.16. + */ + +interface IOpenVPNServiceInternal { + + boolean protect(int fd); + + void userPause(boolean b); + + /** + * @param replaceConnection True if the VPN is connected by a new connection. + * @return true if there was a process that has been send a stop signal + */ + boolean stopVPN(boolean replaceConnection); +} diff --git a/main/src/main/aidl/de/blinkt/openvpn/core/IServiceStatus.aidl b/main/src/main/aidl/de/blinkt/openvpn/core/IServiceStatus.aidl index 49bf0619..0772dcb9 100644 --- a/main/src/main/aidl/de/blinkt/openvpn/core/IServiceStatus.aidl +++ b/main/src/main/aidl/de/blinkt/openvpn/core/IServiceStatus.aidl @@ -13,6 +13,7 @@ interface IServiceStatus { /** * Remove a previously registered callback interface. - */ + */ void unregisterStatusCallback(in IStatusCallbacks cb); + } diff --git a/main/src/main/aidl/de/blinkt/openvpn/core/IStatusCallbacks.aidl b/main/src/main/aidl/de/blinkt/openvpn/core/IStatusCallbacks.aidl index 23bee8b4..b72a2ffa 100644 --- a/main/src/main/aidl/de/blinkt/openvpn/core/IStatusCallbacks.aidl +++ b/main/src/main/aidl/de/blinkt/openvpn/core/IStatusCallbacks.aidl @@ -18,4 +18,6 @@ interface IStatusCallbacks { oneway void updateStateString(in String state, in String msg, in int resid, in ConnectionStatus level); oneway void updateByteCount(long inBytes, long outBytes); + + oneway void connectedVPN(String uuid); } diff --git a/main/src/main/java/de/blinkt/openvpn/OpenVPNTileService.java b/main/src/main/java/de/blinkt/openvpn/OpenVPNTileService.java index 3996f25e..ce14cc98 100644 --- a/main/src/main/java/de/blinkt/openvpn/OpenVPNTileService.java +++ b/main/src/main/java/de/blinkt/openvpn/OpenVPNTileService.java @@ -13,11 +13,13 @@ import android.content.Intent; import android.content.ServiceConnection; import android.os.Build; import android.os.IBinder; +import android.os.RemoteException; import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; import android.widget.Toast; import de.blinkt.openvpn.core.ConnectionStatus; +import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; import de.blinkt.openvpn.core.ProfileManager; import de.blinkt.openvpn.core.VpnStatus; @@ -57,10 +59,14 @@ public class OpenVPNTileService extends TileService implements VpnStatus.StateLi bindService(intent, new ServiceConnection() { @Override public void onServiceConnected(ComponentName componentName, IBinder binder) { - OpenVPNService service = ((OpenVPNService.LocalBinder) binder).getService(); + IOpenVPNServiceInternal service = IOpenVPNServiceInternal.Stub.asInterface(binder); - if (service != null && service.getManagement() != null) - service.getManagement().stopVPN(false); + if (service != null) + try { + service.stopVPN(false); + } catch (RemoteException e) { + VpnStatus.logException(e); + } unbindService(this); } @@ -119,7 +125,7 @@ public class OpenVPNTileService extends TileService implements VpnStatus.StateLi t.setState(Tile.STATE_INACTIVE); } } else { - vpn = ProfileManager.getLastConnectedVpn(); + vpn = ProfileManager.get(getBaseContext(), VpnStatus.getLastConnectedVPNProfile()); String name; if (vpn == null) name = "null?!"; @@ -129,11 +135,15 @@ public class OpenVPNTileService extends TileService implements VpnStatus.StateLi t.setState(Tile.STATE_ACTIVE); } - t.updateTile(); } @Override + public void setConnectedVPN(String uuid) { + + } + + @Override public void onStopListening() { VpnStatus.removeStateListener(this); super.onStopListening(); diff --git a/main/src/main/java/de/blinkt/openvpn/activities/DisconnectVPN.java b/main/src/main/java/de/blinkt/openvpn/activities/DisconnectVPN.java index f63f5ed2..c3a0072b 100644 --- a/main/src/main/java/de/blinkt/openvpn/activities/DisconnectVPN.java +++ b/main/src/main/java/de/blinkt/openvpn/activities/DisconnectVPN.java @@ -7,15 +7,17 @@ package de.blinkt.openvpn.activities; import android.app.Activity; import android.app.AlertDialog; -import android.content.*; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; import android.os.IBinder; -import android.os.Message; -import android.os.Messenger; import android.os.RemoteException; import de.blinkt.openvpn.LaunchVPN; import de.blinkt.openvpn.R; -import de.blinkt.openvpn.VpnProfile; +import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; import de.blinkt.openvpn.core.ProfileManager; import de.blinkt.openvpn.core.VpnStatus; @@ -24,7 +26,7 @@ import de.blinkt.openvpn.core.VpnStatus; * Created by arne on 13.10.13. */ public class DisconnectVPN extends Activity implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener { - private Messenger mMessenger; + private IOpenVPNServiceInternal mService; private ServiceConnection mConnection = new ServiceConnection() { @@ -32,13 +34,13 @@ public class DisconnectVPN extends Activity implements DialogInterface.OnClickLi @Override public void onServiceConnected(ComponentName className, IBinder service) { - mMessenger = new Messenger(service); + mService = IOpenVPNServiceInternal.Stub.asInterface(service); } @Override public void onServiceDisconnected(ComponentName arg0) { - mMessenger = null; + mService = null; } }; @@ -72,20 +74,18 @@ public class DisconnectVPN extends Activity implements DialogInterface.OnClickLi @Override public void onClick(DialogInterface dialog, int which) { - VpnProfile lastVPN = ProfileManager.getLastConnectedVpn(); if (which == DialogInterface.BUTTON_POSITIVE) { ProfileManager.setConntectedVpnProfileDisconnected(this); - if (mMessenger != null) { - Message msg = Message.obtain(null, OpenVPNService.DISCONNECT_VPN_MSG); + if (mService != null) { try { - mMessenger.send(msg); + mService.stopVPN(false); } catch (RemoteException e) { VpnStatus.logException(e); } } - } else if (which == DialogInterface.BUTTON_NEUTRAL && lastVPN !=null) { + } else if (which == DialogInterface.BUTTON_NEUTRAL) { Intent intent = new Intent(this, LaunchVPN.class); - intent.putExtra(LaunchVPN.EXTRA_KEY, lastVPN.getUUID().toString()); + intent.putExtra(LaunchVPN.EXTRA_KEY, VpnStatus.getLastConnectedVPNProfile()); intent.setAction(Intent.ACTION_MAIN); startActivity(intent); } diff --git a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java index ce72f346..6d7e9a4b 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java +++ b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java @@ -37,8 +37,8 @@ import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConfigParser;
import de.blinkt.openvpn.core.ConfigParser.ConfigParseError;
import de.blinkt.openvpn.core.ConnectionStatus;
+import de.blinkt.openvpn.core.IOpenVPNServiceInternal;
import de.blinkt.openvpn.core.OpenVPNService;
-import de.blinkt.openvpn.core.OpenVPNService.LocalBinder;
import de.blinkt.openvpn.core.ProfileManager;
import de.blinkt.openvpn.core.VPNLaunchHelper;
import de.blinkt.openvpn.core.VpnStatus;
@@ -52,7 +52,7 @@ public class ExternalOpenVPNService extends Service implements StateListener { final RemoteCallbackList<IOpenVPNStatusCallback> mCallbacks =
new RemoteCallbackList<>();
- private OpenVPNService mService;
+ private IOpenVPNServiceInternal mService;
private ExternalAppDatabase mExtAppDb;
@@ -63,8 +63,7 @@ public class ExternalOpenVPNService extends Service implements StateListener { public void onServiceConnected(ComponentName className,
IBinder service) {
// We've bound to LocalService, cast the IBinder and get LocalService instance
- LocalBinder binder = (LocalBinder) service;
- mService = binder.getService();
+ mService = (IOpenVPNServiceInternal) (service);
}
@Override
@@ -82,8 +81,12 @@ public class ExternalOpenVPNService extends Service implements StateListener { VpnProfile vp = ProfileManager.getLastConnectedVpn();
if (ProfileManager.isTempProfile()) {
if(intent.getPackage().equals(vp.mProfileCreator)) {
- if (mService != null && mService.getManagement() != null)
- mService.getManagement().stopVPN(false);
+ if (mService != null)
+ try {
+ mService.stopVPN(false);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
}
}
}
@@ -304,8 +307,8 @@ public class ExternalOpenVPNService extends Service implements StateListener { @Override
public void disconnect() throws RemoteException {
checkOpenVPNPermission();
- if (mService != null && mService.getManagement() != null)
- mService.getManagement().stopVPN(false);
+ if (mService != null)
+ mService.stopVPN(false);
}
@Override
@@ -347,9 +350,9 @@ public class ExternalOpenVPNService extends Service implements StateListener { public String state;
public String logmessage;
public ConnectionStatus level;
- public String vpnUUID;
+ String vpnUUID;
- public UpdateMessage(String state, String logmessage, ConnectionStatus level) {
+ UpdateMessage(String state, String logmessage, ConnectionStatus level) {
this.state = state;
this.logmessage = logmessage;
this.level = level;
@@ -367,6 +370,11 @@ public class ExternalOpenVPNService extends Service implements StateListener { }
+ @Override
+ public void setConnectedVPN(String uuid) {
+
+ }
+
private static final OpenVPNServiceHandler mHandler = new OpenVPNServiceHandler();
diff --git a/main/src/main/java/de/blinkt/openvpn/core/ICSOpenVPNApplication.java b/main/src/main/java/de/blinkt/openvpn/core/ICSOpenVPNApplication.java index 4b31180a..7d10063f 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/ICSOpenVPNApplication.java +++ b/main/src/main/java/de/blinkt/openvpn/core/ICSOpenVPNApplication.java @@ -24,10 +24,6 @@ public class ICSOpenVPNApplication extends Application { super.onCreate(); PRNGFixes.apply(); - if (BuildConfig.DEBUG) { - //ACRA.init(this); - } - VpnStatus.initLogCache(getApplicationContext().getCacheDir()); mStatus = new StatusListener(); diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 818ef30a..86a4043a 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -27,6 +27,7 @@ import android.os.Handler.Callback; import android.os.IBinder; import android.os.Message; import android.os.ParcelFileDescriptor; +import android.os.RemoteException; import android.preference.PreferenceManager; import android.system.OsConstants; import android.text.TextUtils; @@ -34,6 +35,7 @@ import android.util.Log; import android.widget.Toast; import java.io.IOException; +import java.lang.ref.WeakReference; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.Inet6Address; @@ -55,7 +57,7 @@ import static de.blinkt.openvpn.core.NetworkSpace.ipAddress; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT; -public class OpenVPNService extends VpnService implements StateListener, Callback, ByteCountListener { +public class OpenVPNService extends VpnService implements StateListener, Callback, ByteCountListener, IOpenVPNServiceInternal { public static final String START_SERVICE = "de.blinkt.openvpn.START_SERVICE"; public static final String START_SERVICE_STICKY = "de.blinkt.openvpn.START_SERVICE_STICKY"; public static final String ALWAYS_SHOW_NOTIFICATION = "de.blinkt.openvpn.NOTIFICATION_ALWAYS_VISIBLE"; @@ -63,7 +65,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac private static final String PAUSE_VPN = "de.blinkt.openvpn.PAUSE_VPN"; private static final String RESUME_VPN = "de.blinkt.openvpn.RESUME_VPN"; private static final int OPENVPN_STATUS = 1; - public static final int DISCONNECT_VPN_MSG = 100; private static boolean mNotificationAlwaysVisible = false; private final Vector<String> mDnslist = new Vector<>(); private final NetworkSpace mRoutes = new NetworkSpace(); @@ -88,6 +89,24 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac private Runnable mOpenVPNThread; private static Class mNotificationActivityClass; + private final IBinder mBinder = new IOpenVPNServiceInternal.Stub() { + + @Override + public boolean protect(int fd) throws RemoteException { + return OpenVPNService.this.protect(fd); + } + + @Override + public void userPause(boolean shouldbePaused) throws RemoteException { + OpenVPNService.this.userPause(shouldbePaused); + } + + @Override + public boolean stopVPN(boolean replaceConnection) throws RemoteException { + return OpenVPNService.this.stopVPN(replaceConnection); + } + }; + // From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java public static String humanReadableByteCount(long bytes, boolean mbit) { if (mbit) @@ -340,6 +359,14 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac } @Override + public boolean stopVPN(boolean replaceConnection) throws RemoteException { + if(getManagement() !=null) + return getManagement().stopVPN(replaceConnection); + else + return false; + } + + @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null && intent.getBooleanExtra(ALWAYS_SHOW_NOTIFICATION, false)) @@ -405,6 +432,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac ProfileManager.setConnectedVpnProfile(this, mProfile); + VpnStatus.setConnectedVPNProfile(mProfile.getUUIDString()); /* TODO: At the moment we have no way to handle asynchronous PW input * Fixing will also allow to handle challenge/response authentication */ if (mProfile.needUserPWInput(true) != 0) @@ -542,6 +570,16 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac } @Override + public IBinder asBinder() { + return mBinder; + } + + @Override + public void onCreate() { + super.onCreate(); + } + + @Override public void onDestroy() { synchronized (mProcessLock) { if (mProcessThread != null) { @@ -555,7 +593,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac // Just in case unregister for state VpnStatus.removeStateListener(this); VpnStatus.flushLog(); - } private String getTunConfigString() { @@ -969,6 +1006,10 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac } } + @Override + public void setConnectedVPN(String uuid) { + } + private void doSendBroadcast(String state, ConnectionStatus level) { Intent vpnstatus = new Intent(); vpnstatus.setAction("de.blinkt.openvpn.VPN_STATUS"); diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNStatusService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNStatusService.java index f84445ad..4b32d9fa 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNStatusService.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNStatusService.java @@ -104,11 +104,18 @@ public class OpenVPNStatusService extends Service implements VpnStatus.LogListen msg.sendToTarget(); } + @Override + public void setConnectedVPN(String uuid) { + Message msg = mHandler.obtainMessage(SEND_NEW_CONNECTED_VPN, uuid); + msg.sendToTarget(); + } + private static final OpenVPNStatusHandler mHandler = new OpenVPNStatusHandler(); private static final int SEND_NEW_LOGITEM = 100; private static final int SEND_NEW_STATE = 101; private static final int SEND_NEW_BYTECOUNT = 102; + private static final int SEND_NEW_CONNECTED_VPN = 103; static class OpenVPNStatusHandler extends Handler { WeakReference<OpenVPNStatusService> service = null; @@ -142,6 +149,10 @@ public class OpenVPNStatusService extends Service implements VpnStatus.LogListen case SEND_NEW_STATE: sendUpdate(broadcastItem, (UpdateMessage) msg.obj); break; + + case SEND_NEW_CONNECTED_VPN: + broadcastItem.connectedVPN((String) msg.obj); + break; } } catch (RemoteException e) { // The RemoteCallbackList will take care of removing diff --git a/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java b/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java index d0f845ee..d6660147 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java +++ b/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java @@ -72,6 +72,11 @@ public class StatusListener { public void updateByteCount(long inBytes, long outBytes) throws RemoteException { VpnStatus.updateByteCount(inBytes, outBytes); } + + @Override + public void connectedVPN(String uuid) throws RemoteException { + VpnStatus.setConnectedVPNProfile(uuid); + } }; } diff --git a/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java index 5f6a30d6..db0d10bd 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java +++ b/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java @@ -18,6 +18,7 @@ import java.util.Locale; import java.util.Vector; import de.blinkt.openvpn.R; +import de.blinkt.openvpn.VpnProfile; public class VpnStatus { @@ -37,6 +38,8 @@ public class VpnStatus { private static long mlastByteCount[] = {0, 0, 0, 0}; private static HandlerThread mHandlerThread; + private static String mLastConnectedVPNUUID; + public static void logException(LogLevel ll, String context, Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); @@ -123,6 +126,18 @@ public class VpnStatus { mLogFileHandler.sendEmptyMessage(LogFileHandler.FLUSH_TO_DISK); } + public static void setConnectedVPNProfile(String uuid) { + mLastConnectedVPNUUID = uuid; + for (StateListener sl: stateListener) + sl.setConnectedVPN(uuid); + } + + + public static String getLastConnectedVPNProfile() + { + return mLastConnectedVPNUUID; + } + public enum LogLevel { INFO(2), @@ -158,10 +173,10 @@ public class VpnStatus { } // keytool -printcert -jarfile de.blinkt.openvpn_85.apk - public static final byte[] officalkey = {-58, -42, -44, -106, 90, -88, -87, -88, -52, -124, 84, 117, 66, 79, -112, -111, -46, 86, -37, 109}; - public static final byte[] officaldebugkey = {-99, -69, 45, 71, 114, -116, 82, 66, -99, -122, 50, -70, -56, -111, 98, -35, -65, 105, 82, 43}; - public static final byte[] amazonkey = {-116, -115, -118, -89, -116, -112, 120, 55, 79, -8, -119, -23, 106, -114, -85, -56, -4, 105, 26, -57}; - public static final byte[] fdroidkey = {-92, 111, -42, -46, 123, -96, -60, 79, -27, -31, 49, 103, 11, -54, -68, -27, 17, 2, 121, 104}; + static final byte[] officalkey = {-58, -42, -44, -106, 90, -88, -87, -88, -52, -124, 84, 117, 66, 79, -112, -111, -46, 86, -37, 109}; + static final byte[] officaldebugkey = {-99, -69, 45, 71, 114, -116, 82, 66, -99, -122, 50, -70, -56, -111, 98, -35, -65, 105, 82, 43}; + static final byte[] amazonkey = {-116, -115, -118, -89, -116, -112, 120, 55, 79, -8, -119, -23, 106, -114, -85, -56, -4, 105, 26, -57}; + static final byte[] fdroidkey = {-92, 111, -42, -46, 123, -96, -60, 79, -27, -31, 49, 103, 11, -54, -68, -27, 17, 2, 121, 104}; private static ConnectionStatus mLastLevel = ConnectionStatus.LEVEL_NOTCONNECTED; @@ -186,6 +201,8 @@ public class VpnStatus { public interface StateListener { void updateState(String state, String logmessage, int localizedResId, ConnectionStatus level); + + void setConnectedVPN(String uuid); } public interface ByteCountListener { diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java b/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java index 067c7390..d704e61e 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java @@ -431,7 +431,7 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar. } else if (item.getItemId() == R.id.send) { ladapter.shareLog(); } else if (item.getItemId() == R.id.edit_vpn) { - VpnProfile lastConnectedprofile = ProfileManager.getLastConnectedVpn(); + VpnProfile lastConnectedprofile = ProfileManager.get(getActivity(), VpnStatus.getLastConnectedVPNProfile()); if (lastConnectedprofile != null) { Intent vprefintent = new Intent(getActivity(), VPNPreferences.class) @@ -674,6 +674,10 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar. } } + @Override + public void setConnectedVPN(String uuid) { + } + @Override public void onDestroy() { diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java index de41d509..2aaf81c6 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java @@ -66,8 +66,11 @@ public class VPNProfileList extends ListFragment implements OnClickListener, Vpn }); } + @Override + public void setConnectedVPN(String uuid) { + } - class VPNArrayAdapter extends ArrayAdapter<VpnProfile> { + private class VPNArrayAdapter extends ArrayAdapter<VpnProfile> { public VPNArrayAdapter(Context context, int resource, int textViewResourceId) { @@ -99,7 +102,7 @@ public class VPNProfileList extends ListFragment implements OnClickListener, Vpn }); TextView subtitle = (TextView) v.findViewById(R.id.vpn_item_subtitle); - if (ProfileManager.getLastConnectedVpn() == profile) { + if (profile.getUUIDString().equals(VpnStatus.getLastConnectedVPNProfile())) { subtitle.setText(mLastStatusMessage); subtitle.setVisibility(View.VISIBLE); } else { @@ -113,7 +116,7 @@ public class VPNProfileList extends ListFragment implements OnClickListener, Vpn } private void startOrStopVPN(VpnProfile profile) { - if (VpnStatus.isVPNActive() && ProfileManager.getLastConnectedVpn() == profile) { + if (VpnStatus.isVPNActive() && profile.getUUIDString().equals(VpnStatus.getLastConnectedVPNProfile())) { Intent disconnectVPN = new Intent(getActivity(), DisconnectVPN.class); startActivity(disconnectVPN); } else { |