diff options
author | Arne Schwabe <arne@rfc2549.org> | 2016-02-29 14:37:51 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2016-02-29 14:37:51 +0100 |
commit | 5e078020bfc7a49c8d6011c3c4c184d5593df40a (patch) | |
tree | 18bb17fb52d305d708982be99a58df9e7c71370f /main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java | |
parent | b3e20603bb687da8a348f1c73d9645f86d159483 (diff) |
Refactor the way the VPN is launched, move more of the responsibility to the OpenVPNService.
Diffstat (limited to 'main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java b/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java index 7d0f6578..564ee1a4 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java +++ b/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java @@ -27,7 +27,7 @@ public class VPNLaunchHelper { - static private String writeMiniVPN(Context context) { + private static String writeMiniVPN(Context context) { String[] abis; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) abis = getSupportedABIsLollipop(); @@ -73,12 +73,18 @@ public class VPNLaunchHelper { } - public static String[] buildOpenvpnArgv(Context c) { + static String[] buildOpenvpnArgv(Context c) { Vector<String> args = new Vector<>(); + String binaryName = writeMiniVPN(c); // Add fixed paramenters //args.add("/data/data/de.blinkt.openvpn/lib/openvpn"); - args.add(writeMiniVPN(c)); + if(binaryName==null) { + VpnStatus.logError("Error writing minivpn binary"); + return null; + } + + args.add(binaryName); args.add("--config"); args.add(getConfigFilePath(c)); @@ -126,14 +132,6 @@ public class VPNLaunchHelper { public static void startOpenVpn(VpnProfile startprofile, Context context) { - VpnStatus.logInfo(R.string.building_configration); - VpnStatus.updateStateString("VPN_GENERATE_CONFIG", "", R.string.building_configration, VpnStatus.ConnectionStatus.LEVEL_START); - if(writeMiniVPN(context)==null) { - VpnStatus.logError("Error writing minivpn binary"); - return; - } - - Intent startVPN = startprofile.prepareStartService(context); if(startVPN!=null) context.startService(startVPN); |