diff options
author | Samuel Mira <samuel.mira@qt.io> | 2022-02-15 19:25:02 +0200 |
---|---|---|
committer | Samuel Mira <samuel.mira@qt.io> | 2022-03-02 11:23:54 +0200 |
commit | fef455999aa2930289137115ab446761cd4b40db (patch) | |
tree | 525e0294f24a710f4a303a1c2386d1cc5d858604 /src/plugins/platforms/android/androidjnimain.cpp | |
parent | 18f386782739ce96e212e187f84aa40c90c96919 (diff) | |
download | qtbase-fef455999aa2930289137115ab446761cd4b40db.tar.gz |
Android: Fix issue in loading multimedia Android plugin
Qt projects on Android were failing to correctly load the plugin lib.
The main reason is missing environment variables when the media
integration starts. To make sure that the variables are loaded, I have
change the setenv to be done in the java side instead of c++ side.
Fixes: QTBUG-100299
Pick-to: 6.3
Change-Id: Iba0b6af40574be2d88824ebdcfb1626335cecf09
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/androidjnimain.cpp')
-rw-r--r-- | src/plugins/platforms/android/androidjnimain.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index b62624c7b5..280cfa2c53 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -472,22 +472,12 @@ namespace QtAndroid } // namespace QtAndroid -static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring paramsString, jstring environmentString) +static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring paramsString) { m_androidPlatformIntegration = nullptr; m_androidAssetsFileEngineHandler = new AndroidAssetsFileEngineHandler(); m_androidContentFileEngineHandler = new AndroidContentFileEngineHandler(); m_mainLibraryHnd = nullptr; - { // Set env. vars - const char *nativeString = env->GetStringUTFChars(environmentString, 0); - const QList<QByteArray> envVars = QByteArray(nativeString).split('\t'); - env->ReleaseStringUTFChars(environmentString, nativeString); - for (const QByteArray &envVar : envVars) { - int pos = envVar.indexOf('='); - if (pos != -1 && ::setenv(envVar.left(pos), envVar.mid(pos + 1), 1) != 0) - qWarning() << "Can't set environment" << envVar; - } - } const char *nativeString = env->GetStringUTFChars(paramsString, 0); QByteArray string = nativeString; @@ -798,8 +788,7 @@ static jobject onBind(JNIEnv */*env*/, jclass /*cls*/, jobject intent) } static JNINativeMethod methods[] = { - { "startQtAndroidPlugin", "(Ljava/lang/String;Ljava/lang/String;)Z", - (void *)startQtAndroidPlugin }, + { "startQtAndroidPlugin", "(Ljava/lang/String;)Z", (void *)startQtAndroidPlugin }, { "startQtApplication", "()V", (void *)startQtApplication }, { "quitQtAndroidPlugin", "()V", (void *)quitQtAndroidPlugin }, { "quitQtCoreApplication", "()V", (void *)quitQtCoreApplication }, |