From e827c55cdd14588585b1d12e4f8cba0ffb69381d Mon Sep 17 00:00:00 2001
From: Arne Schwabe <arne@rfc2549.org>
Date: Sun, 1 Dec 2013 14:14:24 +0100
Subject: Implementing user pause/resume from the external API

---
 src/de/blinkt/openvpn/api/ExternalOpenVPNService.java | 15 +++++++++++++++
 src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl     |  6 ++++++
 2 files changed, 21 insertions(+)

(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 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
-- 
cgit v1.2.3