summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformwindow.cpp
diff options
context:
space:
mode:
authorJani Korteniemi <jani.korteniemi@qt.io>2025-07-10 15:03:17 +0300
committerJani Korteniemi <jani.korteniemi@qt.io>2025-07-24 19:52:41 +0300
commit5ef73686cfb488dfc6a4077a2ecb12f883de1461 (patch)
tree4f80c17fa5c28bc0dddc59ee93f388c48de4324b /src/plugins/platforms/android/qandroidplatformwindow.cpp
parent26b349f5693559e26e88c118812476bcc6aed8d3 (diff)
Re-land: Android: destroy the window surface only after exit transition
Splash screen (or blank launch screen) is shown when exiting the Android application caused by hiding shown windows and destroying it's surface before application exit. On application exit all windows are first set to invisible then surfaces destroyed and finally removed from layout. Also window opacity change can show underlying splash screen as it is set as theme for the application. When pressing Android device's back button application either should hide current window or exit the application. When exiting current window should be visible during application exit. Add AtomicBoolean m_canBeDestroyed to QtWindow for blocking normal surface removal. Set false by default from QtActivityDelegate.addTopLevelWindow and changed from QAndroidPlatformWindow::setVisible() dependent on if there are more visible windows present. Destroy last window with delay so it can be shown during app exit. Set full screen flags for current window on pre Android 11 so it's decor view can scale to full screen on multi-window mode view is when updated. In QtActivityDelegate.setUpSplashScreen() set layout to use android device's DayNight theme colors to not show splash screen theme if window opacity is changed. Previous reverted change caused crashed tst_qmltc_examples test. Previous SHA e40d9d43614b71c803a92fc640fc66f9a96cb095 Fixes: QTBUG-127705 Task-number: QTBUG-124140 Pick-to: 6.8 6.9 6.10 Change-Id: Ifda904c08c3b4363005e953e5ba9ff15a46e5195 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformwindow.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index 194a08ee09f..efc62047e3e 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -168,6 +168,13 @@ void QAndroidPlatformWindow::setVisible(bool visible)
return;
if (window()->isTopLevel()) {
+ // Do not hide last Qt for Android window.
+ // We don't want the splash screen to be shown during the app's
+ // exit because it would be the foremost visible screen.
+ if (QtAndroid::isQtApplication() && !visible) {
+ visible = m_nativeQtWindow.callMethod<bool>("isLastVisibleTopLevelWindow");
+ m_nativeQtWindow.callMethod<void>("setToDestroy", !visible);
+ }
if (!visible && window() == qGuiApp->focusWindow()) {
platformScreen()->topVisibleWindowChanged();
} else {