From 4c31594443fc630b86c7d75f73da2004f7bfdc09 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 2 Apr 2019 09:52:38 +0300 Subject: Improve compatibility with API 29 --- main/src/main/AndroidManifest.xml | 42 ++++++++++++++++------ main/src/main/cpp/CMakeLists.txt | 4 +++ .../de/blinkt/openvpn/core/VPNLaunchHelper.java | 5 ++- .../blinkt/openvpn/fragments/GeneralSettings.java | 2 +- main/src/main/res/values-v29/bools.xml | 9 +++++ main/src/main/res/values/bools.xml | 9 +++++ main/src/main/res/values/strings.xml | 2 +- 7 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 main/src/main/res/values-v29/bools.xml create mode 100644 main/src/main/res/values/bools.xml diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml index 88182d3c..92120282 100644 --- a/main/src/main/AndroidManifest.xml +++ b/main/src/main/AndroidManifest.xml @@ -23,12 +23,12 @@ android:required="false" /> - - + - + @@ -161,7 +162,6 @@ - @@ -171,6 +171,29 @@ + // https://commonsware.com/blog/2019/03/27/death-external-storage-stay-away-files.html + + + + + + + + + + + + + + + + /> + + + - + + diff --git a/main/src/main/cpp/CMakeLists.txt b/main/src/main/cpp/CMakeLists.txt index 8b22a82a..7f383016 100644 --- a/main/src/main/cpp/CMakeLists.txt +++ b/main/src/main/cpp/CMakeLists.txt @@ -218,6 +218,10 @@ target_compile_definitions(openvpn PRIVATE target_link_libraries(openvpn crypto ssl lzo) endif() +add_executable(libovpnexec.so minivpn/minivpn.c) +target_compile_options(libovpnexec.so PRIVATE -fPIE) +target_link_libraries(libovpnexec.so PRIVATE openvpn -fPIE -pie) + add_executable(pie_openvpn.${ANDROID_ABI} minivpn/minivpn.c) target_compile_options(pie_openvpn.${ANDROID_ABI} PRIVATE -fPIE) target_link_libraries(pie_openvpn.${ANDROID_ABI} PRIVATE openvpn -fPIE -pie) 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 84d6591a..7c1722e0 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java +++ b/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java @@ -27,6 +27,10 @@ public class VPNLaunchHelper { private static String writeMiniVPN(Context context) { + String nativeAPI = NativeUtils.getNativeAPI(); + /* Q does not allow executing binaries written in temp directory anymore */ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) + return new File(context.getApplicationInfo().nativeLibraryDir, "libovpnexec.so").getPath(); String[] abis; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) abis = getSupportedABIsLollipop(); @@ -34,7 +38,6 @@ public class VPNLaunchHelper { //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}; diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java b/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java index 1c20e167..48bae757 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java @@ -125,7 +125,7 @@ public class GeneralSettings extends PreferenceFragment implements OnPreferenceC clearapi.setSummary(R.string.no_external_app_allowed); } else { clearapi.setEnabled(true); - clearapi.setSummary(getString(R.string.allowed_apps,getExtAppList(", "))); + clearapi.setSummary(getString(R.string.allowed_apps, getExtAppList(", "))); } } diff --git a/main/src/main/res/values-v29/bools.xml b/main/src/main/res/values-v29/bools.xml new file mode 100644 index 00000000..356ee6ed --- /dev/null +++ b/main/src/main/res/values-v29/bools.xml @@ -0,0 +1,9 @@ + + + + + false + \ No newline at end of file diff --git a/main/src/main/res/values/bools.xml b/main/src/main/res/values/bools.xml new file mode 100644 index 00000000..d38f0c84 --- /dev/null +++ b/main/src/main/res/values/bools.xml @@ -0,0 +1,9 @@ + + + + + true + \ No newline at end of file diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index 432ad5f4..ab8c57af 100755 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -117,7 +117,7 @@ Tap Mode Tap Mode is not possible with the non root VPN API. Therefore this application cannot provide tap support Again? Are you kidding? No, tap mode is really not supported and sending more mail asking if it will be supported will not help. - A third time? Actually, one could write a a tap emulator based on tun that would add layer2 information on send and strip layer2 information on receive. But this tap emulator would also have to implement ARP and possibly a DHCP client. I am not aware of anybody doing any work in this direction. Contact me if you want to start coding on this. + A third time? Actually, one could write a tap emulator based on tun that would add layer2 information on send and strip layer2 information on receive. But this tap emulator would also have to implement ARP and possibly a DHCP client. I am not aware of anybody doing any work in this direction. Contact me if you want to start coding on this. FAQ Copying log entries To copy a single log entry press and hold on the log entry. To copy/send the whole log use the Send Log option. Use the hardware menu button, if the button is not visible in the GUI. -- cgit v1.2.3