From bfb8c5672975ae6c11bf251bd2d2c308794dab73 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 8 Apr 2013 13:43:52 +0200 Subject: add LastConnectedUuid to state messages. --- src/de/blinkt/openvpn/api/ExternalOpenVPNService.java | 16 ++++++++++------ src/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/de/blinkt/openvpn/api') diff --git a/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java b/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java index cab00599..2eee8d82 100644 --- a/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java +++ b/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java @@ -190,7 +190,7 @@ public class ExternalOpenVPNService extends Service implements StateListener { checkOpenVPNPermission(); if (cb != null) { - cb.newStatus(mMostRecentState.state, + cb.newStatus(mMostRecentState.vpnUUID, mMostRecentState.state, mMostRecentState.logmessage, mMostRecentState.level.name()); mCallbacks.register(cb); } @@ -234,6 +234,7 @@ public class ExternalOpenVPNService extends Service implements StateListener { public String state; public String logmessage; public ConnectionStatus level; + public String vpnUUID; public UpdateMessage(String state, String logmessage, ConnectionStatus level) { this.state = state; @@ -245,14 +246,17 @@ public class ExternalOpenVPNService extends Service implements StateListener { @Override public void updateState (String state, String logmessage, int resid, ConnectionStatus level) { mMostRecentState = new UpdateMessage(state, logmessage, level); + if (ProfileManager.getLastConnectedVpn()!=null) + mMostRecentState.vpnUUID = ProfileManager.getLastConnectedVpn().getUUIDString(); + Message msg = mHandler.obtainMessage(SEND_TOALL, mMostRecentState); msg.sendToTarget(); - + } private static final OpenVPNServiceHandler mHandler = new OpenVPNServiceHandler(); - - + + static class OpenVPNServiceHandler extends Handler { WeakReference service= null; @@ -260,7 +264,7 @@ public class ExternalOpenVPNService extends Service implements StateListener { { service = new WeakReference(eos); } - + @Override public void handleMessage(Message msg) { RemoteCallbackList callbacks; @@ -290,7 +294,7 @@ public class ExternalOpenVPNService extends Service implements StateListener { private void sendUpdate(IOpenVPNStatusCallback broadcastItem, UpdateMessage um) throws RemoteException { - broadcastItem.newStatus(um.state, um.logmessage, um.level.name()); + broadcastItem.newStatus(um.vpnUUID, um.state, um.logmessage, um.level.name()); } }; diff --git a/src/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl b/src/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl index e1903485..1dfa1381 100644 --- a/src/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl +++ b/src/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl @@ -9,5 +9,5 @@ oneway interface IOpenVPNStatusCallback { /** * Called when the service has a new status for you. */ - void newStatus(String state, String message, String level); + void newStatus(String uuid, String state, String message, String level); } -- cgit v1.2.3