Status Update
Comments
va...@google.com <va...@google.com> #2
Attached reproducing video of an app using calculateWindowSizeClass
and LocalConfiguration
:
On the second time resizing to be 50%/50% from smaller, the displayed configuration is incorrect.
lp...@google.com <lp...@google.com> #3
When resizing the activity in multi-window mode under those conditions, there are cases where:
the Activity is not recreated Activity.onConfigurationChanged is not called View.onConfigurationChanged is not called
Is this just for 33 / is there a framework bug filed? The amount of broken things in configuration land we already had to workaround in Compose is a bit untenable. It seems like we are missing a lot of test coverage in the platform to avoid these issues hitting us in the future
lp...@google.com <lp...@google.com> #4
In any case this seems like more ammunition for us to push more strongly on 'pure-compose apps should always opt out of configuration changes'
va...@google.com <va...@google.com> #5
Yes, API 33 introduced this behavior, (internal) platform bug is here:
va...@google.com <va...@google.com> #6
I was incorrect, this is also reproducible on API 32 as well. Not reproducible on API 31.
js...@google.com <js...@google.com> #7
Adam/Louis, how do we want to handle this one? Is there someone on platform who should take this, or since API 32 is already out in the wild maybe this should go to devrel to push more strongly on 'pure-compose apps should always opt out of configuration changes'.
ar...@gmail.com <ar...@gmail.com> #8
te...@gmail.com <te...@gmail.com> #9
I'm having issues on pre-33 api levels on a pure compose app (has all configChanges added in the manifest file) pared with AppCompatActivity
just for multi language support. When changing the language I'm using AppCompatDelegate.setApplicationLocales(compat)
which calls onConfigurationChanged
on the activity. LocalConfiguration changes to the new configuration on 33+ but remains the same on pre-33. Workaround that i've found is calling if (Build.VERSION.SDK_INT < 33) contentView.dispatchConfigurationChanged(newConfig)
in onConfigurationChanged
. I'm guessing it's a compose issue since activity wise everything works as expected.
va...@google.com <va...@google.com> #10
LocalConfiguration
but a separate issue.
te...@gmail.com <te...@gmail.com> #11
Thanks for the heads up, I've tried to find a related issue but only managed to find this one after a brief search.
pe...@gmail.com <pe...@gmail.com> #12
Ok
pe...@gmail.com <pe...@gmail.com> #13
Thanks for the heads up, I've tried to find a related issue but only managed to find this one after a brief search.
Description
Conditions:
android:configChanges
is empty or only has unrelated entries)When resizing the activity in multi-window mode under those conditions, there are cases where:
Activity
is not recreatedActivity.onConfigurationChanged
is not calledView.onConfigurationChanged
is not calledBecause
LocalConfiguration.current
is driven byView.onConfigurationChanged
at the moment, this results inLocalConfiguration.current
not updating, and getting out of sync with the underlyingActivity
configuration.In the above, constantly polling for the
Activity
configuration reveals that it is changing (when resizing happens), butLocalConfiguration.current
does not update.This particularly matters for
material3-window-size-class
, since theLocalConfiguration.current
is used as a signal to relcalculate the window metricsWorkarounds or potential fixes:
LocalConfiguration.current
to the current configuration, sinceView.onConfigurationChanged
may not always be calledandroid:configChanges
for the screen size changes, to ensure thatView.onConfigurationChanged
is called