Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit d42f2cdcc692b0e897347377981fddfb54b23405
Author: Clara Fok <clarafok@google.com>
Date: Tue Feb 27 15:20:26 2024
Fix NavArgument equality check for Array args
NavController functions that are based on route rely on `NavDestination#hasMatchingArgs` to match the provided route with a NavDestination.
Previously, the equality check in `hasMatchingArgs` for Array NavTypes erroneously checks for object reference. Now should checks for equality in array content.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 327229511
Relnote: "NavController functions that support routes such as navigate or popBackStack can now properly match routes filled with arguments of Array NavTypes."
Change-Id: Iea8056fe8293e65a80ed53d0e0522967fdb12af1
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
https://android-review.googlesource.com/2980580
Branch: androidx-main
commit d42f2cdcc692b0e897347377981fddfb54b23405
Author: Clara Fok <clarafok@google.com>
Date: Tue Feb 27 15:20:26 2024
Fix NavArgument equality check for Array args
NavController functions that are based on route rely on `NavDestination#hasMatchingArgs` to match the provided route with a NavDestination.
Previously, the equality check in `hasMatchingArgs` for Array NavTypes erroneously checks for object reference. Now should checks for equality in array content.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 327229511
Relnote: "NavController functions that support routes such as navigate or popBackStack can now properly match routes filled with arguments of Array NavTypes."
Change-Id: Iea8056fe8293e65a80ed53d0e0522967fdb12af1
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
cl...@google.com <cl...@google.com> #3
Fixed internally, available in navigation-2.8.0-alpha05
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 5cb6f32cca88feb8930f18c264e7003652235f82
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 04 12:03:25 2024
Add new valueEquals API for NavType
NavType.valueEquals can be overriden to compare equality of complex types. Defaults to this == other implementation.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 327229511
Relnote: "NavType has a new API valueEquals that takes two values of type T and returns true if the two values are equal to each other. This function can be overriden to check equality for complex types."
Change-Id: I6cb97c9b4a9992c5358f76c6940c2d9b78149f26
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavTypeTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavType.kt
https://android-review.googlesource.com/2982008
Branch: androidx-main
commit 5cb6f32cca88feb8930f18c264e7003652235f82
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 04 12:03:25 2024
Add new valueEquals API for NavType
NavType.valueEquals can be overriden to compare equality of complex types. Defaults to this == other implementation.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 327229511
Relnote: "NavType has a new API valueEquals that takes two values of type T and returns true if the two values are equal to each other. This function can be overriden to check equality for complex types."
Change-Id: I6cb97c9b4a9992c5358f76c6940c2d9b78149f26
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavTypeTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavType.kt
pr...@google.com <pr...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.8.0-alpha05
androidx.navigation:navigation-runtime:2.8.0-alpha05
Description
The equality check in `hasMatchingArgs` for Array NavTypes erroneously checks for object reference when it should check array content.
This fix is required for existing NavControllers functions as well as upcoming NavController APIs for Safe Args.