Android: don't run setSystemUiVisibility with same params

Cache fullscreen and expandedToCutout values and run
setSystemUiVisibility() only when changes has been
made.

Task-number: QTBUG-132720
Change-Id: I51559e485653d4091e79391962bc82042714f7be
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
This commit is contained in:
Assam Boudjelthia 2024-12-12 03:25:58 +02:00
parent 0fb3661f13
commit 2c40e9b91c
2 changed files with 9 additions and 2 deletions

View File

@ -262,8 +262,12 @@ void QAndroidPlatformWindow::updateSystemUiVisibility()
if (!isNonRegularWindow) {
const bool isFullScreen = (m_windowState & Qt::WindowFullScreen);
const bool expandedToCutout = (flags & Qt::ExpandedClientAreaHint);
QtAndroid::backendRegister()->callInterface<QtJniTypes::QtWindowInterface, void>(
"setSystemUiVisibility", isFullScreen, expandedToCutout);
if (m_isFullscreen != isFullScreen || m_expandedToCutout != expandedToCutout) {
m_isFullscreen = isFullScreen;
m_expandedToCutout = expandedToCutout;
QtAndroid::backendRegister()->callInterface<QtJniTypes::QtWindowInterface, void>(
"setSystemUiVisibility", isFullScreen, expandedToCutout);
}
}
}

View File

@ -112,6 +112,9 @@ private:
Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(safeAreaMarginsChanged)
[[nodiscard]] QMutexLocker<QMutex> destructionGuard();
bool m_isFullscreen;
bool m_expandedToCutout;
};
QT_END_NAMESPACE