Support for Q_OS_ANDROID_EMBEDDED and android-embedded build flags

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.
This commit enables the possibility to build embedded Android builds.
(i.e. Qt build for Android baselayer only, without JNI)

Change-Id: I8406e959fdf1c8d9efebbbe53f1a391fa25f336a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Otto Ryynänen 2017-06-02 12:53:23 +03:00
parent e211ab76d7
commit 6d50f746fe
56 changed files with 92 additions and 88 deletions

View File

@ -1,4 +1,4 @@
contains(TEMPLATE, ".*app"):!build_pass: {
contains(TEMPLATE, ".*app"):!build_pass:!android-embedded {
defineReplace(emitString) {
return("\"$$replace(1, \\\\, \\\\)\"")

View File

@ -81,7 +81,7 @@
# include <envLib.h>
#endif
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#include <private/qjni_p.h>
#endif
@ -2312,7 +2312,7 @@ static bool findUnixOsVersion(QUnixOSVersion &v)
# endif // USE_ETC_OS_RELEASE
#endif // Q_OS_UNIX
#ifdef Q_OS_ANDROID
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
static const char *osVer_helper(QOperatingSystemVersion)
{
/* Data:
@ -2793,7 +2793,7 @@ QString QSysInfo::productVersion()
*/
QString QSysInfo::prettyProductName()
{
#if defined(Q_OS_ANDROID) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN)
#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN)
const auto version = QOperatingSystemVersion::current();
const char *name = osVer_helper(version);
if (name)
@ -3349,7 +3349,7 @@ bool qunsetenv(const char *varName)
#endif
}
#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21)
typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage;
Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
@ -3383,7 +3383,7 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
*/
void qsrand(uint seed)
{
#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21)
if (randomTLS->hasLocalData()) {
randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed));
return;
@ -3437,7 +3437,7 @@ void qsrand(uint seed)
*/
int qrand()
{
#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21)
AndroidRandomStorage *randomStorage = randomTLS();
if (!randomStorage)
return rand();

View File

@ -1546,7 +1546,7 @@ static void syslog_default_message_handler(QtMsgType type, const char *message)
}
#endif
#ifdef Q_OS_ANDROID
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
static void android_default_message_handler(QtMsgType type,
const QMessageLogContext &context,
const QString &message)
@ -1594,7 +1594,7 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
#elif QT_CONFIG(syslog)
syslog_default_message_handler(type, logMessage.toUtf8().constData());
return;
#elif defined(Q_OS_ANDROID)
#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
android_default_message_handler(type, context, logMessage);
return;
#endif

View File

@ -44,7 +44,7 @@
#include <qversionnumber.h>
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#include <private/qjni_p.h>
#endif
@ -160,7 +160,7 @@ QOperatingSystemVersion QOperatingSystemVersion::current()
{
QOperatingSystemVersion version;
version.m_os = currentType();
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#ifndef QT_BOOTSTRAPPED
const QVersionNumber v = QVersionNumber::fromString(QJNIObjectPrivate::getStaticObjectField(
"android/os/Build$VERSION", "RELEASE", "Ljava/lang/String;").toString());

View File

@ -167,7 +167,7 @@ win32 {
} else {
LIBS += -framework MobileCoreServices
}
} else:android {
} else:android:!android-embedded {
SOURCES += \
io/qstandardpaths_android.cpp \
io/qstorageinfo_unix.cpp

View File

@ -199,7 +199,7 @@ qnx:qtConfig(qqnx_pps) {
kernel/qppsobjectprivate_p.h
}
android {
android:!android-embedded {
SOURCES += \
kernel/qjnionload.cpp \
kernel/qjnihelpers.cpp \

View File

@ -95,7 +95,7 @@
#endif
#endif // QT_NO_QOBJECT
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
# include <private/qjni_p.h>
# include <private/qjnihelpers_p.h>
#endif
@ -180,7 +180,7 @@ QString QCoreApplicationPrivate::appVersion() const
#ifndef QT_BOOTSTRAPPED
# ifdef Q_OS_DARWIN
applicationVersion = infoDictionaryStringProperty(QStringLiteral("CFBundleVersion"));
# elif defined(Q_OS_ANDROID)
# elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QJNIObjectPrivate context(QtAndroidPrivate::context());
if (context.isValid()) {
QJNIObjectPrivate pm = context.callObjectMethod(
@ -2189,7 +2189,7 @@ QString QCoreApplication::applicationFilePath()
}
#endif
#if defined( Q_OS_UNIX )
# if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
# if defined(Q_OS_LINUX) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED))
// Try looking for a /proc/<pid>/exe symlink first which points to
// the absolute path of the executable
QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid()));

View File

@ -198,7 +198,7 @@
// SSE intrinsics
#if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
#if defined(QT_LINUXBASE)
#if defined(QT_LINUXBASE) || defined(Q_OS_ANDROID_EMBEDDED)
/// this is an evil hack - the posix_memalign declaration in LSB
/// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431
# define posix_memalign _lsb_hack_posix_memalign

View File

@ -62,9 +62,9 @@ static QTimeZonePrivate *newBackendTimeZone()
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate();
#elif defined Q_OS_ANDROID
#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
return new QAndroidTimeZonePrivate();
#elif defined Q_OS_UNIX
#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED)
return new QTzTimeZonePrivate();
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
@ -89,9 +89,9 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate(ianaId);
#elif defined Q_OS_ANDROID
#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
return new QAndroidTimeZonePrivate(ianaId);
#elif defined Q_OS_UNIX
#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED)
return new QTzTimeZonePrivate(ianaId);
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN

View File

@ -68,7 +68,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone);
#include <qt_windows.h>
#endif // Q_OS_WIN
#ifdef Q_OS_ANDROID
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#include <QtCore/private/qjni_p.h>
#endif
@ -266,7 +266,7 @@ private:
};
#endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED))
struct QTzTransitionTime
{
qint64 atMSecsSinceEpoch;
@ -443,7 +443,7 @@ private:
};
#endif // Q_OS_WIN
#ifdef Q_OS_ANDROID
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
class QAndroidTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
{
public:

View File

@ -158,7 +158,7 @@ qtConfig(timezone) {
tools/qtimezoneprivate.cpp
!nacl:darwin: \
SOURCES += tools/qtimezoneprivate_mac.mm
else: android: \
else: android:!android-embedded: \
SOURCES += tools/qtimezoneprivate_android.cpp
else: unix: \
SOURCES += tools/qtimezoneprivate_tz.cpp

View File

@ -2040,7 +2040,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
if (e->nullWindow()
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
|| e->key == Qt::Key_Back || e->key == Qt::Key_Menu
#endif
) {
@ -2076,7 +2076,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
if (window && !window->d_func()->blockedByModalWindow)
QGuiApplication::sendSpontaneousEvent(window, &ev);
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
else
ev.setAccepted(false);

View File

@ -727,12 +727,14 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
directories << ministroPath;
nameFilters << QLatin1String("*.der");
platformEncodingFormat = QSsl::Der;
# ifndef Q_OS_ANDROID_EMBEDDED
if (ministroPath.isEmpty()) {
QList<QByteArray> certificateData = fetchSslCertificateData();
for (int i = 0; i < certificateData.size(); ++i) {
systemCerts.append(QSslCertificate::fromData(certificateData.at(i), QSsl::Der));
}
} else
# endif //Q_OS_ANDROID_EMBEDDED
# endif //Q_OS_ANDROID
{
currentDir.setNameFilters(nameFilters);

View File

@ -209,7 +209,7 @@ public:
private:
static bool ensureLibraryLoaded();
static void ensureCiphersAndCertsLoaded();
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
static QList<QByteArray> fetchSslCertificateData();
#endif

View File

@ -70,7 +70,7 @@ qtConfig(ssl) {
darwin:SOURCES += ssl/qsslsocket_mac_shared.cpp
android: SOURCES += ssl/qsslsocket_openssl_android.cpp
android:!android-embedded: SOURCES += ssl/qsslsocket_openssl_android.cpp
# Add optional SSL libs
# Static linking of OpenSSL with msvc:

View File

@ -45,7 +45,7 @@
#include <QtPlatformHeaders/QEGLNativeContext>
#include <QDebug>
#ifdef Q_OS_ANDROID
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#include <QtCore/private/qjnihelpers_p.h>
#endif
#ifndef Q_OS_WIN
@ -332,7 +332,7 @@ void QEGLPlatformContext::updateFormatFromGL()
QByteArray version = QByteArray(reinterpret_cast<const char *>(s));
int major, minor;
if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) {
#ifdef Q_OS_ANDROID
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
// Some Android 4.2.2 devices report OpenGL ES 3.0 without the functions being available.
static int apiLevel = QtAndroidPrivate::androidSdkVersion();
if (apiLevel <= 17 && major >= 3) {

View File

@ -6,6 +6,6 @@ QT_FOR_CONFIG += network-private
SUBDIRS += connman networkmanager
}
android:SUBDIRS += android
android:!android-embedded: SUBDIRS += android
isEmpty(SUBDIRS):SUBDIRS = generic

View File

@ -117,7 +117,7 @@ void QEglFSWindow::create()
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
if (screen->primarySurface() != EGL_NO_SURFACE) {
if (Q_UNLIKELY(!isRaster() || !compositor->targetWindow())) {
#if !defined(Q_OS_ANDROID)
#if !defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED)
// We can have either a single OpenGL window or multiple raster windows.
// Other combinations cannot work.
qFatal("EGLFS: OpenGL windows cannot be mixed with others.");

View File

@ -59,13 +59,13 @@
#include <QtInputSupport/private/qlibinputhandler_p.h>
#endif
#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID)
#if QT_CONFIG(evdev)
#include <QtInputSupport/private/qevdevmousemanager_p.h>
#include <QtInputSupport/private/qevdevkeyboardmanager_p.h>
#include <QtInputSupport/private/qevdevtouchmanager_p.h>
#endif
#if QT_CONFIG(tslib) && !defined(Q_OS_ANDROID)
#if QT_CONFIG(tslib)
#include <QtInputSupport/private/qtslib_p.h>
#endif
@ -162,7 +162,7 @@ void QLinuxFbIntegration::createInputHandlers()
new QTsLibMouseHandler(QLatin1String("TsLib"), QString());
#endif
#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID)
#if QT_CONFIG(evdev)
new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this);
#if QT_CONFIG(tslib)

View File

@ -1,7 +1,7 @@
TEMPLATE = subdirs
QT_FOR_CONFIG += gui-private
android: SUBDIRS += android
android:!android-embedded: SUBDIRS += android
!android: SUBDIRS += minimal

View File

@ -193,9 +193,11 @@ qtConfig(gui) {
src_plugins.depends += src_gui src_platformsupport src_platformheaders
src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers
qtConfig(widgets) {
SUBDIRS += src_tools_uic src_widgets src_printsupport
SUBDIRS += src_tools_uic src_widgets
!android-embedded: SUBDIRS += src_printsupport
TOOLS += src_tools_uic
src_plugins.depends += src_widgets src_printsupport
src_plugins.depends += src_widgets
!android-embedded: src_plugins.depends += src_printsupport
src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers
qtConfig(opengl) {
SUBDIRS += src_opengl
@ -207,7 +209,7 @@ SUBDIRS += src_plugins
nacl: SUBDIRS -= src_network src_testlib
android: SUBDIRS += src_android src_3rdparty_gradle
android:!android-embedded: SUBDIRS += src_android src_3rdparty_gradle
TR_EXCLUDE = \
src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_uic src_tools_qlalr \

View File

@ -5,7 +5,7 @@ SOURCES = tst_qdatastream.cpp
TESTDATA += datastream.q42
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}

View File

@ -8,6 +8,6 @@ TESTDATA += testdir testData searchdir resources entrylist types tst_qdir.cpp
contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA
android {
android:!android-embedded {
RESOURCES += android_testdata.qrc
}

View File

@ -228,13 +228,13 @@ private:
Q_DECLARE_METATYPE(tst_QDir::UncHandling)
tst_QDir::tst_QDir()
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
: m_dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
#elif !defined(BUILTIN_TESTDATA)
: m_dataPath(QFileInfo(QFINDTESTDATA("testData")).absolutePath())
#endif
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QString resourceSourcePath = QStringLiteral(":/android_testdata/");
QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories);
while (it.hasNext()) {
@ -2186,7 +2186,7 @@ void tst_QDir::equalityOperator_data()
QString pathinroot(QDir::rootPath() + QLatin1String("assets/.."));
#elif defined (Q_OS_WIN)
QString pathinroot("c:/windows/..");
#elif defined(Q_OS_ANDROID)
#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QString pathinroot("/system/..");
#elif defined(Q_OS_HAIKU)
QString pathinroot("/boot/..");

View File

@ -118,7 +118,7 @@ private:
void tst_QDirIterator::initTestCase()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QString testdata_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
QString resourceSourcePath = QStringLiteral(":/");
QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories);

View File

@ -1200,7 +1200,7 @@ void tst_QFileInfo::fileTimes()
QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue);
#elif defined(Q_OS_QNX)
QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue);
#elif defined(Q_OS_ANDROID)
#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
if (fileInfo.lastRead() <= beforeRead)
QEXPECT_FAIL("", "Android may use relatime or noatime on mounts", Continue);
#endif
@ -1664,7 +1664,7 @@ void tst_QFileInfo::isWritable()
void tst_QFileInfo::isExecutable()
{
QString appPath = QCoreApplication::applicationDirPath();
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
appPath += "/libtst_qfileinfo.so";
#else
appPath += "/tst_qfileinfo";

View File

@ -89,7 +89,7 @@ tst_QFileSystemWatcher::tst_QFileSystemWatcher()
m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX");
#endif // QT_NO_FILESYSTEMWATCHER
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
#endif
}

View File

@ -6,7 +6,7 @@ SOURCES = tst_qiodevice.cpp
TESTDATA += tst_qiodevice.cpp
MOC_DIR=tmp
android {
android:!android-embedded {
RESOURCES += \
android_testdata.qrc
}

View File

@ -66,7 +66,7 @@ private:
void tst_QIODevice::initTestCase()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QVERIFY(QFileInfo(QStringLiteral("./tst_qiodevice.cpp")).exists()
|| QFile::copy(QStringLiteral(":/tst_qiodevice.cpp"), QStringLiteral("./tst_qiodevice.cpp")));
#endif

View File

@ -72,7 +72,7 @@ public:
void tst_QLockFile::initTestCase()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("This test requires deploying and running external console applications");
#elif !QT_CONFIG(process)
QSKIP("This test requires QProcess support");

View File

@ -7,7 +7,7 @@ QT = core core-private testlib
SOURCES += tst_qloggingregistry.cpp
TESTDATA += qtlogging.ini
android {
android:!android-embedded {
RESOURCES += \
android_testdata.qrc
}

View File

@ -18,6 +18,6 @@ TESTDATA += \
testqrc/*
GENERATED_TESTDATA = $${runtime_resource.target}
android {
android:!android-embedded {
RESOURCES += android_testdata.qrc
}

View File

@ -36,7 +36,7 @@ class tst_QResourceEngine: public QObject
public:
tst_QResourceEngine()
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
: m_runtimeResourceRcc(QFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/runtime_resource.rcc")).absoluteFilePath())
#else
: m_runtimeResourceRcc(QFINDTESTDATA("runtime_resource.rcc"))
@ -64,7 +64,7 @@ private:
void tst_QResourceEngine::initTestCase()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QString sourcePath(QStringLiteral(":/android_testdata/"));
QString dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
@ -121,7 +121,7 @@ void tst_QResourceEngine::checkStructure_data()
<< QLatin1String("test")
<< QLatin1String("withoutslashes");
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
rootContents.insert(1, QLatin1String("android_testdata"));
#endif

View File

@ -288,7 +288,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir()
{
#ifdef Q_OS_UNIX
# if defined(Q_OS_ANDROID)
# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
const char nonWritableDir[] = "/data";
# else
const char nonWritableDir[] = "/home";

View File

@ -5,6 +5,6 @@ SOURCES = tst_qtemporaryfile.cpp
TESTDATA += tst_qtemporaryfile.cpp
RESOURCES += qtemporaryfile.qrc
android {
android:!android-embedded {
RESOURCES += android_testdata.qrc
}

View File

@ -99,7 +99,7 @@ void tst_QTemporaryFile::initTestCase()
QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX"));
QCoreApplication::setApplicationName("tst_qtemporaryfile");
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QString sourceDir(":/android_testdata/");
QDirIterator it(sourceDir, QDirIterator::Subdirectories);
while (it.hasNext()) {
@ -323,7 +323,7 @@ void tst_QTemporaryFile::nonWritableCurrentDir()
ChdirOnReturn cor(QDir::currentPath());
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QDir::setCurrent("/data");
#else
QDir::setCurrent("/home");
@ -492,7 +492,7 @@ void tst_QTemporaryFile::renameFdLeak()
{
#ifdef Q_OS_UNIX
# if defined(Q_OS_ANDROID)
# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
ChdirOnReturn cor(QDir::currentPath());
QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
# endif
@ -701,7 +701,7 @@ void tst_QTemporaryFile::createNativeFile_data()
QTest::addColumn<bool>("valid");
QTest::addColumn<QByteArray>("content");
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt");
#else
const QString nativeFilePath = QFINDTESTDATA("resources/test.txt");

View File

@ -4,6 +4,6 @@ QT = core testlib
SOURCES = tst_qtranslator.cpp
RESOURCES += qtranslator.qrc
android: RESOURCES += android_testdata.qrc
android:!android-embedded: RESOURCES += android_testdata.qrc
else: TESTDATA += dependencies_la.qm hellotr_la.qm msgfmt_from_po.qm

View File

@ -64,7 +64,7 @@ tst_QTranslator::tst_QTranslator()
void tst_QTranslator::initTestCase()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QString sourceDir(":/android_testdata/");
QDirIterator it(sourceDir, QDirIterator::Subdirectories);
while (it.hasNext()) {

View File

@ -10,7 +10,7 @@ mac {
LIBS += -framework Foundation
}
android {
android:!android-embedded {
RESOURCES += \
android_testdata.qrc
}

View File

@ -5,7 +5,7 @@ SOURCES = tst_qchar.cpp
TESTDATA += data/NormalizationTest.txt
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}

View File

@ -187,7 +187,7 @@ void tst_QCollator::compare()
QCollator collator(locale);
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
if (collator.locale() != QLocale())
QSKIP("Posix implementation of collation only supports default locale");
#endif

View File

@ -512,7 +512,7 @@ void tst_QCommandLineParser::testVersionOption()
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Deploying executable applications to file system on Android not supported.");
#endif
@ -578,7 +578,7 @@ void tst_QCommandLineParser::testHelpOption()
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Deploying executable applications to file system on Android not supported.");
#endif
@ -625,7 +625,7 @@ void tst_QCommandLineParser::testQuoteEscaping()
{
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#elif defined(Q_OS_ANDROID)
#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Deploying executable applications to file system on Android not supported.");
#else
QCoreApplication app(empty_argc, empty_argv);

View File

@ -5,7 +5,7 @@ SOURCES = tst_qcryptographichash.cpp
TESTDATA += data/*
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}

View File

@ -5,7 +5,7 @@ SOURCES = tst_qtextboundaryfinder.cpp
TESTDATA += data
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}

View File

@ -5,6 +5,6 @@ SOURCES += tst_qimage.cpp
QT += core-private gui-private testlib
qtConfig(c++11): CONFIG += c++11
android: RESOURCES+=qimage.qrc
android:!android-embedded: RESOURCES += qimage.qrc
TESTDATA += images/*

View File

@ -5,7 +5,7 @@ MOC_DIR=tmp
QT += core-private gui-private network testlib
RESOURCES += qimagereader.qrc
android {
android:!android-embedded {
RESOURCES += android_testdata.qrc
}

View File

@ -3,5 +3,5 @@ TARGET = tst_qimagewriter
QT += testlib
SOURCES += tst_qimagewriter.cpp
MOC_DIR=tmp
android: RESOURCES+= qimagewriter.qrc
android:!android-embedded: RESOURCES += qimagewriter.qrc
TESTDATA += images/*

View File

@ -9,7 +9,7 @@ SOURCES += tst_qpainter.cpp
TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \
task217400.png
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}

View File

@ -40,7 +40,7 @@ private slots:
void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Not supported on Android");
#else

View File

@ -84,7 +84,7 @@ void tst_QSidebar::addUrls()
QAbstractItemModel *model = qsidebar.model();
QDir testDir = QDir::home();
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
// temp and home is the same directory on Android
testDir.mkdir(QStringLiteral("test"));
QVERIFY(testDir.cd(QStringLiteral("test")));

View File

@ -2657,7 +2657,7 @@ void tst_QGraphicsScene::render()
void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Test only works on platforms with resizable windows");
#endif
@ -2736,7 +2736,7 @@ protected:
void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Test fails on some Android devices (QTBUG-44430)");
#endif
@ -4009,7 +4009,7 @@ void tst_QGraphicsScene::polishItems2()
void tst_QGraphicsScene::isActive()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Fails on Android (QTBUG-44430)");
#endif

View File

@ -12,7 +12,7 @@ android {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}

View File

@ -112,7 +112,7 @@ void tst_QDirModel::getSetCheck()
void tst_QDirModel::initTestCase()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QString dataPath = SRCDIR;
QString resourceSourcePath = QStringLiteral(":/android_testdata");
QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories);
@ -614,7 +614,7 @@ void tst_QDirModel::task196768_sorting()
view.setSortingEnabled(true);
index2 = model.index(path);
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QEXPECT_FAIL("", "QTBUG-43818", Continue);
#else
if (EmulationDetector::isRunningArmOnX86())

View File

@ -6,7 +6,7 @@ QT += widgets widgets-private testlib testlib-private
SOURCES += tst_qlayout.cpp
TESTDATA += baseline/*
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}

View File

@ -337,7 +337,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
void tst_QLayout::testRetainSizeWhenHidden()
{
#if defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Test does not work on platforms which default to showMaximized()");
#endif

View File

@ -3,7 +3,7 @@ TARGET = tst_qstyle
QT += widgets testlib testlib-private
SOURCES += tst_qstyle.cpp
android {
android:!android-embedded {
RESOURCES += \
testdata.qrc
}