Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android refactoring #452

Merged
merged 58 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
fcabf08
Update gradle, fix gradlew.bat crlf
albexk Nov 11, 2023
e1eec55
Refactoring build
albexk Nov 14, 2023
06776eb
Fix errors
albexk Nov 14, 2023
d77f3ec
Fix build error
albexk Nov 15, 2023
4e5f2f4
Detach shadowsocks module
albexk Nov 15, 2023
2fde47a
Move qt binding java code to a separate module
albexk Nov 15, 2023
f1c9704
Create utils module, move Log class there
albexk Nov 16, 2023
617cdf1
Log class refactoring
albexk Nov 16, 2023
bc68c48
Update to qt 6.6.0
albexk Nov 16, 2023
5a5ea4a
Android project restructuring
albexk Nov 16, 2023
b90fad6
Android activity and AndroidController class refactoring
albexk Nov 17, 2023
2c98a90
Move icons to mipmap folders
albexk Nov 17, 2023
679bd4e
Get rid of AppCompat theme
albexk Nov 21, 2023
e625543
CameraActivity refactoring
albexk Nov 21, 2023
c34c3e5
Remove 'https://jitpack.io' repository
albexk Nov 23, 2023
6d6710d
Prefs refactoring
albexk Nov 23, 2023
de65a03
Add ProtocolApi module
albexk Nov 23, 2023
712fb4d
Add Wireguard module
albexk Nov 23, 2023
ccdcfdc
Remove VPNPermissionHelper class
albexk Nov 23, 2023
0ba5d75
Android Activity refactoring
albexk Nov 23, 2023
ad5ea1c
Add IpcMessenger class
albexk Nov 24, 2023
8ef1678
Remove old wireguard code
albexk Nov 24, 2023
385a52f
Vpn service refactoring
albexk Nov 24, 2023
91f44fb
Up Qt to version 6.6.1
albexk Nov 24, 2023
9297f87
Add AWG module
albexk Nov 26, 2023
8ec105b
Move Log class to org.amnezia.vpn.util package
albexk Nov 28, 2023
9738ada
ProtocolApi refactoring, move network classes to NetworkUtils.kt
albexk Nov 28, 2023
51d4aea
Add OpenVpn module
albexk Nov 28, 2023
eaa209b
Add OpenVpn over Cloak module
albexk Nov 28, 2023
d7ec611
Fix bugs in awg and wireguard protocols
albexk Nov 29, 2023
ef53078
Fixes in AmneziaVpnService
albexk Nov 29, 2023
20f3c03
Add sending statistics
albexk Nov 29, 2023
e7658f9
Add split tunneling
albexk Nov 30, 2023
1e64413
Fix disconnect bug
albexk Dec 4, 2023
8d43cee
Remove shadowsocks code
albexk Dec 4, 2023
5c3e253
Fix service description in AndroidManifest.xml
albexk Dec 5, 2023
5835a75
Add onError callback to handle errors in protocol threads
albexk Dec 5, 2023
dc6e3ec
Add passing the VPN connection status when rebinding to the service
albexk Dec 5, 2023
656223f
Fix rebinding to the service
albexk Dec 5, 2023
bf03f5c
Fix for Qt Creator
albexk Dec 5, 2023
d2207a5
Up Gradle to version 8.5
albexk Dec 6, 2023
508f1d3
Add service bind timeout
albexk Dec 6, 2023
163e5b2
Fix for Qt Creator
albexk Dec 6, 2023
67694c0
Fix abort error: 'Pure virtual function called!'
albexk Dec 6, 2023
2eaaf01
Up AGP to version 8.2.0
albexk Dec 7, 2023
8cc5846
Fix application hangs in disconnection state
albexk Dec 7, 2023
1576aed
Add network state listening and reconnection
albexk Dec 11, 2023
195bdb9
Refactor import config
albexk Dec 11, 2023
b0dcae3
Disable global split tunneling if a non-default route exists in the W…
albexk Dec 12, 2023
836ca1c
Switch to Qt fileprovider introduced in 6.6
albexk Dec 14, 2023
0cabf60
Fixes and refactoring in file saving and import functions
albexk Dec 14, 2023
95d1440
Some minor refactoring
albexk Dec 14, 2023
0c2d661
Disable ShadowSocks support on Android
albexk Dec 14, 2023
6d0167d
Get back the ability to open configuration files
albexk Dec 14, 2023
c8d2399
Merge branch 'dev' into refactoring/android
albexk Dec 20, 2023
3758251
Fix cloak config
albexk Dec 22, 2023
eafac49
Add a stub for errors coming from Android
albexk Dec 22, 2023
164b7e2
Merge branch 'dev' into refactoring/android
albexk Dec 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ deploy/data/windows/x64/tap/windows_10/OemVista.inf eol=crlf
deploy/data/windows/x32/tap/windows_7/OemVista.inf eol=crlf
deploy/data/windows/x32/tap/windows_10/OemVista.inf eol=crlf
client/3rd/* linguist-vendored
client/android/gradlew.bat eol=crlf
105 changes: 71 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,10 @@ jobs:
name: 'Build-Android'
runs-on: ubuntu-latest

strategy:
matrix:
include:
- abi: 'x86_64'
qt_arch: 'android_x86_64'
- abi: 'x86'
qt_arch: 'android_x86'
- abi: 'armeabi-v7a'
qt_arch: 'android_armv7'
- abi: 'arm64-v8a'
qt_arch: 'android_arm64_v8a'

env:
QT_VERSION: 6.5.2
ANDROID_BUILD_PLATFORM: android-33
ANDROID_BUILD_PLATFORM: android-34
QT_VERSION: 6.6.1
QT_MODULES: 'qtremoteobjects qt5compat qtimageformats qtshadertools'

steps:
- name: 'Install desktop Qt'
Expand All @@ -297,29 +286,58 @@ jobs:
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qtremoteobjects qt5compat qtimageformats qtshadertools'
modules: ${{ env.QT_MODULES }}
dir: ${{ runner.temp }}
setup-python: 'true'
set-env: 'true'
extra: '--external 7z --base ${{ env.QT_MIRROR }}'

- name: 'Install android Qt'
- name: 'Install android_x86_64 Qt'
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: 'linux'
target: 'android'
arch: ${{ matrix.qt_arch }}
modules: 'qtremoteobjects qt5compat qtimageformats qtshadertools'
arch: 'android_x86_64'
modules: ${{ env.QT_MODULES }}
dir: ${{ runner.temp }}
extra: '--external 7z --base ${{ env.QT_MIRROR }}'

- name: 'Install android_x86 Qt'
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: 'linux'
target: 'android'
arch: 'android_x86'
modules: ${{ env.QT_MODULES }}
dir: ${{ runner.temp }}
extra: '--external 7z --base ${{ env.QT_MIRROR }}'

- name: 'Install android_armv7 Qt'
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: 'linux'
target: 'android'
arch: 'android_armv7'
modules: ${{ env.QT_MODULES }}
dir: ${{ runner.temp }}
extra: '--external 7z --base ${{ env.QT_MIRROR }}'

- name: 'Install android_arm64_v8a Qt'
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: 'linux'
target: 'android'
arch: 'android_arm64_v8a'
modules: ${{ env.QT_MODULES }}
dir: ${{ runner.temp }}
setup-python: 'true'
set-env: 'true'
extra: '--external 7z --base ${{ env.QT_MIRROR }}'

- name: 'Grant execute permission for qt-cmake'
shell: bash
run: |
chmod +x ${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/${{ matrix.qt_arch }}/bin/qt-cmake
chmod +x ${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/android_x86_64/bin/qt-cmake

- name: 'Get sources'
uses: actions/checkout@v3
Expand All @@ -333,15 +351,14 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
cache: 'gradle'

- name: 'Setup Android NDK'
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: 'r25c'
local-cache: 'true'
ndk-version: 'r26b'

- name: 'Decode keystore secret to file'
env:
Expand All @@ -354,16 +371,36 @@ jobs:
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
QT_HOST_PATH: ${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/gcc_64
QT_ANDROID_KEYSTORE_PATH: ${{ github.workspace }}/android.keystore
QT_ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_ALIAS }}
QT_ANDROID_KEYSTORE_STORE_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }}
QT_ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }}
ANDROID_KEYSTORE_PATH: ${{ github.workspace }}/android.keystore
ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_ALIAS }}
ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }}
shell: bash
run: ./deploy/build_android.sh --apk ${{ matrix.abi }} --platform ${{ env.ANDROID_BUILD_PLATFORM }}
run: ./deploy/build_android.sh --apk all --build-platform ${{ env.ANDROID_BUILD_PLATFORM }}

- name: 'Upload x86_64 apk'
uses: actions/upload-artifact@v3
with:
name: AmneziaVPN-android-x86_64
path: deploy/build/AmneziaVPN-x86_64-release.apk
retention-days: 7

- name: 'Upload x86 apk'
uses: actions/upload-artifact@v3
with:
name: AmneziaVPN-android-x86
path: deploy/build/AmneziaVPN-x86-release.apk
retention-days: 7

- name: 'Upload arm64-v8a apk'
uses: actions/upload-artifact@v3
with:
name: AmneziaVPN-android-arm64-v8a
path: deploy/build/AmneziaVPN-arm64-v8a-release.apk
retention-days: 7

- name: 'Upload apk'
- name: 'Upload armeabi-v7a apk'
uses: actions/upload-artifact@v3
with:
name: AmneziaVPN-android-${{ matrix.abi }}
path: deploy/build/AmneziaVPN-${{ matrix.abi }}-release-signed.apk
name: AmneziaVPN-android-armeabi-v7a
path: deploy/build/AmneziaVPN-armeabi-v7a-release.apk
retention-days: 7
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ string(TIMESTAMP CURRENT_DATE "%Y-%m-%d")
set(RELEASE_DATE "${CURRENT_DATE}")

set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
set(APP_ANDROID_VERSION_CODE 39)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(MZ_PLATFORM_NAME "linux")
Expand Down
12 changes: 5 additions & 7 deletions client/amnezia_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ void AmneziaApplication::init()
initControllers();

#ifdef Q_OS_ANDROID
connect(AndroidController::instance(), &AndroidController::initialized, this,
[this](bool status, bool connected, const QDateTime &connectionDate) {
if (connected) {
m_connectionController->onConnectionStateChanged(Vpn::ConnectionState::Connected);
if (m_vpnConnection)
m_vpnConnection->restoreConnection();
}
connect(AndroidController::instance(), &AndroidController::initConnectionState, this,
[this](Vpn::ConnectionState state) {
m_connectionController->onConnectionStateChanged(state);
if (m_vpnConnection)
m_vpnConnection->restoreConnection();
});
if (!AndroidController::instance()->initialize()) {
qCritical() << QString("Init failed");
Expand Down
Loading