0
0
mirror of https://github.com/schwabe/ics-openvpn.git synced 2024-09-20 12:02:28 +02:00

Improve compatibility with API 29

This commit is contained in:
Arne Schwabe 2019-04-02 09:52:38 +03:00
parent 3e9c7cacd7
commit 4c31594443
7 changed files with 60 additions and 13 deletions

View File

@ -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" />

View File

@ -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)

View File

@ -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};

View File

@ -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(", ")));
}
}

View File

@ -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>

View File

@ -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>

View File

@ -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>