Android service issue fixed - VPN is keep running when connected and ui closed
This commit is contained in:
parent
505c9c6218
commit
b63bf2465f
3 changed files with 27 additions and 46 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<manifest package="org.amnezia.vpn" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
|
<manifest package="org.amnezia.vpn" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
|
|
||||||
|
|
@ -15,27 +15,15 @@
|
||||||
<!-- %%INSERT_FEATURES -->
|
<!-- %%INSERT_FEATURES -->
|
||||||
|
|
||||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||||
<application
|
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true" android:icon="@drawable/icon">
|
||||||
android:hardwareAccelerated="true"
|
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop" android:theme="@style/splashScreenTheme">
|
||||||
android:name="org.qtproject.qt5.android.bindings.QtApplication"
|
|
||||||
android:label="-- %%INSERT_APP_NAME%% --"
|
|
||||||
android:extractNativeLibs="true"
|
|
||||||
android:icon="@drawable/icon">
|
|
||||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
|
|
||||||
android:name="org.qtproject.qt5.android.bindings.QtActivity"
|
|
||||||
|
|
||||||
android:label="-- %%INSERT_APP_NAME%% --"
|
|
||||||
android:screenOrientation="unspecified"
|
|
||||||
android:launchMode="singleTop">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!-- Application arguments -->
|
<!-- Application arguments -->
|
||||||
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
|
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
|
||||||
<!-- Application arguments -->
|
<!-- Application arguments -->
|
||||||
|
|
||||||
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
|
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
|
||||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||||
|
|
@ -43,7 +31,6 @@
|
||||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||||
<!-- Deploy Qt libs as part of package -->
|
<!-- Deploy Qt libs as part of package -->
|
||||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||||
|
|
||||||
<!-- Run with local libs -->
|
<!-- Run with local libs -->
|
||||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||||
|
|
@ -58,7 +45,6 @@
|
||||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||||
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
|
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
|
||||||
<!-- Messages maps -->
|
<!-- Messages maps -->
|
||||||
|
|
||||||
<!-- Splash screen -->
|
<!-- Splash screen -->
|
||||||
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
|
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
|
||||||
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
|
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
|
||||||
|
|
@ -69,7 +55,6 @@
|
||||||
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
||||||
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
|
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
|
||||||
<!-- Splash screen -->
|
<!-- Splash screen -->
|
||||||
|
|
||||||
<!-- Background running -->
|
<!-- Background running -->
|
||||||
<!-- Warning: changing this value to true may cause unexpected crashes if the
|
<!-- Warning: changing this value to true may cause unexpected crashes if the
|
||||||
application still try to draw after
|
application still try to draw after
|
||||||
|
|
@ -77,11 +62,9 @@
|
||||||
signal is sent! -->
|
signal is sent! -->
|
||||||
<meta-data android:name="android.app.background_running" android:value="false"/>
|
<meta-data android:name="android.app.background_running" android:value="false"/>
|
||||||
<!-- Background running -->
|
<!-- Background running -->
|
||||||
|
|
||||||
<!-- auto screen scale factor -->
|
<!-- auto screen scale factor -->
|
||||||
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
|
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
|
||||||
<!-- auto screen scale factor -->
|
<!-- auto screen scale factor -->
|
||||||
|
|
||||||
<!-- extract android style -->
|
<!-- extract android style -->
|
||||||
<!-- available android:values :
|
<!-- available android:values :
|
||||||
* default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
|
* default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
|
||||||
|
|
@ -92,24 +75,19 @@
|
||||||
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
|
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
|
||||||
<!-- extract android style -->
|
<!-- extract android style -->
|
||||||
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splashscreen"/>
|
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splashscreen"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<service android:name=".VPNService"
|
<service android:name=".VPNService"
|
||||||
|
android:process=":QtOnlyProcess"
|
||||||
android:permission="android.permission.BIND_VPN_SERVICE">
|
android:permission="android.permission.BIND_VPN_SERVICE">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.net.VpnService"/>
|
<action android:name="android.net.VpnService"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<service android:name="org.amnezia.vpn.qt.VPNPermissionHelper"
|
<service android:name="org.mozilla.firefox.vpn.qt.VPNPermissionHelper"
|
||||||
|
android:permission="android.permission.BIND_VPN_SERVICE">
|
||||||
android:permission="android.permission.BIND_VPN_SERVICE">
|
</service>
|
||||||
</service>
|
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@ class VPNService : android.net.VpnService() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
NotificationUtil.show(this) // Go foreground
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,8 +403,6 @@ class VPNService : android.net.VpnService() {
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
.putString("lastConf", mConfig.toString())
|
.putString("lastConf", mConfig.toString())
|
||||||
.apply()
|
.apply()
|
||||||
|
|
||||||
NotificationUtil.show(this) // Go foreground
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QZXing>
|
//#include <QZXing>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include "QZXing.h"
|
||||||
|
#include "QZXingImageProvider.h"
|
||||||
|
#include "QZXingFilter.h"
|
||||||
|
|
||||||
#include "ShareConnectionLogic.h"
|
#include "ShareConnectionLogic.h"
|
||||||
|
|
||||||
#include "configurators/cloak_configurator.h"
|
#include "configurators/cloak_configurator.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue