summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/de/blinkt/openvpn/api/ExternalOpenVPNService.java15
-rw-r--r--src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl6
-rw-r--r--src/de/blinkt/openvpn/core/OpenVpnService.java6
3 files changed, 27 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java b/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java
index 34b61325..765bc23d 100644
--- a/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java
+++ b/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java
@@ -217,6 +217,21 @@ public class ExternalOpenVPNService extends Service implements StateListener {
if (mService != null && mService.getManagement() != null)
mService.getManagement().stopVPN();
}
+
+ @Override
+ public void pause() throws RemoteException {
+ checkOpenVPNPermission();
+ if (mService != null)
+ mService.userPause(true);
+ }
+
+ @Override
+ public void resume() throws RemoteException {
+ checkOpenVPNPermission();
+ if (mService != null)
+ mService.userPause(false);
+
+ }
};
diff --git a/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl b/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl
index 6c1624fa..794e3aad 100644
--- a/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl
+++ b/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl
@@ -30,6 +30,12 @@ interface IOpenVPNAPIService {
/* Disconnect the VPN */
void disconnect();
+
+ /* Pause the VPN (same as using the pause feature in the notifcation bar) */
+ void pause();
+
+ /* Resume the VPN (same as using the pause feature in the notifcation bar) */
+ void resume();
/**
* Registers to receive OpenVPN Status Updates
diff --git a/src/de/blinkt/openvpn/core/OpenVpnService.java b/src/de/blinkt/openvpn/core/OpenVpnService.java
index ab21fc1b..3a6cc802 100644
--- a/src/de/blinkt/openvpn/core/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/core/OpenVpnService.java
@@ -256,6 +256,12 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
mDeviceStateReceiver = null;
}
+ public void userPause (boolean shouldBePaused)
+ {
+ if (mDeviceStateReceiver != null)
+ mDeviceStateReceiver.userPause(shouldBePaused);
+ }
+
@Override
public int onStartCommand(Intent intent, int flags, int startId) {