diff options
| author | Arne Schwabe <arne@rfc2549.org> | 2019-04-02 09:52:38 +0300 | 
|---|---|---|
| committer | Arne Schwabe <arne@rfc2549.org> | 2019-08-05 16:01:34 +0200 | 
| commit | 4c31594443fc630b86c7d75f73da2004f7bfdc09 (patch) | |
| tree | 357bcb7387202aa8c14af7ccd2c292fcecca7571 /main/src | |
| parent | 3e9c7cacd789c6861558afc040de94e6df534f8f (diff) | |
Improve compatibility with API 29
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/main/AndroidManifest.xml | 42 | ||||
| -rw-r--r-- | main/src/main/cpp/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java | 5 | ||||
| -rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java | 2 | ||||
| -rw-r--r-- | main/src/main/res/values-v29/bools.xml | 9 | ||||
| -rw-r--r-- | main/src/main/res/values/bools.xml | 9 | ||||
| -rwxr-xr-x | main/src/main/res/values/strings.xml | 2 | 
7 files changed, 60 insertions, 13 deletions
| 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" /> -      <application          android:name=".core.ICSOpenVPNApplication"          android:allowBackup="true"          android:appCategory="productivity"          android:banner="@mipmap/banner_tv" +        android:extractNativeLibs="true"          android:icon="@mipmap/ic_launcher"          android:label="@string/app"          android:supportsRtl="true" @@ -36,8 +36,9 @@          tools:ignore="UnusedAttribute"> -        <meta-data android:name="android.content.APP_RESTRICTIONS" -                   android:resource="@xml/app_restrictions" /> +        <meta-data +            android:name="android.content.APP_RESTRICTIONS" +            android:resource="@xml/app_restrictions" />          <activity              android:name=".activities.VPNPreferences" @@ -67,7 +68,7 @@                  <category android:name="android.intent.category.LAUNCHER" />              </intent-filter>              <intent-filter> -                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/> +                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />              </intent-filter>          </activity> @@ -161,7 +162,6 @@                  <category android:name="android.intent.category.DEFAULT" />                  <data android:mimeType="*/*" /> -                <data android:scheme="file" />                  <data android:scheme="content" />                  <data android:host="*" />                  <data android:pathPattern=".*..*..*..*..*.ovpn" /> @@ -171,6 +171,29 @@                  <data android:pathPattern=".*.ovpn" />              </intent-filter>          </activity> +        // https://commonsware.com/blog/2019/03/27/death-external-storage-stay-away-files.html +        <activity-alias +            android:enabled="@bool/supportFileScheme" +            android:name=".activities.ConfigConverterFile" +            android:targetActivity=".activities.ConfigConverter"> +            <intent-filter> +                <action android:name="android.intent.action.VIEW" /> + +                <category android:name="android.intent.category.BROWSABLE" /> +                <category android:name="android.intent.category.DEFAULT" /> + +                <data android:mimeType="*/*" /> +                <data android:scheme="file" /> +                <data android:host="*" /> +                <data android:pathPattern=".*..*..*..*..*.ovpn" /> +                <data android:pathPattern=".*..*..*..*.ovpn" /> +                <data android:pathPattern=".*..*..*.ovpn" /> +                <data android:pathPattern=".*..*.ovpn" /> +                <data android:pathPattern=".*.ovpn" /> +                /> +            </intent-filter> +        </activity-alias> +          <activity              android:name=".LaunchVPN"              android:autoRemoveFromRecents="true" @@ -234,17 +257,16 @@                  android:name="android.support.PARENT_ACTIVITY"                  android:value="de.blinkt.openvpn.activities.MainActivity" />          </activity> -        <activity -            android:name=".api.RemoteAction" -            /> +        <activity android:name=".api.RemoteAction" /> +          <activity-alias -            android:exported="true"              android:name=".api.DisconnectVPN" +            android:exported="true"              android:targetActivity=".api.RemoteAction" />          <activity-alias -            android:exported="true"              android:name=".api.ConnectVPN" +            android:exported="true"              android:targetActivity=".api.RemoteAction" /> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +  ~ Copyright (c) 2012-2019 Arne Schwabe +  ~ Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt +  --> + +<resources> +    <bool name="supportFileScheme">false</bool> +</resources>
\ 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +  ~ Copyright (c) 2012-2019 Arne Schwabe +  ~ Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt +  --> + +<resources> +    <bool name="supportFileScheme">true</bool> +</resources>
\ 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 @@      <string name="tap_mode">Tap Mode</string>      <string name="faq_tap_mode">Tap Mode is not possible with the non root VPN API. Therefore this application cannot provide tap support</string>      <string name="tap_faq2">Again? Are you kidding? No, tap mode is really not supported and sending more mail asking if it will be supported will not help.</string> -    <string name="tap_faq3">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.</string> +    <string name="tap_faq3">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.</string>      <string name="faq">FAQ</string>      <string name="copying_log_entries">Copying log entries</string>      <string name="faq_copying">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.</string> | 
