summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformwindow.cpp
diff options
context:
space:
mode:
authorJani Korteniemi <jani.korteniemi@qt.io>2025-04-24 06:37:52 +0200
committerJani Korteniemi <jani.korteniemi@qt.io>2025-06-19 21:40:11 +0300
commite40d9d43614b71c803a92fc640fc66f9a96cb095 (patch)
tree9da7ab9ba4fe63b457bf437c3ffd298fa77cc075 /src/plugins/platforms/android/qandroidplatformwindow.cpp
parent3cb3e84843cea6d54cdfa66712c714f909c7e91b (diff)
Destroy window surface after exit transition for Qt for Android apps
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. In QtActivityDelegate.setUpSplashScreen() set layout to use android device's DayNight theme colors to not show splash screen theme if window opacity is changed. Fixes: QTBUG-127705 Fixes: QTBUG-124140 Pickt-to: 6.8 6.9 6.10 Change-Id: I74adf693dac599c0b46b1f427e563683c1033565 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.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index cb252d1f084..c85917049d6 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -163,6 +163,16 @@ 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) {
+ bool lastVisibleWindow =
+ m_nativeQtWindow.callMethod<bool>("isLastVisibleTopLevelWindow");
+ m_nativeQtWindow.callMethod<void>("setToDestroy", !lastVisibleWindow);
+ if (lastVisibleWindow)
+ return;
+ }
if (!visible && window() == qGuiApp->focusWindow()) {
platformScreen()->topVisibleWindowChanged();
} else {