Assigned
Status Update
Comments
be...@google.com <be...@google.com> #2
This actually has nothing to do with NavHostFragment, but is the behavior of NavController's setGraph().
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
ct...@atlassian.com <ct...@atlassian.com> #3
Turns out, we already had a tracking bug for this issue, will follow up on that other one.
ra...@google.com <ra...@google.com> #4
Thank you for promptly replying to my report. You are right that the issue you've just mentioned is similar to mine. I shall continue observing the progress over there.
ct...@atlassian.com <ct...@atlassian.com> #5
Can confirm I still see the issue in 1.8.0-beta02 ;(
ct...@atlassian.com <ct...@atlassian.com> #6
Even with the bandaid workaround we saw 1% of sessions in prod crashing with the second trace from the OP and decided to revert compose ui back to the stable BoM. Unfortunately that introduces this focus bug
Description
Jetpack Compose version: androidx.compose.ui:ui:1.8.0-alpha02
Jetpack Compose component(s) used: ui, viewinterop
Android Studio Build: 2024.2.2
Kotlin version: 2.1.0
Steps to Reproduce or Code Sample to Reproduce:
Working on a simple repro for this issue, but it seems to be related to giving focus to an EditText in an AndroidView under certain circumstances and seems liable to happen on any device.
We shipped androidx.compose.ui:ui:1.8.0-alpha08 in our latest beta to pick up some AndroidView bug fixes and are now seeing the following crashes affecting a very significant ~3% of our users so far.
The repro is very elusive, but narrowed it down to androidx.compose.ui:ui:1.8.0-alpha02 introducing the issue - very likely this change based on the tracehttps://android.googlesource.com/platform/frameworks/support/+/58377bb3416cc24d342dd4e5d32e4a27247734e4 .
Would greatly appreciate any suggested workarounds or fixes 🙏
Stack trace (if applicable):
and also