Details
-
Technical task
-
Resolution: Unresolved
-
P1: Critical
-
None
-
None
-
-
2025wk02s3FOQtforAndroid, 2025wk04s3FOQtforAndroid
-
2d2b9fea7 (dev)
Description
Whenever we an orientation change in an Android app, it's quite noticeable and very often there will be a flicker(s), sometimes right before the geometry starts to change from portrait ↔ landscape or vise versa, and right, during and after the change as well.
The cause seems to be wrong order of geometry change between Java (under QtLayout.onMeasure(), QtLayout.onLayout() and QtRootLayout.onSizeChange()), and C++ size when the screen geometry and available geometry are also emitted.
Potentially as well is the existence of some circular geometry changes, where after the size of the app changes in Java side, it notifies C+, then C+ changes it's geometry and draw changes, then tries to set the geometry back Java as if the change started from C++.
Below is the current transition frames:
It is also good to note that this bug happens more often when changing from portrait to landscape compared to landscape to portrait, but it's valid for both cases. For reproduction use fullscreen-transition-flicker-bug.zip.
Places to look at when debugging this:
- QtRootLayout.onSizeChanged()
- QtLayout.onLayout() which is invoked after QtLayout.onMeasure()
- QtWindow.setGeometry()
- androidjnimain.cpp:setDisplayMetrics()
- QAndroidPlatformScreen::setAvailableGeometry() and QPlatformScreen::resizeMaximizedWindows()
Similar or duplicate bugs:
QTBUG-88676QTBUG-110411(the bug being related to backing store most likely not the case)QTBUG-132299QTBUG-132370
Outcome
Have Android apps change orientation with minimum size calls, without flicker or rendering artifacts.
Make sure this still works for https://github.com/qt/qtdoc/tree/6.9/examples/demos/windowembedding.
Attachments
Issue Links
- is duplicated by
-
QTBUG-132370 Gallery Controls 2: When changing between portrait and landscape, the ui occasionally positions incorrectly.
- Closed
- replaces
-
QTBUG-110411 Flicker when re-drawing display
- Closed
-
QTBUG-88676 [Android] Black bar artifact while changing orientations
- Closed
Gerrit Reviews
For Gerrit Dashboard: QTBUG-132718 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
614932,8 | WIP:Android: use layout() to set new geometry | dev | qt/qtbase | Status: NEW | -2 | 0 |
615243,4 | Android: simplify orientation change handling | dev | qt/qtbase | Status: MERGED | +2 | 0 |