summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-09-24 17:30:08 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-09-24 17:30:08 +0200
commitf9394275f9b1b6e2c5bea01d661ead00809b934f (patch)
treef983e3316b44c406c605d570961f95e09c58757f /src/corelib/plugin
parente4ce8d107052a01a8b25097ab243aeccdd636aa7 (diff)
parent9a09af1cb712ede5720141fcc1b5eadef2fe953f (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp12
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp8
-rw-r--r--src/corelib/plugin/qpluginloader.cpp10
3 files changed, 29 insertions, 1 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 6737aeccd2..79315ae50f 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -193,7 +193,11 @@ void QFactoryLoader::update()
continue;
d->loadedPaths << pluginDir;
+#ifdef Q_OS_ANDROID
+ QString path = pluginDir;
+#else
QString path = pluginDir + d->suffix;
+#endif
if (qt_debug_component())
qDebug() << "QFactoryLoader::QFactoryLoader() checking directory path" << path << "...";
@@ -202,8 +206,10 @@ void QFactoryLoader::update()
continue;
QStringList plugins = QDir(path).entryList(
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN)
QStringList(QStringLiteral("*.dll")),
+#elif defined(Q_OS_ANDROID)
+ QStringList(QLatin1String("plugins_%1_*.so").arg(d->suffix)),
#endif
QDir::Files);
QLibraryPrivate *library = 0;
@@ -339,6 +345,10 @@ QFactoryLoader::QFactoryLoader(const char *iid,
#if QT_CONFIG(library)
d->cs = cs;
d->suffix = suffix;
+# ifdef Q_OS_ANDROID
+ if (!d->suffix.isEmpty() && d->suffix.at(0) == QLatin1Char('/'))
+ d->suffix.remove(0, 1);
+# endif
QMutexLocker locker(qt_factoryloader_mutex());
update();
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 44d5513163..f0de1010d7 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -236,6 +236,14 @@ bool QLibraryPrivate::load_sys()
auto attemptFromBundle = attempt;
pHnd = dlopen(QFile::encodeName(attemptFromBundle.replace(QLatin1Char('/'), QLatin1Char('_'))), dlFlags);
}
+ if (pHnd) {
+ using JniOnLoadPtr = jint (*)(JavaVM *vm, void *reserved);
+ JniOnLoadPtr jniOnLoad = reinterpret_cast<JniOnLoadPtr>(dlsym(pHnd, "JNI_OnLoad"));
+ if (jniOnLoad && jniOnLoad(QtAndroidPrivate::javaVM(), nullptr) == JNI_ERR) {
+ dlclose(pHnd);
+ pHnd = nullptr;
+ }
+ }
#endif
if (!pHnd && fileName.startsWith(QLatin1Char('/')) && QFile::exists(attempt)) {
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 4e0c3a511b..cadff4f32b 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -311,6 +311,16 @@ static QString locatePlugin(const QString& fileName)
for (const QString &path : qAsConst(paths)) {
for (const QString &prefix : qAsConst(prefixes)) {
for (const QString &suffix : qAsConst(suffixes)) {
+#ifdef Q_OS_ANDROID
+ {
+ QString pluginPath = basePath + prefix + baseName + suffix;
+ const QString fn = path + QLatin1String("/lib") + pluginPath.replace(QLatin1Char('/'), QLatin1Char('_'));
+ if (debug)
+ qDebug() << "Trying..." << fn;
+ if (QFileInfo(fn).isFile())
+ return fn;
+ }
+#endif
const QString fn = path + QLatin1Char('/') + basePath + prefix + baseName + suffix;
if (debug)
qDebug() << "Trying..." << fn;