Status Update
Comments
ch...@googlemail.com <ch...@googlemail.com> #2
For those who have the same problem: One workaround that solved the problem for me was to remove android:fitsSystemWindows="true"
from all children of the DrawerLayout - in case of the demo project, it is set on the NavigationView. I can't see any difference in layout or app behaviour, but the constant relayout messages have stopped.
I do not know why the children of DrawerLayout originally had this attribute set, that is the way the New Project wizard sets up an example with a DrawerLayout.
wi...@google.com <wi...@google.com> #3
No much finding.
For platform version < 31(before Android S), the API SplashScreen#installSplashScreen will do Activity#setTheme with the theme set by postSplashScreenTheme.
But since this issue won't happen on Android 11(Android R), set activity theme might not the root cause.
Hey Tiger, mind help take a look?
ti...@google.com <ti...@google.com> #4
Hi Alan,
Do you mind taking a look at this or routing to the owner of DrawerLayout?
Description
Component used: 'androidx.core:core-splashscreen:1.0.0' and 'androidx.drawerlayout:drawerlayout:1.1.1'
Devices/Android versions reproduced on:
The combination of a DrawerLayout with fitsSystemWindows=true and Splashscreen leads to a constant stream of messages on the MainLooper, which then will never become idle.
This has two effects:
I attached a sample project. When it is run on Android 9.0 , the idle handler on the mainlooper (from MainActivity#onCreate) is never called, and you can see constant logcat messages like
When the same app is run on Android 11.0, everthings seems to work fine, and
queueIdle: Queue is idle
is printed to the logcat.The issue seems to be connected to the window insets:
child.dispatchApplyWindowInsets
on its children - providing an inset with a top inset > 0requestApplyInsets
The children's' inset seems to change with each call between a top inset and no top inset.
I am not sure whether this is a bug in the DrawerLayout, but for some reason this only occurs when a SplashScreen is installed.