diff --git a/CMakeLists.txt b/CMakeLists.txt index d6cdaac0b..ca4ab5f83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ string(TIMESTAMP CURRENT_DATE "%Y-%m-%d") set(RELEASE_DATE "${CURRENT_DATE}") set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}) -set(APP_ANDROID_VERSION_CODE 2117) +set(APP_ANDROID_VERSION_CODE 2118) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(MZ_PLATFORM_NAME "linux") diff --git a/client/amnezia_application.cpp b/client/amnezia_application.cpp index c53059302..c6c8d672e 100644 --- a/client/amnezia_application.cpp +++ b/client/amnezia_application.cpp @@ -109,6 +109,16 @@ void AmneziaApplication::init() // install filter on main window if (auto win = qobject_cast(obj)) { win->installEventFilter(this); +#ifdef Q_OS_ANDROID + QObject::connect(win, &QQuickWindow::sceneGraphError, + [](QQuickWindow::SceneGraphError, const QString &msg) { + qWarning() << "Scene graph error (suppressed):" << msg; + }); + // Keep graphics context alive across hide/show cycles to avoid + // eglSwapBuffers/makeCurrent being called on a context Android has reclaimed. + win->setPersistentSceneGraph(true); + win->setPersistentGraphics(true); +#endif win->show(); } }, diff --git a/client/ui/qml/main2.qml b/client/ui/qml/main2.qml index 1ab549601..a95044d91 100644 --- a/client/ui/qml/main2.qml +++ b/client/ui/qml/main2.qml @@ -21,10 +21,14 @@ Window { function onStateChanged() { if (Qt.platform.os === "android") { if (Qt.application.state === Qt.ApplicationActive) { + root.visible = true refreshTimer.restart() - } else if (Qt.application.state === Qt.ApplicationSuspended || - Qt.application.state === Qt.ApplicationInactive) { - console.log("QML: Application going to background, state:", Qt.application.state) + } else if (Qt.application.state === Qt.ApplicationSuspended) { + // Hide window to stop the Qt render loop and prevent + // eglSwapBuffers from being called on a lost EGL context. + // NOTE: Do NOT hide on ApplicationInactive — that fires on any + // focus change (IME, notifications) and would blank the screen. + root.visible = false } } }