Skip to content

Commit

Permalink
merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzopb committed Nov 20, 2023
2 parents a018419 + 442222b commit 133b870
Show file tree
Hide file tree
Showing 153 changed files with 3,729 additions and 2,428 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/android_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Get all tags for correct version determination
working-directory: ${{ github.workspace }}
run: |
git fetch --all --tags -f
git fetch --all --tags -f --depth 1
- name: Install Qt
uses: jurplel/install-qt-action@v3
Expand All @@ -63,10 +63,12 @@ jobs:
ndk-version: r21e
add-to-path: false

- name: Remove Android SDK android-33-ext
- name: Remove Android SDKs to force usage of android-33 only
run: |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-33-ext5"
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-33-ext4"
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-34"
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-34-ext8"
- name: Install ccache
run: sudo apt-get install ccache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Get all tags for correct version determination
working-directory: ${{ github.workspace }}
run: |
git fetch --all --tags -f
git fetch --all --tags -f --depth 1
- name: Install Qt
uses: jurplel/install-qt-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Get all tags for correct version determination
working-directory: ${{ github.workspace }}
run: |
git fetch --all --tags -f
git fetch --all --tags -f --depth 1
- name: Install Qt
uses: jurplel/install-qt-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Get all tags for correct version determination
working-directory: ${{ github.workspace }}
run: |
git fetch --all --tags -f
git fetch --all --tags -f --depth 1
- name: Install Qt
uses: jurplel/install-qt-action@v3
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ include_directories(
libs/libevents

libs/mavlink/include/mavlink/v2.0
libs/mavlink/include/mavlink/v2.0/ardupilotmega
libs/mavlink/include/mavlink/v2.0/all
libs/mavlink/include/mavlink/v2.0/common

libs/shapelib
Expand Down
10 changes: 9 additions & 1 deletion QGCCommon.pri
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,21 @@ linux {
QMAKE_CXXFLAGS += -fvisibility=hidden
QMAKE_CXXFLAGS_WARN_ON += -Werror \
-Wno-unused-parameter \ # gst-plugins-good
-Wno-unused-but-set-variable \ # eigen & QGCTileCacheWorker.cpp
-Wno-deprecated-declarations # eigen
} else {
error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
}
} else : ios {
message("iOS build")
CONFIG += iOSBuild MobileBuild app_bundle NoSerialBuild
CONFIG += iOSBuild MobileBuild app_bundle
CONFIG -= bitcode
DEFINES += __ios__
DEFINES += QGC_NO_GOOGLE_MAPS
DEFINES += NO_SERIAL_LINK
DEFINES += QGC_DISABLE_UVC
DEFINES += QGC_GST_TAISYNC_ENABLED
DEFINES += NO_SERIAL_LINK
QMAKE_IOS_DEPLOYMENT_TARGET = 11.0
QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1,2 # Universal
QMAKE_LFLAGS += -Wl,-no_pie
Expand All @@ -141,6 +143,10 @@ linux|macx|ios {
}
}

contains(DEFINES, NO_SERIAL_LINK) {
message("Serial port support disabled")
}

