summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java b/app/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java
index 47cb633c..f2cf8cec 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2014 Arne Schwabe
+ * Copyright (c) 2012-2016 Arne Schwabe
* Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt
*/
@@ -14,14 +14,15 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Arrays;
import java.util.Vector;
import se.leap.bitmaskclient.R;
import de.blinkt.openvpn.VpnProfile;
public class VPNLaunchHelper {
- private static final String MININONPIEVPN = "nopievpn";
- private static final String MINIPIEVPN = "pievpn";
+ private static final String MININONPIEVPN = "nopie_openvpn";
+ private static final String MINIPIEVPN = "pie_openvpn";
private static final String OVPNCONFIGFILE = "android.conf";
@@ -29,15 +30,22 @@ public class VPNLaunchHelper {
static private String writeMiniVPN(Context context) {
String[] abis;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
- abis = getSupportedAbisLollipop();
+ abis = getSupportedABIsLollipop();
else
+ //noinspection deprecation
abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};
+ String nativeAPI = NativeUtils.getNativeAPI();
+ if (!nativeAPI.equals(abis[0])) {
+ VpnStatus.logWarning(R.string.abi_mismatch, Arrays.toString(abis), nativeAPI);
+ abis = new String[] {nativeAPI};
+ }
+
for (String abi: abis) {
- File mvpnout = new File(context.getCacheDir(), getMiniVPNExecutableName() + "." + abi);
- if ((mvpnout.exists() && mvpnout.canExecute()) || writeMiniVPNBinary(context, abi, mvpnout)) {
- return mvpnout.getPath();
+ File vpnExecutable = new File(context.getCacheDir(), getMiniVPNExecutableName() + "." + abi);
+ if ((vpnExecutable.exists() && vpnExecutable.canExecute()) || writeMiniVPNBinary(context, abi, vpnExecutable)) {
+ return vpnExecutable.getPath();
}
}
@@ -45,7 +53,7 @@ public class VPNLaunchHelper {
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
- private static String[] getSupportedAbisLollipop() {
+ private static String[] getSupportedABIsLollipop() {
return Build.SUPPORTED_ABIS;
}
@@ -118,12 +126,13 @@ public class VPNLaunchHelper {
public static void startOpenVpn(VpnProfile startprofile, Context context) {
- if(writeMiniVPN(context)==null) {
+ 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;
}
- VpnStatus.logInfo(R.string.building_configration);
Intent startVPN = startprofile.prepareStartService(context);
if(startVPN!=null)