diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/build.gradle | 1 | ||||
-rw-r--r-- | main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl | 3 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java | 37 |
3 files changed, 29 insertions, 12 deletions
diff --git a/main/build.gradle b/main/build.gradle index 58565e73..da0881e6 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -10,7 +10,6 @@ dependencies { compile 'com.intellij:annotations:12.0' compile 'com.android.support:cardview-v7:21.0.+' compile 'com.android.support:recyclerview-v7:21.0.+' - // compile 'ch.acra:acra:4.5.0' } diff --git a/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl b/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl index 794e3aad..f1c108ea 100644 --- a/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl +++ b/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl @@ -14,6 +14,9 @@ interface IOpenVPNAPIService { /** Use a profile with all certificates etc. embedded */
boolean addVPNProfile (String name, String config);
+
+ /** Remove a profile by UUID */
+ void removeProfile (String profileUUID);
/** start a profile using an config */
void startVPN (String inlineconfig);
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 4b07c7ab..06b116fe 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java +++ b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java @@ -5,12 +5,6 @@ package de.blinkt.openvpn.api;
-import java.io.IOException;
-import java.io.StringReader;
-import java.lang.ref.WeakReference;
-import java.util.LinkedList;
-import java.util.List;
-
import android.annotation.TargetApi;
import android.app.Service;
import android.content.ComponentName;
@@ -21,20 +15,31 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.VpnService;
-import android.os.*;
+import android.os.Binder;
+import android.os.Build;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.lang.ref.WeakReference;
+import java.util.LinkedList;
+import java.util.List;
-import de.blinkt.openvpn.LaunchVPN;
import de.blinkt.openvpn.R;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConfigParser;
import de.blinkt.openvpn.core.ConfigParser.ConfigParseError;
import de.blinkt.openvpn.core.OpenVPNService;
-import de.blinkt.openvpn.core.VpnStatus;
-import de.blinkt.openvpn.core.VpnStatus.ConnectionStatus;
-import de.blinkt.openvpn.core.VpnStatus.StateListener;
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;
+import de.blinkt.openvpn.core.VpnStatus.ConnectionStatus;
+import de.blinkt.openvpn.core.VpnStatus.StateListener;
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
public class ExternalOpenVPNService extends Service implements StateListener {
@@ -161,6 +166,8 @@ public class ExternalOpenVPNService extends Service implements StateListener { }
}
+
+
@Override
public boolean addVPNProfile(String name, String config) throws RemoteException {
checkOpenVPNPermission();
@@ -183,6 +190,14 @@ public class ExternalOpenVPNService extends Service implements StateListener { return true;
}
+ @Override
+ public void removeProfile(String profileUUID) throws RemoteException {
+ checkOpenVPNPermission();
+ ProfileManager pm = ProfileManager.getInstance(getBaseContext());
+ VpnProfile vp = ProfileManager.get(getBaseContext(), profileUUID);
+ pm.removeProfile(ExternalOpenVPNService.this, vp);
+ }
+
@Override
public Intent prepare(String packagename) {
|