Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
It is working as intended that the parent NavGraphs are on the internal back stack, despite NavGraphNavigator.navigate() not being called (this is required to ensure that global actions work as intended). We'll look into why popBackStack() isn't working for your case.
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit bf45634f0522209efd5b93e9dbae665d3454b30c
Author: jbwoods <jbwoods@google.com>
Date: Fri May 17 14:55:12 2019
Remove back stack from NavGraphNavigator
When using navigate via deeplink across graphs, we add the appropriate
parents to the navController back stack, but we do not add any parents
to the NavGraphNavigator back stack. This causes an issue when we pop
a destination that was navigated to via deep link, where an extra
navGraph is removed from the NavGraphNavigator back stack.
Eventually, the NavGraphNavigator gets to the root and it is
impossible to return back from the deep link destination.
We no longer need the NavGraphNavigator back stack and can allow the
DestinationNavigator to manage pop operations. Removing the back stack
also means we can remove save state methods as well.
Test: New test, navigation tests
BUG: 132509387
Change-Id: I811282e359c0bc2ee04fd8aba4dfc6c9d50855f6
D navigation/common/src/androidTest/java/androidx/navigation/NavGraphNavigatorStateTest.kt
M navigation/common/src/main/java/androidx/navigation/NavGraphNavigator.java
M navigation/common/src/test/java/androidx/navigation/NavGraphNavigatorTest.kt
M navigation/runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/runtime/src/androidTest/res/navigation/nav_multiple_navigation.xml
https://android-review.googlesource.com/964419
https://goto.google.com/android-sha1/bf45634f0522209efd5b93e9dbae665d3454b30c
Branch: androidx-master-dev
commit bf45634f0522209efd5b93e9dbae665d3454b30c
Author: jbwoods <jbwoods@google.com>
Date: Fri May 17 14:55:12 2019
Remove back stack from NavGraphNavigator
When using navigate via deeplink across graphs, we add the appropriate
parents to the navController back stack, but we do not add any parents
to the NavGraphNavigator back stack. This causes an issue when we pop
a destination that was navigated to via deep link, where an extra
navGraph is removed from the NavGraphNavigator back stack.
Eventually, the NavGraphNavigator gets to the root and it is
impossible to return back from the deep link destination.
We no longer need the NavGraphNavigator back stack and can allow the
DestinationNavigator to manage pop operations. Removing the back stack
also means we can remove save state methods as well.
Test: New test, navigation tests
BUG: 132509387
Change-Id: I811282e359c0bc2ee04fd8aba4dfc6c9d50855f6
D navigation/common/src/androidTest/java/androidx/navigation/NavGraphNavigatorStateTest.kt
M navigation/common/src/main/java/androidx/navigation/NavGraphNavigator.java
M navigation/common/src/test/java/androidx/navigation/NavGraphNavigatorTest.kt
M navigation/runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/runtime/src/androidTest/res/navigation/nav_multiple_navigation.xml
il...@google.com <il...@google.com> #4
We've fixed the underlying issue internally and it'll be available in the upcoming Navigation 2.1.0-alpha05 release.
Description
Version used: 2.1.0-alpha03
Devices/Android versions reproduced on:
If you repeat Navigate with URI, the back key does not work.
I'll attach the sample project. Please check below how to reproduction.
1. Tap `MOVE TO A`
2. Tap `MOVE TO B`
3. Tap `MOVE TO D` (Navigate with URI to another nav graph)
4. Press back key.
5. Repeat step 3 and step 4 2 times
6. We can't back to Fragment A.
I think mBackStack is not correct in NavGraphNavigator and NavController.
When step3, NavGraphNavigator#navigate is not called, but NavGraph is added to NavController.mBackStack.
Thanks.