Status Update
Comments
ys...@google.com <ys...@google.com> #2
Branch: androidx-main
commit 6ebe664e0db444d2602f67a75a4deada37d0a72f
Author: stevebower <stevebower@google.com>
Date: Wed Oct 13 15:26:27 2021
Update transition handling in SwipeDismissableNavHost.
Transitions should reach Lifecycle.State.RESUMED
when animations are complete.
Test: androidx.wear.compose.navigation.
Bug: 202863359
Relnote: "Update transition handling in
SwipeDismissableNavHost"
Change-Id: I1cbe09cd902f785dcb68f11f098b340e4da1e55a
M wear/compose/compose-navigation/build.gradle
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
M wear/compose/compose-navigation/src/androidTest/kotlin/androidx/wear/compose/navigation/SwipeDismissableNavHostTest.kt
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/WearNavigator.kt
ys...@google.com <ys...@google.com> #3
Branch: androidx-main
commit d65ce67f974132fad4f26a3f72de6a3b3be2ec0d
Author: stevebower <stevebower@google.com>
Date: Fri Oct 15 09:48:16 2021
Wrap transition handling in SideEffect.
State outside this composable should be
updated in one of the Effect APIs
(as per late comments in aosp/1857639).
Test: androidx.wear.compose.navigation.
Bug: 202863359
Relnote: "Update transition handling in
SwipeDismissableNavHost in a SideEffect"
Change-Id: I04994074e7d024dcf857c156c8c265b57e3769f8
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
ys...@google.com <ys...@google.com> #4
Heads up - I ended up using repeatOnLifecycle(state = Lifecycle.State.STARTED)
in some code because repeatOnLifecycle(state = Lifecycle.State.RESUMED)
wasn't firing, and Alex mentioned this one.
Will provide a repro offline.
st...@google.com <st...@google.com> #5
Shared the repro offline. Steve, do you want me to open a diff bug?
da...@google.com <da...@google.com>
st...@google.com <st...@google.com>
st...@google.com <st...@google.com> #6
We'll just re-open this one.
st...@google.com <st...@google.com> #7
When swiping to dismiss, we trigger an animation and call popWithTransition so that the lifecycle does reached Resumed until the animation has completed (when onTransitionComplete gets called) - see WearNavigator::popBackStack.
The problem is that, if we call navController.popBackStack directly, that is also calling WearNavigator.popBackStack, which in turn calls popWithTransition - but there's no corresponding animation, so onTransitionComplete is not called and the lifecycle never reaches Resumed. Conversely, we should not call pop (without transition) for the case where animation is running, because the lifecycle would become Resumed too early.
st...@google.com <st...@google.com> #8
Branch: androidx-main
commit 4c67987dbc870d8e35d811af15ae3edb36f1c836
Author: stevebower <stevebower@google.com>
Date: Mon Mar 28 14:54:44 2022
Destinations do not reach Lifecycle RESUMED after popping the navigation back stack
Test: androidx.wear.compose.navigation
Bug: 202863359
Change-Id: Iff21b4603fd126120241661e066dfaf294d9c25c
M wear/compose/compose-navigation/src/androidTest/kotlin/androidx/wear/compose/navigation/SwipeDismissableNavHostTest.kt
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
il...@google.com <il...@google.com> #9
Calling LocalOwnersProvider
on a NavBackStackEntry
that has either never been created (unlikely, given that a NavBackStackEntry
is moved to CREATED
before it is given to any Navigator) or that has already been moved to destroyed (most likely) is indicative of a problem in SwipeDismissableNavHost
and how it handles onTransitionComplete()
- you should only be marking a transition as complete after that / synchronized with the removal of that destination from your composable hierarchy - thus ensuring that LocalOwnersProvider
won't be called on that particular NavBackStackEntry
ever again.
NavHost
does not run into this issue as it does handle transitions correctly, so this certainly seems to be something specific with SwipeDismissableNavHost
.
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 4a229ca6ef4cef2d5679334737290d71fe027d7b
Author: stevebower <stevebower@google.com>
Date: Wed Dec 01 13:04:01 2021
Do not show navigation content until Lifecycle state CREATED.
aosp/1871175 changed lifecycle state handling so that a
NavBackStackEntry starts in state INITIALIZED. Given that
WearNavigator pushes destinations without transitions,
SwipeDismissableNavHost must no longer show content until the
entry has reached at least state CREATED. Fixing this allows
us to build against latest navigation libraries.
Test: androidx.wear.compose.navigation
Bug: 207328687
Relnote: "Fixed an issue where NavBackStackEntry has lifecycle
state INITIALIZED and should not be shown until it has
lifecycle state CREATED."
Change-Id: I40a2ba51ec8805007dd11f531a5807e60f595a0d
M wear/compose/compose-navigation/build.gradle
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
il...@google.com <il...@google.com>
ys...@google.com <ys...@google.com> #11
Which version is this fixed in? It seemed to still happen with 1.0.0-Alpha12, but maybe I missed something else. Can reconfirm if it's meant to be already fixed in released alphas.
st...@google.com <st...@google.com> #12
The fix was submitted after the 1.0.0-Alpha12 release - should be available as a SNAPSHOT build.
Description
Component used: Wear Activity Version used: 1.0.0-beta01 Devices/Android versions reproduced on: Wear Emulator (API 30)
Works with 1.0.0-alpha03
Error on 1.0.0-beta01
I have a non public repro but haven't created a standalone repro yet.