Android: fix order of calling setApplicationState() in QtServiceBase

In QtServiceBase setApplicationState() is being called before
the Qt libs are loaded and that call invokes a native method,
so that leads to a crash/exception for UnsatisfiedLinkError.

Change-Id: I879d120f0cc2985ab49f7402a65f171950451914
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Janne Juntunen <janne.juntunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f292a669042df26d372985b16d4ab50ea6d4dca5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Assam Boudjelthia 2023-12-18 15:19:24 +02:00 committed by Qt Cherry-pick Bot
parent 5855be0fb3
commit 4992c74091

View File

@ -14,8 +14,6 @@ public class QtServiceBase extends Service {
{
super.onCreate();
QtNative.setApplicationState(QtNative.ApplicationState.ApplicationHidden);
// the application has already started, do not reload everything again
if (QtNative.getStateDetails().isStarted) {
Log.w(QtNative.QtTAG,
@ -30,6 +28,7 @@ public class QtServiceBase extends Service {
QtServiceLoader loader = new QtServiceLoader(this);
loader.loadQtLibraries();
QtNative.startApplication(loader.getApplicationParameters(), loader.getMainLibrary());
QtNative.setApplicationState(QtNative.ApplicationState.ApplicationHidden);
}
@Override