Fixed
Status Update
Comments
lo...@gmail.com <lo...@gmail.com> #2
Comment has been deleted.
il...@google.com <il...@google.com>
cl...@google.com <cl...@google.com> #3
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically ( b/140759491 ).
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
https://android-review.googlesource.com/1288456
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 12ca8d2235e10644b97685e34b274df2aff4b88a
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 12 20:03:53 2023
Update getBackStackEntry(route) implementation
If entry.destination is NavGraph, will will no longer search through entire NavGraph. It will only match with DeepLinks that were directly added to the NavGraph.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Change-Id: Iee25002e7a369bb3622258d5d7a5106bd546eb6e
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/2386908
Branch: androidx-main
commit 12ca8d2235e10644b97685e34b274df2aff4b88a
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 12 20:03:53 2023
Update getBackStackEntry(route) implementation
If entry.destination is NavGraph, will will no longer search through entire NavGraph. It will only match with DeepLinks that were directly added to the NavGraph.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Change-Id: Iee25002e7a369bb3622258d5d7a5106bd546eb6e
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit f38354df9f714ac6ace3d4d454a27137b880cf56
Author: Clara Fok <clarafok@google.com>
Date: Fri Jan 13 10:52:07 2023
Refactor NavController.popBackStackInternal
In preparation for popBackStack support on exact routes
Test: n/a
Bug: 257514373
Change-Id: I38210db9dc5f2182416a5f6a7fd734287a2e7a21
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/2387894
Branch: androidx-main
commit f38354df9f714ac6ace3d4d454a27137b880cf56
Author: Clara Fok <clarafok@google.com>
Date: Fri Jan 13 10:52:07 2023
Refactor NavController.popBackStackInternal
In preparation for popBackStack support on exact routes
Test: n/a
Bug: 257514373
Change-Id: I38210db9dc5f2182416a5f6a7fd734287a2e7a21
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit 718abc8e30980d228ad3811697cc95e11fe82c0c
Author: Clara Fok <clarafok@google.com>
Date: Fri Jan 13 11:44:28 2023
Add popBackStack support for exact routes
NavController.popBackStack(route) now supports routes with arguments partially or fully filled in, as long as the filled in arguments matches exactly the entry's filled in arguments.
This method defaults to original behavior of route matching through route pattern. If that fails, it recognizes the provided route as having
arguments filled in and will attempt to match with exact arguments.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Relnote: "NavController.popBackStack(route) now supports routes with arguments partially or fully filled in. Note that the arguments has to be an exact match with the entry's arguments."
Change-Id: I3b37b5d2dd9423bf095cce5632f5208abfe49d70
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/2387895
Branch: androidx-main
commit 718abc8e30980d228ad3811697cc95e11fe82c0c
Author: Clara Fok <clarafok@google.com>
Date: Fri Jan 13 11:44:28 2023
Add popBackStack support for exact routes
NavController.popBackStack(route) now supports routes with arguments partially or fully filled in, as long as the filled in arguments matches exactly the entry's filled in arguments.
This method defaults to original behavior of route matching through route pattern. If that fails, it recognizes the provided route as having
arguments filled in and will attempt to match with exact arguments.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Relnote: "NavController.popBackStack(route) now supports routes with arguments partially or fully filled in. Note that the arguments has to be an exact match with the entry's arguments."
Change-Id: I3b37b5d2dd9423bf095cce5632f5208abfe49d70
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-main
commit 4c92643420b7fa8460c5f089e4eccee13fdabbbe
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 10:20:48 2023
Refactor NavDestination#matchDeepLink
Test: n/a
Bug: 257514373
Change-Id: I0c0366f37f0b2ef0eb70151c6ffd7f2fd30a69cf
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
https://android-review.googlesource.com/2396199
Branch: androidx-main
commit 4c92643420b7fa8460c5f089e4eccee13fdabbbe
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 10:20:48 2023
Refactor NavDestination#matchDeepLink
Test: n/a
Bug: 257514373
Change-Id: I0c0366f37f0b2ef0eb70151c6ffd7f2fd30a69cf
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
ap...@google.com <ap...@google.com> #9
Project: platform/frameworks/support
Branch: androidx-main
commit 3323f0d63b410dc7c3e68c7377f520a063e23043
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 16:46:08 2023
Add clearBackStack support for exact routes
NavController.clearBackStack(route) now supports routes with arguments partially or fully filled in, as long as the route is exact match with route used to popBackStack(route).
This method defaults to original behavior of route matching through route pattern. If that fails, it recognizes the provided route as having arguments filled in and will attempt to match with exact arguments.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Relnote: "NavController.clearBackStack(route) now supports routes with arguments partially or fully filled in. Note that the arguments has to be an exact match with the route used to popBackStack(route)."
Change-Id: Ic678cf67db0f47f7b2778b039242773767735f2c
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/2396202
Branch: androidx-main
commit 3323f0d63b410dc7c3e68c7377f520a063e23043
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 16:46:08 2023
Add clearBackStack support for exact routes
NavController.clearBackStack(route) now supports routes with arguments partially or fully filled in, as long as the route is exact match with route used to popBackStack(route).
This method defaults to original behavior of route matching through route pattern. If that fails, it recognizes the provided route as having arguments filled in and will attempt to match with exact arguments.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Relnote: "NavController.clearBackStack(route) now supports routes with arguments partially or fully filled in. Note that the arguments has to be an exact match with the route used to popBackStack(route)."
Change-Id: Ic678cf67db0f47f7b2778b039242773767735f2c
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #10
Project: platform/frameworks/support
Branch: androidx-main
commit 6609c2dbffca40ed6ae2742efe153409d07c4ae3
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 10:56:04 2023
Refactor helper functions in Navigation
Refactored helper functions NavController.restoreStateInternal and NavDeeplink.hasRoute
Test: n/a
Bug: 257514373
Change-Id: I30e28856b20c1a61a4cb2e6754a675803f81b3c5
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/2396201
Branch: androidx-main
commit 6609c2dbffca40ed6ae2742efe153409d07c4ae3
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 10:56:04 2023
Refactor helper functions in Navigation
Refactored helper functions NavController.restoreStateInternal and NavDeeplink.hasRoute
Test: n/a
Bug: 257514373
Change-Id: I30e28856b20c1a61a4cb2e6754a675803f81b3c5
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #11
Project: platform/frameworks/support
Branch: androidx-main
commit 8bac1f9b2b66fbd29277b14bb16cc586c05969ac
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 10:46:44 2023
Updated findDestination and findNode for routes
NavController.findDestination(route) and NavGraph.findNode(route) maintains original behavior of first finding based on route converted to destinationId. But if that fails, it will search based on NavDestination.matchDeepLink.
Refactored existing test toStringStartDestInNodesRouteWithID because it now properly matches with the startDestination.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Change-Id: I2d1c78d459ac3efce485f0b1113cac3348e0cde9
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphAndroidTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/2396200
Branch: androidx-main
commit 8bac1f9b2b66fbd29277b14bb16cc586c05969ac
Author: Clara Fok <clarafok@google.com>
Date: Thu Jan 19 10:46:44 2023
Updated findDestination and findNode for routes
NavController.findDestination(route) and NavGraph.findNode(route) maintains original behavior of first finding based on route converted to destinationId. But if that fails, it will search based on NavDestination.matchDeepLink.
Refactored existing test toStringStartDestInNodesRouteWithID because it now properly matches with the startDestination.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 257514373
Change-Id: I2d1c78d459ac3efce485f0b1113cac3348e0cde9
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphAndroidTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
cl...@google.com <cl...@google.com> #12
This has been fixed internally and will be available in navigation 2.6.0-alpha05
pr...@google.com <pr...@google.com> #13
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.6.0-alpha05
androidx.navigation:navigation-runtime:2.6.0-alpha05
hu...@lunabee.com <hu...@lunabee.com> #14
Hi, If we have a NavHost like this:
val route = "home?opt={argOpt}"
NavHost(navController = navController, startDestination = route) {
composable(
route = route,
arguments = listOf(
navArgument("opt") {
type = NavType.StringType
nullable = true
defaultValue = null
},
),
)
}
The following methods don't work:
navController.getBackStackEntry("home") // or "home?" or "home?opt=" <- Lead to crash
navController.popBackStack("home", false) } // or "home?" or "home?opt=" <- ignore navigation
However, if we put a default value different than null
, it's working.
Is it possible to popback
to a destination with a default value set to null
?
il...@google.com <il...@google.com> #15
Re "home"
and "home?opt=null"
should work.
Description
Currently, the Navigation APIs that take routes actually use something that is more like a route pattern without any specific arguments that could be used to differentiate the routes. So when you call
getBackStackEntry(route)
orpopBackStack(route)
navigation cannot differentiate between two destinations that may have the same route pattern, but with different arguments.We could add other APIs that take a route pattern instead that maintains the old behavior and change the current APIs to consider the exact route. This would allow Navigation to differentiate between destinations with the same route pattern and different arguments.