Browse Source

Android support for serial/bluetooth disabling

QGC4.4
Don Gagne 2 years ago committed by Don Gagne
parent
commit
f9ac752320
  1. 4
      QGCCommon.pri
  2. 21
      android.pri
  3. 13
      android/AndroidManifest.xml
  4. 5
      qgroundcontrol.pro

4
QGCCommon.pri

@ -141,6 +141,10 @@ linux|macx|ios { @@ -141,6 +141,10 @@ linux|macx|ios {
}
}
NoSerialBuild {
message("Serial port support disabled")
}
!MacBuild:!AndroidBuild {
# See QGCPostLinkCommon.pri for details on why MacBuild doesn't use DESTDIR
DESTDIR = staging

21
android.pri

@ -4,6 +4,9 @@ QT += androidextras @@ -4,6 +4,9 @@ QT += androidextras
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
android_source_dir_target.commands = echo Updating Android Manifest
android_source_dir_target.depends = FORCE
exists($$PWD/custom/android) {
message("Merging $$PWD/custom/android/ -> $$PWD/android/")
@ -12,11 +15,25 @@ exists($$PWD/custom/android) { @@ -12,11 +15,25 @@ exists($$PWD/custom/android) {
PRE_TARGETDEPS += $$android_source_dir_target.target
QMAKE_EXTRA_TARGETS += android_source_dir_target
android_source_dir_target.commands = $$QMAKE_MKDIR $$ANDROID_PACKAGE_SOURCE_DIR && \
android_source_dir_target.commands = $$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 && \
$$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
}
NoSerialBuild {
# 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_INTENT_FILTER -->//\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml
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_INTENT_FILTER -->/<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\\\"\\\/>/\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml
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
}
exists($$PWD/custom/android/AndroidManifest.xml) {

13
android/AndroidManifest.xml

@ -13,16 +13,17 @@ @@ -13,16 +13,17 @@
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.mavlink.qgroundcontrol.QGCActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:keepScreenOn="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
<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 -->

5
qgroundcontrol.pro

@ -182,13 +182,12 @@ contains (CONFIG, QGC_DISABLE_PX4_PLUGIN_FACTORY) { @@ -182,13 +182,12 @@ contains (CONFIG, QGC_DISABLE_PX4_PLUGIN_FACTORY) {
# Bluetooth
contains (DEFINES, QGC_DISABLE_BLUETOOTH) {
message("Skipping support for Bluetooth (manual override from command line)")
message("Bluetooth support disabled (manual override from command line)")
DEFINES -= QGC_ENABLE_BLUETOOTH
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, QGC_DISABLE_BLUETOOTH) {
message("Skipping support for Bluetooth (manual override from user_config.pri)")
message("Bluetooth support disabled (manual override from user_config.pri)")
DEFINES -= QGC_ENABLE_BLUETOOTH
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, QGC_ENABLE_BLUETOOTH) {
message("Including support for Bluetooth (manual override from user_config.pri)")
DEFINES += QGC_ENABLE_BLUETOOTH
}

Loading…
Cancel
Save