From ca9ad4f3f6af2394b23dae288c1ef2b2faaa8141 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Otto=20Ryyn=C3=A4nen?= <otto.ryynanen@qt.io>
Date: Fri, 21 Apr 2017 15:49:30 +0300
Subject: [PATCH] Support for Q_OS_ANDROID_EMBEDDED and android-embedded builds

The Embedded Android build (Boot to Qt Android injection) is defined by
having both Q_OS_ANDROID and Q_OS_ANDROID_EMBEDDED flags defined,
as well as having Qt config android-embedded.
Those flags are set in mkspecs when building for embedded Android.
This commit enables the possibility to build embedded Android builds.
(i.e. Qt build for Android baselayer only, without JNI)

Change-Id: I2ded43d7ed46a99ba70301f07a791ed4a148c6c0
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
---
 examples/nfc/corkboard/corkboard.pro                       | 2 ++
 src/bluetooth/bluetooth.pro                                | 2 +-
 src/nfc/nfc.pro                                            | 2 +-
 tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro | 2 +-
 tests/auto/qbluetoothsocket/qbluetoothsocket.pro           | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/examples/nfc/corkboard/corkboard.pro b/examples/nfc/corkboard/corkboard.pro
index 9d1de4b3..858ac65d 100644
--- a/examples/nfc/corkboard/corkboard.pro
+++ b/examples/nfc/corkboard/corkboard.pro
@@ -13,7 +13,9 @@ OTHER_FILES += \
     corkboards.qml \
     Mode.qml
 
+!android-embedded {
 ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
+}
 
 target.path = $$[QT_INSTALL_EXAMPLES]/nfc/corkboard
 INSTALLS += target
diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro
index 6d3dacc3..6b23325f 100644
--- a/src/bluetooth/bluetooth.pro
+++ b/src/bluetooth/bluetooth.pro
@@ -110,7 +110,7 @@ qtConfig(bluez) {
             qlowenergycontroller_p.cpp
     }
 
-} else:android {
+} else:android:!android-embedded {
     include(android/android.pri)
     DEFINES += QT_ANDROID_BLUETOOTH
     QT_FOR_PRIVATE += core-private androidextras
diff --git a/src/nfc/nfc.pro b/src/nfc/nfc.pro
index ce193efa..d3053115 100644
--- a/src/nfc/nfc.pro
+++ b/src/nfc/nfc.pro
@@ -79,7 +79,7 @@ linux:!android:qtHaveModule(dbus) {
 
     include(neard/neard.pri)
 
-} else:android {
+} else:android:!android-embedded {
     NFC_BACKEND_AVAILABLE = yes
     DEFINES += QT_ANDROID_NFC
     ANDROID_PERMISSIONS = \
diff --git a/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro b/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro
index 0eae09de..6a072784 100644
--- a/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro
+++ b/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro
@@ -6,6 +6,6 @@ QT = core concurrent bluetooth testlib
 osx:QT += widgets
 
 
-android {
+android:!android-embedded {
     DEFINES += QT_ANDROID_BLUETOOTH
 }
diff --git a/tests/auto/qbluetoothsocket/qbluetoothsocket.pro b/tests/auto/qbluetoothsocket/qbluetoothsocket.pro
index 32fc6558..83bc417c 100644
--- a/tests/auto/qbluetoothsocket/qbluetoothsocket.pro
+++ b/tests/auto/qbluetoothsocket/qbluetoothsocket.pro
@@ -11,6 +11,6 @@ OTHER_FILES += \
 
 osx {
     DEFINES += QT_OSX_BLUETOOTH
-} else: android {
+} else:android:!android-embedded {
     DEFINES += QT_ANDROID_BLUETOOTH
 }
-- 
GitLab