!MacBuild:!AndroidBuild {
# See QGCPostLinkCommon.pri for details on why MacBuild doesn't use DESTDIR
DESTDIR = staging
Expand Down Expand Up @@ -193,6 +199,8 @@ exists ($$PWD/.git) {
DEFINES += APP_VERSION_STR=\"\\\"$$APP_VERSION_STR\\\"\"

AndroidBuild {
QGC_ANDROID_PACKAGE = org.mavlink.qgroundcontrol

message(VERSION $${VERSION})
MAJOR_VERSION = $$section(VERSION, ".", 0, 0)
MINOR_VERSION = $$section(VERSION, ".", 1, 1)
Expand Down
35 changes: 11 additions & 24 deletions QGCExternalLibs.pri
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ isEmpty(MAVLINK_CONF) {
MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF)
message($$sprintf("Using user-supplied mavlink dialect '%1' specified in user_config.pri", $$MAVLINK_CONF))
} else {
MAVLINK_CONF = ardupilotmega
MAVLINK_CONF = all
message($$sprintf("Using MAVLink dialect '%1'.", $$MAVLINK_CONF))
}
}

Expand All @@ -67,32 +68,18 @@ contains (CONFIG, QGC_DISABLE_APM_MAVLINK) {
CONFIG += ArdupilotEnabled
}

# First we select the dialect, checking for valid user selection
# Users can override all other settings by specifying MAVLINK_CONF as an argument to qmake
!isEmpty(MAVLINK_CONF) {
message($$sprintf("Using MAVLink dialect '%1'.", $$MAVLINK_CONF))
}

# Then we add the proper include paths dependent on the dialect.
INCLUDEPATH += $$MAVLINKPATH

exists($$MAVLINKPATH/common) {
!isEmpty(MAVLINK_CONF) {
count(MAVLINK_CONF, 1) {
exists($$MAVLINKPATH/$$MAVLINK_CONF) {
INCLUDEPATH += $$MAVLINKPATH/$$MAVLINK_CONF
DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$MAVLINK_CONF))
} else {
error($$sprintf("MAVLink dialect '%1' does not exist at '%2'!", $$MAVLINK_CONF, $$MAVLINKPATH_REL))
}
} else {
error(Only a single mavlink dialect can be specified in MAVLINK_CONF)
}
count(MAVLINK_CONF, 1) {
exists($$MAVLINKPATH/$$MAVLINK_CONF) {
INCLUDEPATH += $$MAVLINKPATH/$$MAVLINK_CONF
DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$MAVLINK_CONF))
} else {
INCLUDEPATH += $$MAVLINKPATH/common
error($$sprintf("MAVLink dialect '%1' does not exist at '%2'!", $$MAVLINK_CONF, $$MAVLINKPATH_REL))
}
} else {
error($$sprintf("MAVLink folder does not exist at '%1'! Run 'git submodule init && git submodule update' on the command line.",$$MAVLINKPATH_REL))
error(Only a single mavlink dialect can be specified in MAVLINK_CONF)
}

