Status Update
Comments
jb...@google.com <jb...@google.com> #2
Please provide a minimal sample project that reproduces this issue.
ke...@payback.net <ke...@payback.net> #3
I have a similar issue. The background screen BackStackEntry does not enter RESUME state anymore or it is not updated. Only STARTED state. This happens when the dialog screen is launched as soon as the main screen is resumed. For example, for a screen that requires authentication and the authentication is launched as a dialog destination.
It worked fine in 2.8.4 but no more in 2.8.5. It could work the first time, but subsequently, it would not work.
ke...@payback.net <ke...@payback.net> #4
Here is a sample project to demo this issue.
qi...@gmail.com <qi...@gmail.com> #5
Sorry for the late reply. Attached is my sample project. If you open ExampleUnitTest.kt and run the test it will fail. If you open libs.version.toml and change the value of navigationCompose from 2.8.6 to 2.8.4 then the test will pass.
Description
Component used: Navigation Version used: 2.8.5 Devices/Android versions reproduced on: API 34 Emulator
If this is a bug in the library, we would appreciate if you could attach:
Upgrading to Navigation 2.8.5 has caused a number of our tests to fail. We have a custom
OnDestinationChangedListener
. Our test navigates to some dialog and then we pop it.onDestinationChanged
is called, and in 2.8.4 the prior screen'scontroller.currentBackStackEntry.lifecycle.currentState
isRESUMED
as expected.However, on 2.8.5 the prior screen's
controller.currentBackStackEntry.lifecycle.currentState
isSTARTED
instead after performing a pop. This change results in our customOnDestinationChangedListener
not behaving as expected. You can replicate in a Robolectric test like below:On 2.8.4 the output is:
But on 2.8.5 the output is:
Looking at 2.8.5's change listhttps://developer.android.com/jetpack/androidx/releases/navigation#2.8.5 I see some fixes to uncaught exceptions related to the lifecycle so I'm not sure if this is an intentional change. I've only been able to replicate this in tests and not in a dummy app; the lifecycle state is
RESUMED
as in 2.8.4