#
Expand Down Expand Up @@ -226,9 +213,9 @@ MacBuild {
# Include Android OpenSSL libs
AndroidBuild {
include($$SOURCE_DIR/libs/OpenSSL/android_openssl/openssl.pri)
message("ANDROID_EXTRA_LIBS")
message($$ANDROID_TARGET_ARCH)
message($$ANDROID_EXTRA_LIBS)
#message("ANDROID_EXTRA_LIBS")
#message($$ANDROID_TARGET_ARCH)
#message($$ANDROID_EXTRA_LIBS)
}

# Pairing
Expand Down
83 changes: 69 additions & 14 deletions android.pri
Original file line number Diff line number Diff line change
@@ -1,24 +1,71 @@
include($$PWD/libs/qtandroidserialport/src/qtandroidserialport.pri)
message("Adding Serial Java Classes")
QT += androidextras

ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
include($$PWD/libs/qtandroidserialport/src/qtandroidserialport.pri)

ANDROID_PACKAGE_SOURCE_DIR = $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR # Tells Qt location of package files for build
ANDROID_PACKAGE_QGC_SOURCE_DIR = $$PWD/android # Original location of QGC package files
ANDROID_PACKAGE_CUSTOM_SOURCE_DIR = $$PWD/custom/android # Original location for custom build override package files

# We always move the package files to the ANDROID_PACKAGE_SOURCE_DIR build dir so we can modify the manifest as needed

android_source_dir_target.target = $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml
android_source_dir_target.commands = \
$$QMAKE_MKDIR $$ANDROID_PACKAGE_SOURCE_DIR && \
$$QMAKE_COPY_DIR $$ANDROID_PACKAGE_QGC_SOURCE_DIR/* $$ANDROID_PACKAGE_SOURCE_DIR
PRE_TARGETDEPS += $$android_source_dir_target.target
QMAKE_EXTRA_TARGETS += android_source_dir_target
exists($$ANDROID_PACKAGE_CUSTOM_SOURCE_DIR/AndroidManifest.xml) {
android_source_dir_target.depends = $$ANDROID_PACKAGE_CUSTOM_SOURCE_DIR/AndroidManifest.xml
} else {
android_source_dir_target.depends = $$ANDROID_PACKAGE_QGC_SOURCE_DIR/AndroidManifest.xml
}

exists($$PWD/custom/android) {
message("Merging $$PWD/custom/android/ -> $$PWD/android/")
# Custom builds can override android package file

ANDROID_PACKAGE_SOURCE_DIR = $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR
android_source_dir_target.target = android_source_dir
PRE_TARGETDEPS += $$android_source_dir_target.target
QMAKE_EXTRA_TARGETS += android_source_dir_target
exists($$ANDROID_PACKAGE_CUSTOM_SOURCE_DIR) {
message("Merging$$ $$ANDROID_PACKAGE_QGC_SOURCE_DIR and $$ANDROID_PACKAGE_CUSTOM_SOURCE_DIR to $$ANDROID_PACKAGE_SOURCE_DIR")

android_source_dir_target.commands = $$QMAKE_MKDIR $$ANDROID_PACKAGE_SOURCE_DIR && \
$$QMAKE_COPY_DIR $$PWD/android/* $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR && \
$$QMAKE_COPY_DIR $$PWD/custom/android/* $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR && \
android_source_dir_target.commands = $$android_source_dir_target.commands && \
$$QMAKE_COPY_DIR $$ANDROID_PACKAGE_CUSTOM_SOURCE_DIR/* $$ANDROID_PACKAGE_SOURCE_DIR && \
$$QMAKE_STREAM_EDITOR -i \"s/package=\\\"org.mavlink.qgroundcontrol\\\"/package=\\\"$$QGC_ANDROID_PACKAGE\\\"/\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml
android_source_dir_target.depends = FORCE
}

# Insert package name into manifest file

android_source_dir_target.commands = $$android_source_dir_target.commands && \
$$QMAKE_STREAM_EDITOR -i \"s/%%QGC_INSERT_PACKAGE_NAME%%/$$QGC_ANDROID_PACKAGE/\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml

# Update manifest activity intent filter as needed

QGC_INSERT_ACTIVITY_INTENT_FILTER = ""
AndroidHomeApp {
# QGC is the android home application
QGC_INSERT_ACTIVITY_INTENT_FILTER = $$QGC_INSERT_ACTIVITY_INTENT_FILTER "\r\n<category android:name=\\\"android.intent.category.HOME\\\"\\\/>\r\n<category android:name=\\\"android.intent.category.DEFAULT\\\"\\\/>"
}
!contains(DEFINES, NO_SERIAL_LINK) {
# Add usb device support
QGC_INSERT_ACTIVITY_INTENT_FILTER = $$QGC_INSERT_ACTIVITY_INTENT_FILTER "\r\n<action android:name=\\\"android.hardware.usb.action.USB_DEVICE_ATTACHED\\\"\\\/>\r\n<action android:name=\\\"android.hardware.usb.action.USB_DEVICE_DETACHED\\\"\\\/>\r\n<action android:name=\\\"android.hardware.usb.action.USB_ACCESSORY_ATTACHED\\\"\\\/>"
}
contains(DEFINES, QGC_ENABLE_BLUETOOTH) {
QGC_INSERT_ACTIVITY_INTENT_FILTER = $$QGC_INSERT_ACTIVITY_INTENT_FILTER "\r\n<action android:name=\\\"android.bluetooth.device.action.ACL_CONNECTED\\\"\\\/>\r\n<action android:name=\\\"android.bluetooth.device.action.ACL_DISCONNECTED\\\"\\\/>"
}
android_source_dir_target.commands = $$android_source_dir_target.commands && \
$$QMAKE_STREAM_EDITOR -i \"s/<!-- %%QGC_INSERT_ACTIVITY_INTENT_FILTER -->/$$QGC_INSERT_ACTIVITY_INTENT_FILTER/\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml

# Update manifest activity meta data as needed

contains(DEFINES, NO_SERIAL_LINK) {
# No need to add anything to manifest
android_source_dir_target.commands = $$android_source_dir_target.commands && \
$$QMAKE_STREAM_EDITOR -i \"s/<!-- %%QGC_INSERT_ACTIVITY_META_DATA -->//\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml
} else {
# Updates the manifest for usb device support
android_source_dir_target.commands = $$android_source_dir_target.commands && \
$$QMAKE_STREAM_EDITOR -i \"s/<!-- %%QGC_INSERT_ACTIVITY_META_DATA -->/<meta-data android:resource=\\\"@xml\\\/device_filter\\\" android:name=\\\"android.hardware.usb.action.USB_DEVICE_ATTACHED\\\"\\\/>\r\n<meta-data android:resource=\\\"@xml\\\/device_filter\\\" android:name=\\\"android.hardware.usb.action.USB_DEVICE_DETACHED\\\"\\\/>\r\n<meta-data android:resource=\\\"@xml\\\/device_filter\\\" android:name=\\\"android.hardware.usb.action.USB_ACCESSORY_ATTACHED\\\"\\\/>/\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml
}

# OTHER_FILES makes the specified files be visible in Qt Creator for editing

exists($$PWD/custom/android/AndroidManifest.xml) {
OTHER_FILES += \
$$PWD/custom/android/AndroidManifest.xml
Expand All @@ -45,11 +92,19 @@ OTHER_FILES += \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAhsCallback.java \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAmcOnFrameAvailableListener.java


DISTFILES += \
$$PWD/android/gradle/wrapper/gradle-wrapper.jar \
$$PWD/android/gradlew \
$$PWD/android/res/values/libs.xml \
$$PWD/android/build.gradle \
$$PWD/android/gradle/wrapper/gradle-wrapper.properties \
$$PWD/android/gradlew.bat

SOURCES += \
$$PWD/android/src/AndroidInterface.cc

HEADERS += \
$$PWD/android/src/AndroidInterface.h

INCLUDEPATH += \
$$PWD/android/src
16 changes: 7 additions & 9 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.mavlink.qgroundcontrol" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
<manifest package="%%QGC_INSERT_PACKAGE_NAME%%" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
Expand All @@ -14,15 +14,12 @@
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"/>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
<action android:name="android.bluetooth.device.action.ACL_DISCONNECTED"/>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/>

<!-- %%QGC_INSERT_ACTIVITY_INTENT_FILTER -->
</intent-filter>
<meta-data android:resource="@xml/device_filter" android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
<meta-data android:resource="@xml/device_filter" android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"/>
<meta-data android:resource="@xml/device_filter" android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/>

<!-- %%QGC_INSERT_ACTIVITY_META_DATA -->

<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
<!-- Application arguments -->
Expand Down Expand Up @@ -102,5 +99,6 @@

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
36 changes: 36 additions & 0 deletions android/src/AndroidInterface.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/****************************************************************************
*
* Copyright (C) 2018 Pinecone Inc. All rights reserved.
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/

#include <QtAndroidExtras/QtAndroidExtras>
#include <QtAndroidExtras/QAndroidJniObject>
#include "QGCApplication.h"
#include "AndroidInterface.h"
#include <QAndroidJniObject>
#include <QtAndroid>

QString AndroidInterface::getSDCardPath()
{
QAndroidJniObject value = QAndroidJniObject::callStaticObjectMethod("org/mavlink/qgroundcontrol/QGCActivity", "getSDCardPath",
"()Ljava/lang/String;");
QString sdCardPath = value.toString();

QString readPermission("android.permission.READ_EXTERNAL_STORAGE");
QString writePermission("android.permission.WRITE_EXTERNAL_STORAGE");

if (QtAndroid::checkPermission(readPermission) == QtAndroid::PermissionResult::Denied ||
QtAndroid::checkPermission(writePermission) == QtAndroid::PermissionResult::Denied) {
QtAndroid::PermissionResultMap resultHash = QtAndroid::requestPermissionsSync(QStringList({ readPermission, writePermission }));
if (resultHash[readPermission] == QtAndroid::PermissionResult::Denied ||
resultHash[writePermission] == QtAndroid::PermissionResult::Denied) {
return QString();
}
}

return sdCardPath;
}
21 changes: 21 additions & 0 deletions android/src/AndroidInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/****************************************************************************
*
* Copyright (C) 2018 Pinecone Inc. All rights reserved.
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/

#pragma once

#include <QObject>
#include <jni.h>
#include <QtCore/private/qjni_p.h>
#include <QtCore/private/qjnihelpers_p.h>

class AndroidInterface
{
public:
static QString getSDCardPath();
};
Loading

0 comments on commit 133b870

Please sign in to comment.