Status Update
Comments
au...@gmail.com <au...@gmail.com> #2
This is a particularly hard device to come by - do you happen to have access to the device? If so could you provide us with the output of: adb shell dumpsys media.camera > info.txt
Thanks!
si...@gmail.com <si...@gmail.com> #3
Stacktrace:
Caused by: java.lang.IllegalArgumentException: Can not get supported output size under supported maximum for the format: 34
at androidx.camera.camera2.internal.SupportedSurfaceCombination.getSupportedOutputSizes(SupportedSurfaceCombination.java:355)
at androidx.camera.camera2.internal.SupportedSurfaceCombination.getSuggestedResolutions(SupportedSurfaceCombination.java:197)
at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.getSuggestedResolutions(Camera2DeviceSurfaceManager.java:198)
at androidx.camera.core.CameraX.calculateSuggestedResolutions(CameraX.java:943)
at androidx.camera.core.CameraX.bindToLifecycle(CameraX.java:293)
at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:227)
Below are some findings based on our debugging
When Dex is connected
previewConfig.getMaxResolution() is returning "731x411" as maxSize.
Inside Preview.Builder.build() -> Default_MAX_resolution is set to "CameraX.getSurfaceManager().getPreviewSize()" which is 731x411
this is being picked as maxSize.
While rendering maxSize is 731x411 and minSize is 640x480 and below are available outputSizes
0 = {Size@11860} "4032x3024"
1 = {Size@11861} "3984x2988"
2 = {Size@11862} "4032x2268"
3 = {Size@11863} "3024x3024"
4 = {Size@11864} "2976x2976"
5 = {Size@11865} "3840x2160"
6 = {Size@11866} "3264x2448"
7 = {Size@11867} "4032x1960"
8 = {Size@11868} "2880x2160"
9 = {Size@11869} "3264x1836"
10 = {Size@11870} "2160x2160"
11 = {Size@11871} "2560x1440"
12 = {Size@11872} "2224x1080"
13 = {Size@11873} "2048x1152"
14 = {Size@11874} "1920x1080"
15 = {Size@11875} "1440x1080"
16 = {Size@11876} "1088x1088"
17 = {Size@11877} "1280x720"
18 = {Size@11878} "1024x768"
19 = {Size@11879} "1056x704"
20 = {Size@11880} "960x720"
21 = {Size@11881} "960x540"
22 = {Size@11882} "720x720"
23 = {Size@11883} "800x450"
24 = {Size@11884} "720x480"
25 = {Size@11885} "640x480"
26 = {Size@11886} "352x288"
27 = {Size@11887} "320x240"
28 = {Size@11888} "256x144"
29 = {Size@11889} "176x144"
and couldn't find any size in this range.
When Dex not connected
minsize = 640x480
maxsize = 1920x1080
0 = {Size@11836} "4032x3024"
1 = {Size@11837} "3984x2988"
2 = {Size@11838} "4032x2268"
3 = {Size@11839} "3024x3024"
4 = {Size@11840} "2976x2976"
5 = {Size@11841} "3840x2160"
6 = {Size@11842} "3264x2448"
7 = {Size@11843} "4032x1960"
8 = {Size@11844} "2880x2160"
9 = {Size@11845} "3264x1836"
10 = {Size@11846} "2160x2160"
11 = {Size@11847} "2560x1440"
12 = {Size@11848} "2224x1080"
13 = {Size@11849} "2048x1152"
14 = {Size@11850} "1920x1080"
15 = {Size@11851} "1440x1080"
16 = {Size@11852} "1088x1088"
17 = {Size@11853} "1280x720"
18 = {Size@11854} "1024x768"
19 = {Size@11855} "1056x704"
20 = {Size@11856} "960x720"
21 = {Size@11857} "960x540"
22 = {Size@11858} "720x720"
23 = {Size@11859} "800x450"
24 = {Size@11860} "720x480"
25 = {Size@11861} "640x480"
26 = {Size@11862} "352x288"
27 = {Size@11863} "320x240"
28 = {Size@11864} "256x144"
29 = {Size@11865} "176x144"
and we have 12 available sizes in this range
Camera2DeviceSurfaceManager.java:: getPreviewSize()
mCameraSupportedSurfaceCombinationMap.get(cameraId).getSurfaceDefinition().getPreviewSize() = "1920x1080"
cameraId=0
si...@gmail.com <si...@gmail.com> #4
The issue root cause is that CameraX will default filter out sizes smaller than 640x480. For Preview, the max size will be limited to under display size. I checked the HW spec info for the issue related devices. Display size of FUJITSU F-04J/F-05J is 360x640. That will result int that no size exists in the conditions that is larger or equal to 640x480 and smaller or equal to 360x640.
A temporary workaround for this situation is to use Preview.Builder#setTargetResolution() to set a size smaller than 640x480 to bypass the problem.
For device FUJITSU arrowsM04, I checked its HW spec info and its display size I found is 1280x720. It seems that the problem should not exist in the device.
Could you confirm that the problem exist on arrowsM04 device? What will be the returned value when using Display#getRealSize to obtain the display size?
ye...@gmail.com <ye...@gmail.com> #5
> A temporary workaround for this situation is to use Preview.Builder#setTargetResolution() to set a size smaller than 640x480 to bypass the problem.
OK. I will try it.
> Could you confirm that the problem exist on arrowsM04 device?
We receive the crash report (Crashlytics) that this crash has occurred on arrowsM04.
We don't have this device so we can't confirm that the problem really exist on arrowsM04.
> What will be the returned value when using Display#getRealSize to obtain the display size?
We can't investigate it for the same reason.
Thank you.
ye...@gmail.com <ye...@gmail.com> #6
This issue happened on devices that the display size is smaller than 640x480. In original auto-resolution mechanism, supported sizes smaller than 640x480 will be default filter out.
The auto-resolution mechanism encodes the guaranteed configurations tables in CameraDevice#createCaptureSession(SessionConfiguration). It defines that the PREVIEW size is the small one of the device display size and 1080p. The PREVIEW size will be the maximal size limitation for Preview use case. The reason it limits the size to display size and 1080p is the stream output in display size or 1080p has been able to provide good enough preview quality. Therefore, auto-resolution mechanism will limit the selected size to be smaller than the small one of the device display size and 1080p.
With above two conditions, in this issue, all sizes smaller than 640x480 have been filter out, therefore, there is no size smaller than the display size 320x240 can be selected to use. And cause the exception.
Solution:
When the display size is smaller than 640x480, auto-resolution mechanism won't filter out those small sizes smaller than 640x480. This makes those small size be left and can be selected for the Preview use case on small display devices.
The solution has been merged and will be included in next CameraX release.
ni...@gmail.com <ni...@gmail.com> #7
Hello.
This crash still occurs.
- CAMERAX VERSION: 1.0.0-beta4
- ANDROID OS BUILD NUMBER: Android 7.1.1
- DEVICE NAME: FUJITSU F-02H
We receive following crash report from FUJITSU F-02H. So far We have received this crash report only from F-02H.
java.lang.IllegalArgumentException
Can not get supported output size under supported maximum for the format: 34
androidx.camera.camera2.internal.SupportedSurfaceCombination.getSupportedOutputSizes (SupportedSurfaceCombination.java:349)
androidx.camera.camera2.internal.SupportedSurfaceCombination.getSuggestedResolutions (SupportedSurfaceCombination.java:197)
androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.getSuggestedResolutions (Camera2DeviceSurfaceManager.java:198)
androidx.camera.core.CameraX.calculateSuggestedResolutions (CameraX.java:949)
androidx.camera.core.CameraX.bindToLifecycle (CameraX.java:351)
androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle (ProcessCameraProvider.java:230)
(our application's package name).CameraFragment.bindCameraUseCases (CameraFragment.java:174)
hu...@ril.com <hu...@ril.com> #8
Could you help to provide the following information to clarify the issue?
1. Is the full name of the device Fujitsu Arrows NX F-02H that has a 1440x2560 display?
2. Please help to provide the supported output sizes of ImageFormat.PRIVATE that is obtained by StreamConfigurationMap#getOutputSizes(int).
jb...@google.com <jb...@google.com>
li...@gmail.com <li...@gmail.com> #9
- Is the full name of the device Fujitsu Arrows NX F-02H that has a 1440x2560 display?
Yes
- Please help to provide the supported output sizes of ImageFormat.PRIVATE that is obtained by StreamConfigurationMap#getOutputSizes(int).
Since we don't have this device, we'll try to collect this information in the next version of our app. The next version will be released later this month.
ca...@gmail.com <ca...@gmail.com> #10
Hello.
- Please help to provide the supported output sizes of ImageFormat.PRIVATE that is obtained by StreamConfigurationMap#getOutputSizes(int).
We have collected the output of the device where the crash occurs.
Device1
- Model : arrows Be F-05J
- Android Version : 7.1.1
- Supported output sizes of ImageFormat.PRIVATE
CameraId 0: 480x480
CameraId 1: 2048x1536 ,1920x1080 ,1280x720 ,960x720 ,640x480 ,320x240 ,176x144
Device2
- Model : Fujitsu arrows M04
- Android Version : 7.1.1
- Supported output sizes of ImageFormat.PRIVATE
CameraId 0: 480x480
CameraId 1: 2048x1536 ,1920x1080 ,1280x720 ,960x720 ,640x480 ,320x240 ,176x144
Additional Information
CameraX version : 1.0.0-beta04
We collect the supported output sizes by following code.
val errorString = buildString {
append("The supported output sizes of ImageFormat.PRIVATE: ")
(requireContext().getSystemService(Context.CAMERA_SERVICE) as CameraManager).apply {
cameraIdList.forEachIndexed { index, cameraId ->
val msg = if (VERSION.SDK_INT >= VERSION_CODES.M) {
val configurationMap =
getCameraCharacteristics(cameraId).get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)
val sizes = configurationMap?.getOutputSizes(ImageFormat.PRIVATE)
"CameraId $index: ${sizes?.joinToString(" ,")}"
} else {
"CameraId $index: This device version is under M."
}
append(msg)
}
}
}
st...@gmail.com <st...@gmail.com> #11
il...@google.com <il...@google.com> #12
I tried to find the device specs and both 720x1280
size display. For the camera id 0 device, it is a different case that the display size is larger than 640x480
but the device only supports a 480x480
size. The case also caused the same IllegalArgumentException and was also fixed by 1.0.0-beta04
release. Before 480x480
size would be filtered out and then caused the IllegalArgumentException. After it was merged, the 640x480
size threshold was removed and then the 480x480
size would be kept and selected to use.
It looks like 1.0.0-beta04
release had been used to collect the supported sizes information. But the issue should have been fixed by 1.0.0-beta04
release. Did you only check the device model name to collect the supported sizes information or collect the information when the IllegalArgumentException issue happens again?
CameraX's 1.0.0-beta04
version. Maybe you can also consider to upgrade to the latest 1.0.0-rc01
version for your application. Thanks.
ap...@google.com <ap...@google.com> #13
Did you only check the device model name to collect the supported sizes information or collect the information when the IllegalArgumentException issue happens again?
We collect informations only from the device on which IllegalArgumentException happened.
Our latest app uses CameraX version 1.0.0-beta10
and this issue still occurres.
However we don't receive crash report from Fujitsu arrows Be F-05J
or Fujitsu arrows M04
so far. (This doesn't mean this issue is fixed on these devices because our app is heavily rely on camera so these device's user wouldn't use our app anymore.)
Instead, we receive crash report from
- Model : Fujitsu F-03K
- Android Version : 7.1.2
- Supported output sizes of ImageFormat.PRIVATE
CameraId 0 : 480x480
CameraId 1 : 2048x1536 ,1920x1080 ,1280x720 ,960x720 ,640x480 ,320x240 ,176x144
ap...@google.com <ap...@google.com> #14
I missed some settings when I simulated the issue by robolectric test so that I was not able to reproduce it. Now, I can reproduce the issue if the device only supports one 480x480 resolution. I'm working on the solution and target to make it included in next release.
ap...@google.com <ap...@google.com> #15
Branch: androidx-main
commit 69d15dff7bb857ee33a0f643ff42a0f8bc475ab2
Author: charcoalchen <charcoalchen@google.com>
Date: Fri Jan 08 18:30:03 2021
Fixed IllegalArgumentException issue happened when all preview supported sizes are smaller than 640x480 and display size is larger than 640x480.
Do not filter out sizes smaller than 640x480 when all preview supported sizes are smaller than 640x480 and display size is larger than 640x480.
Relnote:"Fixed IllegalArgumentException issue happened when all preview supported sizes are smaller than 640x480 and display size is larger than 640x480."
Bug: 150506192
Test: SupportedSurfaceCombinationTest
Change-Id: I2a63ce8e2ad42a9cc060c8635ac3603bf440b1ec
M camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/SupportedSurfaceCombination.java
M camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/SupportedSurfaceCombinationTest.java
ap...@google.com <ap...@google.com> #16
ap...@google.com <ap...@google.com> #17
Branch: androidx-main
commit 39365ca3334bf8ed6fe99c4a609974ea1128c0a2
Author: Clara Fok <clarafok@google.com>
Date: Thu Feb 22 18:12:22 2024
Add internal API to set defaultValuePresent for NavArgument
The defaultValuePresent usually defaults to false, and is set to true when setDefaultValue() is explicitly called. In safe arg's case, serialization tells us whether a default value is present, but does not let us access actual default value (deliberate choice by JB, see
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I76ecb93107081521b7a70d2a6762562b0af7cb8c
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavArgumentTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
ap...@google.com <ap...@google.com> #18
Branch: androidx-main
commit ce1fc9aa4bf5cfa1f16cdf8dcc2981a1a7768f6c
Author: Clara Fok <clarafok@google.com>
Date: Thu Feb 22 19:00:19 2024
Implement NavArgument generator
Generates a list of NamedNavArgument from a serializer<T> where T is a serializable concerete class or object.
To convert arg types that are not natively supported by NavType, a map of arg KType to custom NavType is required. The custom NavTypes takes precedence over native NavTypes. For example, a custom NavType<Int> will be used for Int types instead of the official NavType.IntType.
Test: ./gradlew navigation:navigation-common:test
Bug: 188693139
Change-Id: I8043f09cead18c3874f1062427180e37be43f510
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
A navigation/navigation-common/src/test/java/androidx/navigation/serialization/NavArgumentGeneratorTest.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/RoutePatternTest.kt
ap...@google.com <ap...@google.com> #19
Branch: androidx-main
commit 09c8c5dafbf2fb7ac52588eecb0d0c229237bc47
Author: Clara Fok <clarafok@google.com>
Date: Tue Feb 27 10:38:05 2024
Change criteria for path arg
Previously the criteria for path arg is that it is not optional (does not have a defualt value).
Now the conditions are:
1. is primitive - because arrays need repeated arg names & custom classes need to be parsed to json string
2. not optional (unchanged from before)
Test: ./gradlew navigation:navigation-common:test
Bug: 188693139
Change-Id: Iaa495e742cea666a7616f71b40961fc86aa76663
M navigation/navigation-common/src/main/java/androidx/navigation/NavType.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/RoutePatternTest.kt
ap...@google.com <ap...@google.com> #20
Branch: androidx-main
commit c044f2efeeb6fcdbae43bb2413251c41ca3d437d
Author: Clara Fok <clarafok@google.com>
Date: Tue Feb 27 10:35:25 2024
NavTypeConverter to return UNKNOWN instead of throw
Instead of throwing IllegalArgumentException, the converter that converts a serialized argument to a NavType will now return type UNKNOWN. This allows more elegant handling of custom argument types in different use cases.
Test: ./gradlew navigation:navigation-common:test
Bug: 188693139
Change-Id: I9821dc35bbacb384e9b57b45011fcb801af32ce6
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/NavTypeConverter.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/NavTypeConverterTest.kt
ap...@google.com <ap...@google.com> #21
Branch: androidx-main
commit d1e16c5abced31a3738c9686121f3a2a50c3404e
Author: Clara Fok <clarafok@google.com>
Date: Mon Feb 26 12:18:38 2024
Fix startDestination route args not processed
Filled-in arguments in the route that is passed as a NavGraph's startDestination will now be processed and stored in the bundle.
These start route arguments will overwrite default values but not the others. The priority of args is as follows:
Restored/StartDestinationArgs > Start route args > Default args
Relnote: "You can now pass arguments to NavGraph's startDestination directly in the startDestination route without relying on defaultValue. This applies to nesteded NavGraph startDestinations as well."
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 109505019
Bug: 188693139
Change-Id: I0e0b5a7c2bf2e77a8d7a46c91974509104e742a9
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphNavigator.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
ap...@google.com <ap...@google.com> #22
Branch: androidx-main
commit f17fc42c5e8bfb01d99d969cb9412ca0d924e170
Author: Clara Fok <clarafok@google.com>
Date: Thu Mar 07 16:47:59 2024
New abstract CollectionNavType
CollectionNavType<T> is a subclass of NavType<T> for collection-based argument such as list, arrays etc. CollectionNavType has an abstract serializeAsValues method to convert a collection into a List of Strings.
Test: ./gradlew navigation: navigation-common:test
Bug: 188693139
Relnote: "Added new abstract CollectionNavType<T> class, a subclass of NavType<T> for collection-based argument such as list, arrays, maps."
Change-Id: Ic6d63bfaf44a35708e63a091265a84f339579e78
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
A navigation/navigation-common/src/main/java/androidx/navigation/CollectionNavType.kt
ap...@google.com <ap...@google.com> #23
Branch: androidx-main
commit 3ed84c81fc55312598466f6bbb7b9b14ef428d51
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 11 10:58:11 2024
Change NavType arrays to CollectionNavType
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "NavType built-in arrays such as IntArray are now of type CollectionNavType"
Change-Id: Idcf796fd63e0ef2fc17cf40ccee98ac64c3b6641
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavTypeTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavType.kt
ap...@google.com <ap...@google.com> #24
Branch: androidx-main
commit 4fc57246f3ff5701c6fd65defc75ccaff72b4a3b
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 12 14:14:19 2024
Add NavDestinationBuilder constructor
Add a secondary constrcutor to create destinations with Safe Args by taking the serializable KClass<*> of the destination as the route.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "NavDestinationBuilder can now take a serializble KClass as route to create NavDestinations with type safety"
Change-Id: Ia3fa2b29c0515b02313620c88645d89d379b8636
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
ap...@google.com <ap...@google.com> #25
Branch: androidx-main
commit f40ccd7bec429fd545517778317426f26c42d11f
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 13 16:16:38 2024
Refactor NavGraph#findNode
findNode for routes need to handle both routePatterns and routeFilled. It used to match routePattern by converting route to an id and matching based on id. But it assumes that the id is always a hashCode of route. This is no longer the case with Safe Args where id can be based on serializer. Now we directly match the string value of routes.
This allows safe args to use route-based APIs that delegates to findNode, such as NavGraph#contains.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I0eb9b9427aa4e2beb45c7bdae0a5939d34bedf14
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
ap...@google.com <ap...@google.com> #26
Branch: androidx-main
commit bd9d02ba729a30e59f91382105dcd9aff66312db
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 13 18:30:45 2024
Add NavGraph API to set startDestination via KClass
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Added new NavGraph#setStartDestination API that takes a serializable KClass as startDestination"
Change-Id: I35990712aac099ab47f86ca10af8d8886aca5327
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
ap...@google.com <ap...@google.com> #27
Branch: androidx-main
commit d919d00291d64e342afb3b3babe02a4993ef04a4
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 13 17:25:22 2024
NavGraphBuilder adds support for KClass as startDestination
Add a secondary constrcutor that takes a serializable KClass<*> as startDestination, as well as DSL methods to create a NavGraph / nested NavGraph from KClass.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "NavGraphBuilder can now take a serializable KClass as startDestination. The starting NavDestination must have been added as a KClass in order to match."
Change-Id: I7de995f0621e397de971a943fcf97b6f3fe9f566
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #28
Branch: androidx-main
commit 612677ffe8a21225cef35a828d7e277e9d109daf
Author: Clara Fok <clarafok@google.com>
Date: Fri Mar 15 14:54:15 2024
Add NavGraph API to set startDestination via destination object
Add API to set the startDestination of a NavGraph with a destination object T. Calling this method will also set the id based on the object's serializer hashcode.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Added new NavGraph#setStartDestination API that takes a serializable object as startDestination"
Change-Id: I262aa2eeccc792ae6c1c5b70e6b3d82eed3a3049
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteFilledTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteEncoder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
ap...@google.com <ap...@google.com> #29
Branch: androidx-main
commit 98d5569ab80e1d49083e455a41a940734effca3c
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 18 12:43:45 2024
NavGraphBuilder adds support for Object as startDestination for root NavGraph
Add a secondary constrcutor that takes a serializable Object as startDestination, as well as DSL methods to create a NavGraph / nested NavGraph with object as startDestinations.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "NavGraphBuilder can now take a serializable Object as startDestination. The starting NavDestination must have been added as a KClass in order to match."
Change-Id: I20a147e037ff80f0cab34276275890e683fa8367
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteFilledTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #30
Branch: androidx-main
commit 712f1043fd3380f53c3831d7e45105c7eafc6a15
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 18 16:16:35 2024
NavGraphBuilder adds supports for Object as nested Graph startDestination
Add DSL method to create nested NavGraph with Object as startDestination
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "NavGraphBuilder can now take a serializable Object as startDestination for nested Graphs. The starting NavDestination must have been added as a KClass in order to match."
Change-Id: Icf32b1b03afd4c11031cc3ca8316c7a9c10c131a
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #31
Branch: androidx-main
commit d1226c862b2749b4b4138690559756a6546e377e
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 18 17:25:24 2024
Add APIs to locate node within NavGraph
Add findNode, contains and get APIs from a serializable KClass or Object
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "You can now locate a node within NavGraph with a serializable KClass or Object if the node destination has a route from a KClass."
Change-Id: I1d4328c2ff048d4e1d889f973e2ec0dc3979cadb
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
ap...@google.com <ap...@google.com> #32
Branch: androidx-main
commit 81762e285b206ba48aec675b881371d0b8449771
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 20 10:34:56 2024
Update KDocs for Safe Args API
Change wording on Safe Args API kdocs to clarify route parameters
Test: n/a
Bug: 188693139
Change-Id: Ie4f4d2624b50181ab28dd1d97f81fa85dc03e3d1
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #33
Branch: androidx-main
commit 057ffc6931044dfc5848587972e178ce001af25a
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 20 12:30:48 2024
Make setStartDestination KClass version reified
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I0ca6232271e8e05c509e60c220e478f4bd0306aa
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #34
Branch: androidx-main
commit fccd74a94dfe8e735dad13f7b0100cc67e3b92d7
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 19 10:32:54 2024
Add NavController DSL to create graph with safe args
Added two NavController.createGraph overloads to create graphs with startDestination from a serialiazable KClass or from a serializable Object.
To support object-based startDest, we need to add a null check while parsing startDestination args. Previously a `isDefaultValuePresent == true` sufficiently indicates the existence of a non-null defaultValue for non-nullable types. However in the case of Safe Args, it is possible for `isDefaultValuePresent == true` while defaultValue is not populated (meaning it is still null). This is due to serialization limitations where we know a defaultValue is present but cannot read actual value.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "Added NavController createGraph DSL to create graphs with startDestinations from either a serializable KClass or a serializable Object. Argument values from the serializable Object will be parsed automatically and available in the NavBackStackEntry's argument bundle."
Change-Id: I836a1559471fca7594653ea9e4e6a53b0d1b7ff0
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-runtime/build.gradle
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M testutils/testutils-navigation/src/main/java/androidx/testutils/TestNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #35
Branch: androidx-main
commit 902eb1c937e069d71a9f5080d1d579c5c57ff7da
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 19 17:04:37 2024
Implement NavController popBackStack for Safe Args
Added popBackStack overloads to pop with a serializable KClass or with a serializable Object.
For KClass version, there are no arguments values to consider so we can pop directly based on its id. For Object version, we need to generate the route with args filled and then pop with that.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "Added NavController popBackStack APIs for popping from a serializable KClass or from a serializable Object. The target NavDestination to be popped must have been created with route from KClass."
Change-Id: I1033daaefa341eb1054a9b00b0fce0b5317adca8
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> #36
Branch: androidx-main
commit 2962d1274805f28da11596f3d36d5e5a13bc9197
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 20 12:05:45 2024
Make findNode for KClass reified
NavGraph #get and #contains delegates to the #findNode KClass version. Due to changes to findNode, get and contain are refactored to reified as well to pass the Type Parameter. However #get and #contains, being operator functions, requires at least one parameter. So the KClass for these two options are still expected to be passed in as `MyClass::class` parameter.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I8c4d2d17bb12bf71b3059650b1f163df192e0528
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
ap...@google.com <ap...@google.com> #37
Branch: androidx-main
commit 577e993d5d34cf9c90914d5b217e7af91349313d
Author: Clara Fok <clarafok@google.com>
Date: Fri Mar 22 12:50:54 2024
Update setStartDestination param name
Test: n/a
Bug: 188693139
Change-Id: I2ef1c39ca85d6c6656f977df9bca9fe50d7045a5
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
ap...@google.com <ap...@google.com> #38
Branch: androidx-main
commit 98148548474199ab29ce5b8bd17ffe82ca1006d5
Author: Clara Fok <clarafok@google.com>
Date: Thu Mar 21 17:08:02 2024
Remove nulls from NavDestinationBuilder
Remove default nulls from constructor so it aligns with other NavDestinationBuilder constructors
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I6219ce74be1113d6d8acd99d1940df5ef2674bcc
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
ap...@google.com <ap...@google.com> #39
Branch: androidx-main
commit ea80964c1a73097276e710511c3924da94abae8b
Author: Clara Fok <clarafok@google.com>
Date: Thu Mar 21 13:31:02 2024
Implement NavController clearBackStack for Safe Args
Added clearBackStack overloads to clear with a serializable KClass or with a serializable Object.
For KClass version, there are no arguments values to consider so we can clear directly based on its id. For Object version, we need to generate the route with args filled and then clear with that.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "Added NavController clearBackStack APIs for clearing saved state with a serializable KClass or from a serializable Object. The target NavDestination to be cleared must have been created with route from KClass."
Change-Id: I8972f003efa07fd275d397bf31237d6b3f3e38d1
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
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> #40
Branch: androidx-main
commit 172e0effa8dbc758bc59d92558940ee77ae4642a
Author: Clara Fok <clarafok@google.com>
Date: Thu Mar 21 15:09:53 2024
Mark Safe Args APIs public and experimental
Safe Args feature supports type safe navigation in Kotlin DSL. Apis made public in this CL includes:
Creating NavGraphs
Creating NavDestination
NavController functions: pop, get, find, contains
The Safe Args API surface is still under development and incomplete at the moment. As such, we added `ExperimentalSafeArgsApi` annotation to annotate all public APIs that are part of this new component. Many specific features require multiple safe args APIs working together, so individual APIs may not currently work as intended. As such, use of APIs annotated with `ExperimentalSafeArgsAPI` requires opt-in.
Test: bOS
Bug: 188693139
Relnote: "Mark Safe Args APIs public and experimental. This includes APIs for creating NavGraphs and NavDestination, as well as some NavController functions such as pop, get, find. The full safe args Api surface is still under development and incomplete, therefore usage of these APIs require Opt-in."
Change-Id: I644e72c129b4daca1a46fa428c31ab47c1b85a31
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
A navigation/navigation-common/src/main/java/androidx/navigation/ExperimentalSafeArgsApi.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M testutils/testutils-navigation/src/main/java/androidx/testutils/TestNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #41
Branch: androidx-main
commit 621b5619eb3e433053981eb132247322c5cd1b59
Author: Clara Fok <clarafok@google.com>
Date: Fri Mar 22 14:03:18 2024
Implement NavController getBackStackEntry for Safe Args
Added getBackStackEntry overloads to retrieve entry with a serializable KClass or with a serializable Object.
For KClass version, there are no arguments values to consider so we can get entry directly based on its id. For Object version, we need to generate the route with args filled and then get entry with that.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "Added NavController getBackStackEntry APIs for retrieving entries with a serializable KClass or with a serializable Object. The target NavDestination to be retrieved must have been created with route from KClass."
Change-Id: Icb70f85a4fdfd7b8c472bd4a282e446e86ae8dde
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
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> #42
Branch: androidx-main
commit d7bf0965744eb189c043f04c13bd7c1412215a83
Author: Clara Fok <clarafok@google.com>
Date: Fri Mar 22 15:25:08 2024
Implement NavController navigate with Object T
Add support for navigating with a serializable object instance. The target NavDestination must have been added to the NavGraph with a route from a KClass.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "Add new navigate API to navigate with a serializable object instance. The target NavDestination must have been added to the NavGraph with a route from KClass."
Change-Id: If44d34757c454d628e2e73794047a5a23c37308a
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
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> #43
Branch: androidx-main
commit 8f3d6ed68920664af9e2e5af25300c3e4a1407fb
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 25 17:57:35 2024
Add NavOptionsBuilder popUpTo KClass
Add builder overload to set popUpTo with serizaliable KClass
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "NavOptionsBuilder now allows setting popUpTo with a serializable KClass. The target NavDestination must have been create with route from a KClass."
Change-Id: I43a5123b9efd91a36b9fbaf4e27eef874884f9e7
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavOptionsBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/ExperimentalSafeArgsApi.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptionsBuilder.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> #44
Branch: androidx-main
commit 2d8c06f881e85c88b8f65237a7ceb6a545ddc0f2
Author: Clara Fok <clarafok@google.com>
Date: Mon Mar 25 18:33:05 2024
Add NavOptionsBuilder popUpTo Object
Add builder overload to set popUpTo with serizaliable Object
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "NavOptionsBuilder now allows setting popUpTo with a serializable Object. The target NavDestination must have been create with route from a KClass."
Change-Id: I2a1c5774acd0df889dd1962aa04dd3bb3a48404d
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavOptionsBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptionsBuilder.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> #45
Branch: androidx-main
commit d75f481b6416bbb9720f60dd93d6fc405b274793
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 26 14:19:42 2024
Add FragmentNavigatorDestinationBuilder constructor
New constructor that takes a serializable KClass as the destination route.
This includes two NavGraphBuilder extension functions to create a fragment with the KClass.
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 188693139
Relnote: "FragmentNavigatorDestinationBuilder now takes a serializable KClass as route to create the NavDestination with type safety"
Change-Id: If9e14e8c4d04bbb57f873a305a7314d235ab8af9
M navigation/navigation-fragment/api/current.txt
M navigation/navigation-fragment/api/restricted_current.txt
M navigation/navigation-fragment/build.gradle
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #46
Branch: androidx-main
commit a721774fc68c5d7b5116eae0b27b54a7d7263251
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 26 14:44:13 2024
Add NavHost DSL to create graph with KClass
Added NavHost.createGraph overload to create graph with serializable KClass as startDestination and graph route.
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 188693139
Relnote: "Added NavHost createGraph DSL to create graphs with startDestination and graph route from a serializable KClass. The relevant starting NavDestination must have been created with route from a KClass."
Change-Id: I24e4116e5accdcb6ef432f6e4bb808b803c48b01
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavControllerWithFragmentTest.kt
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavHost.kt
ap...@google.com <ap...@google.com> #47
Branch: androidx-main
commit 52a599c88b255036da91dac458bce0d85d49cce9
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 27 11:53:34 2024
Make typeMap non-nullable
Test: ./gradlew navigation:navigation-common:build
Test: ./gradlew navigation:navigation-runtime:build
Bug: 188693139
Relnote: "The typeMap parameter in Safe Args APIs is now non-nullable and defaults to an empty map."
Change-Id: I988961680ed82f45623dba5bb162abb4b139b7c3
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M testutils/testutils-navigation/src/main/java/androidx/testutils/TestNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #48
Branch: androidx-main
commit b6676f774c028f110987be1196f64af3e4909ba0
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 26 15:00:39 2024
Add NavHost DSL to create graph with Object
Added NavHost.createGraph overload to create graph with serializable Object as startDestination and serializable KClass as graph route.
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 188693139
Relnote: "Added NavHost createGraph DSL to create graphs with startDestination from a serializable Object. The relevant starting NavDestination must have been created with route from a KClass."
Change-Id: I394079e5daad4d7d2beb427fc42e2a211cb89222
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavControllerWithFragmentTest.kt
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavHost.kt
ap...@google.com <ap...@google.com> #49
Branch: androidx-main
commit f6bb3e364285aa68065f6a8510380a28c44d232f
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 26 15:34:40 2024
Add DialogFragmentNavigatorDestinationBuilder constructor
New constructor that takes a serializable KClass as the destination route.
This includes two NavGraphBuilder extension functions to create a fragment with the KClass.
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 188693139
Relnote: "DialogFragmentNavigatorDestinationBuilder now takes a serializable KClass as route to create the NavDestination with type safety"
Change-Id: Ic5eec01d3e3ac195db2b9a717bcc58bdc55af652
M navigation/navigation-fragment/api/current.txt
M navigation/navigation-fragment/api/restricted_current.txt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/DialogFragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavControllerWithFragmentTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigatorDestinationBuilder.kt
st...@gmail.com <st...@gmail.com> #50
By the way it would be nice to know when these commits are at a stage where one could give them a try, even using snapshot builds. It would be great to give some early feedback, especially to see how the migration experience is gonna be like going from navigation-compose-typed for example for those who come from there.
il...@google.com <il...@google.com> #51
Re route: String
to also have a type safe equivalent.
At that point, we plan to remove the experimental flag from all of the APIs - that would be a good indication that you could start playing with a snapshot build available on
ap...@google.com <ap...@google.com> #52
Branch: androidx-main
commit 0afe640fbbe08edc6cb4898752379fa6c7823305
Author: Clara Fok <clarafok@google.com>
Date: Wed Mar 27 15:25:17 2024
Add ActivityNavigatorDestinationBuilder constructor
New constructor that takes a serializable KClass as the destination route.
This includes a NavGraphBuilder extension function to create an activity with the KClass.
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 188693139
Relnote: "ActivityNavigatorDestinationBuilder now takes a serializable KClass as route to create the NavDestination with type safety"
Change-Id: Ibb13e8d564e505bb082a173d1d2a2525193968a6
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/ActivityNavigatorDestinationBuilderTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #53
Branch: androidx-main
commit 1a56aa19ccf62d043d7e079843bc311678dc896b
Author: Ian Lake <ilake@google.com>
Date: Fri Mar 29 21:13:56 2024
Use NavDestinationBuilder for Navigation Compose
Extend NavDestinationBuilder for building
ComposeNavigator and DialogNavigator destinations.
This allows us to use the infrastructure and support
for type safe routes at the Navigation Compose level.
Bug: 188693139
Test: `NavDestinationBuilderTest`
Relnote: "The Kotlin DSL API of `NavDestinationBuilder`
now supports directly adding a `NavArgument` and
`NavDeepLink` rather than only providing methods that
use their respective builders. It now also provides a
protected `instantiateDestination` method that can be
used to override the default `build` behavior of
creating a destination from the `Navigator`."
Change-Id: I7e753bebb4576fc9ddb2872b8b11cd97e1b4efe3
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/restricted_current.txt
A navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigatorDestinationBuilder.kt
A navigation/navigation-compose/src/main/java/androidx/navigation/compose/DialogNavigatorDestinationBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #54
Branch: androidx-main
commit d971520d7854ae311338cf28aca388843cdefb0c
Author: Clara Fok <clarafok@google.com>
Date: Thu Mar 28 11:48:19 2024
Implement safe args deserialization
Added deserializer to recreate destination object based on a serialzer and bundle of arguments.
Also added NavBackStackEntry.toRoute() API to recreate destination (decode arguments).
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Added NavBackStackEntry.toRoute() to recreate destination object with args."
Change-Id: I5b5ac494f3d444d6d11f17d7c60168c6c094390e
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
A navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteDecoderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteFilledTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
A navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteDecoder.kt
A navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteDeserializer.kt
ap...@google.com <ap...@google.com> #55
Branch: androidx-main
commit 97a26233e85ea38df8df64f18944c548af4cc21a
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 02 15:26:16 2024
Add test for nested NavGraphBuilder
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Change-Id: Ibf90c4d3854559750c25a81bbb817be9f20420c2
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
ap...@google.com <ap...@google.com> #56
Branch: androidx-main
commit 6f64ccde8abc0ec3e2511763844e1e25381ee402
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 02 11:16:30 2024
Add NavGraphBuilder.composable extension
New extension to create a ComposeNavigator.Destination with a serializable KClass
Test: ./gradlew navigation:navigation-compose:cC
Bug: 188693139
Relnote: "Added NavGraphBuilder.composable extension to create a ComposeNavigator.Destination with route from a serialiable KClass."
Change-Id: Ied2c9c8208cd7adc5c2e848b2e166d857afc8165
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-compose/build.gradle
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostControllerTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigatorDestinationBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
st...@gmail.com <st...@gmail.com> #57
This new NavGraphBuilder.composable
function exposes the content lambda with this signature noinline content: @Composable AnimatedContentScope.(NavBackStackEntry) -> Unit
.
I've found it quite convenient to be able to have access to the object itself in this lambda if possible. I also see that in NavBackStackEntry.toRoute()
API was introduced.
Is there a world out there where it would make sense that a NavGraphBuilder.composable
function is exposed from this library which just gives us access to the route T
in the content lambda with a signature perhaps something like noinline content: @Composable AnimatedContentScope.(NavBackStackEntry, T) -> Unit
or similar?
Or do you feel like doing the toRoute()
call ourselves on every destination is the right approach here?
For reference, the navigation-compose-typed library was doing something similar here AnimatedContentScope
which I do not recommend doing here of course. Just a thought, would like to hear if you've thought of doing something similar too.
ap...@google.com <ap...@google.com> #58
Branch: androidx-main
commit cd0026d26f664ad2a6036e0dcfe5145bcec2b1a0
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 02 12:36:19 2024
Add compose DSL to create graph with KClass
Added DSL to
1. create root graph with startDestination and route from KClass
2. create nested graph with startDestination and route from KClass
Test: ./gradlew navigation:navigation-compose:cC
Bug: 188693139
Relnote: "Added navigation-compose NavHost and navigation DSL to create graphs with startDestiation and graph route from a serializable KClass."
Change-Id: I8ed5a1d9e9d7aeac6ea3f3993777425a47f597ef
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
ap...@google.com <ap...@google.com> #59
Branch: androidx-main
commit eae20dff262f189b31e758d10443dd8def3e28bb
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 03 15:43:46 2024
Make NavGraphBuilder nested graph extension reified
For nested graphs, graph route is required so it is suitable to make NavGraphBuilder.navigation DSL reified along with other reified nested graph builders.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "NavGraphBuilder.navigation() DSL for creating nested graphs is now reified with the graph's route from a KClass as the type parameter."
Change-Id: I409c87eea0b64195a49980c115a3581a52d3e975
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
ap...@google.com <ap...@google.com> #60
Branch: androidx-main
commit 6926f12d5432727e10118bee5ae0f987b4538b81
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 02 16:17:44 2024
Add NavGraphBuilder.dialog extension
New extension to create a DialogNavigator.Destination with a serializable KClass
Test: ./gradlew navigation:navigation-compose:cC
Bug: 188693139
Relnote: "Added NavGraphBuilder.dialog extension to create a DialogNavigator.Destination with route from a serialiable KClass."
Change-Id: I960f8941527db5a4f6a527b303bbd22f56d368bc
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostControllerTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/DialogNavigatorDestinationBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #61
Branch: androidx-main
commit cefd9394fca89e8149133129942fb145419473db
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 02 15:21:52 2024
Add compose DSL to create graph with Object
Added DSL to
1. create root graph with startDestination from Object and route from KClass
2. create nested graph with startDestination from Object and route from KClass
Test: ./gradlew navigation:navigation-compose:cC
Bug: 188693139
Relnote: "Added navigation-compose NavHost and navigation DSL to create graphs with startDestiation from a serializable Object."
Change-Id: I3eabd8a83cb2153c3d3bc03a58cd02d7d8e7293d
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
ap...@google.com <ap...@google.com> #62
Branch: androidx-main
commit aa00c85529ad6c2a59b0dbbbea66247032d87877
Author: Clara Fok <clarafok@google.com>
Date: Thu Apr 04 11:00:43 2024
Update typeMap kdoc description
Update doc to reflect the fact that it is a non-nullable map but may be empty
Test: n/a
Bug: 188693139
Change-Id: If7c694dd05c8f68949287b99c069c81a967a5266
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigatorDestinationBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/DialogNavigatorDestinationBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigatorDestinationBuilder.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilder.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigatorDestinationBuilder.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavHost.kt
ap...@google.com <ap...@google.com> #63
Branch: androidx-main
commit 3c6d402195136edc54ea845cfbc2dc474b87fb7e
Author: Clara Fok <clarafok@google.com>
Date: Thu Apr 04 13:19:46 2024
Update reified T upperbound for safe args API
Update upperbound from `Any?` to `Any` for safe arg APIs that have route: String counterparts where String is non-nullable.
Test: TH
Bug: 188693139
Change-Id: Idc8c6bd552fa7261fb1b81624ff2add42c469f73
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #64
Branch: androidx-main
commit 5fdeb25b94eb1b2ccb462910d4493a32603c10d4
Author: Clara Fok <clarafok@google.com>
Date: Thu Apr 04 13:29:40 2024
Add experimental annotation on NavOption safe args field
Mark public safe arg fields `popUpToRouteClass` and `popUpToRouteObject` as ExperimentalSafeArgsApi. All safe args public methods / fields should be marked experimental at this point.
Test: TH
Bug: 188693139
Relnote: "New NavOptions fields popUpToRouteClass and popUpToRouteObject are marked ExperimentalSafeArgsApi and requires opt-in to use."
Change-Id: Iefd951a986bd24057701fa2be24298fe691e0929
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #65
Branch: androidx-main
commit 30135e174b2d258832f997127a4e4655cc8fee16
Author: Clara Fok <clarafok@google.com>
Date: Thu Apr 04 13:33:32 2024
Update NavOptions equals and toString
Equals and toString now also factors in popUpToRouteObject field
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I7badbcaf4bfd1940887b29ed0e40d2634f4ecf23
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
ap...@google.com <ap...@google.com> #66
Branch: androidx-main
commit 552d8c8d295268184ec2b9bd821a6bc757467432
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 05 07:26:11 2024
Add DynamicIncludeNavGraphBuilder safe args constructor
Add support to constrcut a DynamicIncludeNavGraph with route from a serializable KClass.
Also added #includeDynamic DSL to create DynamicIncludeNavGraphs.
Test: ./gradlew navigation:navigation-dynamic-features-runtime:cC
Bug: 188693139
Relnote: "Add support to constrcut a DynamicIncludeNavGraph with route from a serializable KClass."
Change-Id: Ib3aba24336deb730aabd222f37eaefefca8006cf
M navigation/navigation-dynamic-features-runtime/api/current.txt
M navigation/navigation-dynamic-features-runtime/api/restricted_current.txt
M navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilderTest.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilder.kt
ap...@google.com <ap...@google.com> #67
Branch: androidx-main
commit 29074906d7407d17e7b46bb2c7ce169cef3a1eaa
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 05 06:57:03 2024
Add DynamicNavGraphBuilder safe args constructors
Add support to constrcut a DynamicNavGraph with route from a serializable KClass and startDestination from either an Object or a KClass.
Also added #navigation DSL to create root and nested DynamicNavGraphs.
Test: ./gradlew navigation:navigation-dynamic-features-runtime:cC
Bug: 188693139
Relnote: "Add support to constrcut a DynamicNavGraph with route from a serializable KClass and startDestination from either an Object or a KClass"
Change-Id: Ia668dffcae8b255bf5db75b6c149983d973d2b06
M navigation/navigation-dynamic-features-runtime/api/current.txt
M navigation/navigation-dynamic-features-runtime/api/restricted_current.txt
M navigation/navigation-dynamic-features-runtime/build.gradle
M navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilderTest.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder.kt
ap...@google.com <ap...@google.com> #68
Branch: androidx-main
commit b3b904a849a3c2f97e1c4357c4f829790906c11a
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 05 07:49:05 2024
Add DynamicNavGraphBuilder activity DSL
Add DSL to create a DynamicActivityNavigator.Destination with route from serializable KClass.
Test: ./gradlew navigation:navigation-dynamic-features-runtime:cC
Bug: 188693139
Relnote: "Add DSL to create a DynamicActivityNavigator.Destination with route from serializable KClass."
Change-Id: I9b73c5cafcb80ea92d6ecb03677a5128fb7fb944
M navigation/navigation-dynamic-features-runtime/api/current.txt
M navigation/navigation-dynamic-features-runtime/api/restricted_current.txt
M navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicActivityNavigatorDestinationBuilderTest.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicActivityNavigatorDestinationBuilder.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/NavController.kt
st...@gmail.com <st...@gmail.com> #69
Will this feature support having parameters to your destinations which have lists internally?
@Serializable
data class FooDestination(
val firstParam: String,
val someList: List<String>,
)
This List<String>
is the problem here atm.
Currently with snapshot "11678588" trying to run an app with such lists I get the error message:
java.lang.IllegalArgumentException: Cannot cast someList of type kotlin.collections.ArrayList to a NavType. Make sure to provide custom NavType for this argument.
at androidx.navigation.serialization.RouteSerializerKt$generateNavArguments$2$1.invoke(RouteSerializer.kt:108)
at androidx.navigation.serialization.RouteSerializerKt$generateNavArguments$2$1.invoke(RouteSerializer.kt:103)
at androidx.navigation.NamedNavArgumentKt.navArgument(NamedNavArgument.kt:25)
at androidx.navigation.serialization.RouteSerializerKt.generateNavArguments(RouteSerializer.kt:103)
at androidx.navigation.NavDestinationBuilder.<init>(NavDestinationBuilder.kt:105)
at androidx.navigation.compose.ComposeNavigatorDestinationBuilder.<init>(ComposeNavigatorDestinationBuilder.kt:92)
...
But from my understanding, this should already be supported natively as I see here
ap...@google.com <ap...@google.com> #70
Branch: androidx-main
commit 3e773091a584711a9c94a648da21a53db84414c0
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 05 14:11:45 2024
Add DynamicFragmentNavigatorDestinationBuilder constructor
New constructor that takes a serializable KClass as the destination route.
Also added are:
1. DynamicNavGraphBuilder extension functions to create a fragment with reified KClass
2. NavHost createGraph extensions with startDestination from either KClass or Object to support DynamicNavGraphBuilder fragment DSL
Test: ./gradlew navigation:navigation-dynamic-features-fragment:cC
Bug: 188693139
Relnote: "DynamicFragmentNavigatorDestinationBuilder now takes a serializable KClass as route to create the NavDestination with type safety"
Change-Id: I554db9e95f298f0c0ca51d4b7dc76087c20f9272
M navigation/navigation-dynamic-features-fragment/api/current.txt
M navigation/navigation-dynamic-features-fragment/api/restricted_current.txt
M navigation/navigation-dynamic-features-fragment/build.gradle
M navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-dynamic-features-fragment/src/main/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigatorDestinationBuilder.kt
M navigation/navigation-dynamic-features-runtime/api/current.txt
M navigation/navigation-dynamic-features-runtime/api/restricted_current.txt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/NavHost.kt
ap...@google.com <ap...@google.com> #71
Branch: androidx-main
commit b2c283af71255ecc1bc7a81590852c6c5ec41c8b
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 10 15:46:06 2024
RouteDecoder fallback to default value
If an argument value is missing from the bundle, the decoder will now fallback to default values (if present) that were declared in the destination's KClass.
For example, a deeplink used to navigate may have a required arugment missing from the deeplink uri. If there is a default value, the defavult value will be used to decode the uri back into the destination instance.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I26458eb605a3eb0c0dcb7968b4d15f821133efae
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteDecoderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteDecoder.kt
ap...@google.com <ap...@google.com> #72
Branch: androidx-main
commit 0455368c4af491258e583f08d0e0791b159cd371
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 10 19:05:18 2024
Make addInDefaultArg bypass unknown default values
addInDefaultArg is responsible for adding and verifying default args to a bundle. In the case of safe args where we have a default value but don't know what it is, addInDefaultArgs should just bypass the default value for that argument.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: Ifaf6f7455e05c40ca48b83b23f3f9d7ca8b8b5f7
M navigation/navigation-common/src/androidTest/java/androidx/navigation/AddInDefaultArgsTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavArgumentTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/NavArgumentGeneratorTest.kt
ap...@google.com <ap...@google.com> #73
Branch: androidx-main
commit 6e1a7fb89d23257873aadc862840ab388404087f
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 10 19:46:46 2024
Update criteria for required arguments
Arguments with unknown default values should not be considered a required argument
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Change-Id: I476509014a619b9436d91693e9ff03a7a05b06f0
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
ap...@google.com <ap...@google.com> #74
Branch: androidx-main
commit b2e619bc73ec783eb143ab8014b2d274ffc96ebf
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 10 15:46:06 2024
Update RouteDecoder docs
Test: n/a
Bug: 188693139
Change-Id: I26131f30973c270c7a4d627276831f27fa6a90ae
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteDecoder.kt
ap...@google.com <ap...@google.com> #75
Branch: androidx-main
commit 25f29701f0e6f12d96cdfe01e1b8c4fb2e69542e
Author: Clara Fok <clarafok@google.com>
Date: Thu Apr 11 15:28:21 2024
Add DeepLink setUriPattern API with KClass
The new setUriPattern takes a uriPattern and a reified KClass. The uriPattern will be the deeplink uri's base path, and the arguments from the KClass will be generated and appended onto the uriPattern.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Added NavDeepLink setUriPattern to set the deeplink uri based on a serializable KClass"
Change-Id: Id0e55c3e938d28c034aa2b6f2a23e815b0d8bfb9
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavArgument.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
ap...@google.com <ap...@google.com> #76
Branch: androidx-main
commit d1f355ca0ccd76618b753d39c081f8d06821bb5b
Author: Clara Fok <clarafok@google.com>
Date: Thu Apr 11 15:32:24 2024
Add navDeepLink DSL to create a NavDeepLink with KClass
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "Added navDeepLink DSL to create a NavDeepLink with a serializable KClass."
Change-Id: Ice0608f7b128f367760d4617d6b7f770d46618c7
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLinkDslBuilder.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
ap...@google.com <ap...@google.com> #77
Branch: androidx-main
commit c833e65d00feabf0dbb2eed7868ecb5815250d62
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 12 17:33:41 2024
RoutePattern generation should throw on unknown NavType
Route pattern generation appends argument as either path or query depending on NavType. Therefore it should throw if it cannot map an argument Type to a NavType
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-common:test
Bug: 188693139
Change-Id: I378d171639963a23fe7c02872a95913478de0b8a
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteFilledTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/NavTypeConverter.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/RoutePatternTest.kt
ap...@google.com <ap...@google.com> #78
Branch: androidx-main
commit 35fda1fb0d6677caad4731ba17b7c37baef801ad
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 12 16:06:45 2024
Clean up NavTypeConverter
Removed internal types for Maps, Sets and other types that do not have built-in support from NavType. This should clarify confusions on what types are natively supported by safe args and which types are not supported (aka required custom NavType).
These internal types should be re-added in the future if and when it gets native NavType support.
Test: TH
Bug: 188693139
Change-Id: Iabf112b941fd891c798ad451e4d298094978e4e4
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/NavTypeConverter.kt
ap...@google.com <ap...@google.com> #79
Branch: androidx-main
commit adb4385ad4844d7edc540c417f417e28e44acff1
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 12 15:47:34 2024
Fix KType mismatch with kotlin reflect
When mapping an argument Type to NavType, the matching used to be based on type names. However the type name varies depending on whether build dependency has kotlin reflect.
Refactorted implementation to be based on hashcode which is generated at runtime. This means the matching is independent of kotlin reflect and provides more reliable matching.
Test: ./gradlew navigatiion:navigation-common:test
Bug: 333965952
Bug: 188693139
Change-Id: Ia660ee2880558f19af58cd6fbe240946374eb7c4
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/NavTypeConverter.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/NavTypeConverterTest.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/RoutePatternTest.kt
ap...@google.com <ap...@google.com> #80
Branch: androidx-main
commit cfcb4a7c315a46772d2ffa48144e07f189377a4f
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 12 17:36:05 2024
Add tests for CollectionNavType
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-common:test
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Change-Id: I9bb8e49046d7c8335e979f61044b4058653ecad4
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteDecoderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteFilledTest.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/RoutePatternTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M testutils/testutils-navigation/src/main/java/androidx/testutils/TestNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #81
Branch: androidx-main
commit 61fb8751b3f5b374df03f06e771edb4ef18843e6
Author: Clara Fok <clarafok@google.com>
Date: Mon Apr 15 15:17:23 2024
Add Safe Args native support for List NavTypes
Add native support for arguments that are Lists of:
Boolean
Float
Int
Stirng
Long
This includes derivatives of List, such as MutableList, ArrayList etc.
Test: ./gradlew navigation:navigation-common:cC
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Relnote: "Safe Args now support the built-in List NavTypes"
Change-Id: Ia914c3739d9c3659909826b9eeaed7f74da39345
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteFilledTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/NavTypeConverter.kt
M navigation/navigation-common/src/test/java/androidx/navigation/serialization/NavArgumentGeneratorTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
ap...@google.com <ap...@google.com> #82
Branch: androidx-main
commit ccbada2bd96d3c09347e3763d32a3a77e08a447a
Author: Clara Fok <clarafok@google.com>
Date: Mon Apr 15 15:16:39 2024
Add built-in List NavTypes
Add built-in NavTypes for List of Int, String, Boolean, Float, and Long. This NavType can be used for Kotlin Collections extending List, such as MutableList, ArrayList etc.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "NavType now has built-in support for Lists of Int, String, Boolean, Float, and Long"
Change-Id: I4b6dd5ee05083c9b920eb886354384a9f55dc4aa
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/NavType.kt
ap...@google.com <ap...@google.com> #83
Branch: androidx-main
commit fe58bc6ee30bbf2b31a9bfb892853050ba650089
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 16 11:35:07 2024
Update setUriPattern param name
Test: TH
Bug: 188693139
Bug: 334995120
Relnote: "Update setUriPattern param name for uriPattern to basePath"
Change-Id: I95710b70ebbfa839f1809df21049d5c50ab74c4c
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
ap...@google.com <ap...@google.com> #84
Branch: androidx-main
commit 978353a2fc285a51274efbd37061943865bd2513
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 16 11:21:31 2024
Update navDeepLink dsl to take basePath
This ensures basePath is set for safe args deeplinks. Any uriPattern that is set within the builder lambda will override the generated uriPattern.
The builder requires `noinline` or else IDE throws error `Illegal usage of inline-parameter 'deepLinkBuilder...`
Note on lint: navDeepLink must not have empty builder lambdas in the past. Now it is permitted if there is TypeParameter in the case of safe args where the base path for uriPattern is passed in as a param rather than set as a uriPattern within builder.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Bug: 334995120
Relnote: "Safe Args navDeepLink dsl now takes in basePath to ensure base path is set for the final generated uriPattern. Any uriPattern that is set within the builder lambda will override the generated uriPattern."
Change-Id: I8d3948948e68b65f05c5bb943daba3deda64db2e
M navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/EmptyNavDeepLinkDetector.kt
M navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/EmptyNavDeepLinkDetectorTest.kt
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLinkDslBuilder.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
ap...@google.com <ap...@google.com> #85
Branch: androidx-main
commit a19b813fae7ec73e86d97e059c0938014883433e
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 15:09:58 2024
Remove ExperimentalSafeArgsApi uses from navigation-dynamic-features-runtime
In prepration for beta
Test: TH
Bug: 188693139
Relnote: "ExperimentalSafeArgsApi has been removed from safe args APIs in navigation-dynamic-features-runtime. These APIs no longer require opt-in"
Change-Id: If5380f1943f2a3dc1ff733ed3cfab5f1328c618a
M navigation/navigation-dynamic-features-runtime/api/current.txt
M navigation/navigation-dynamic-features-runtime/api/restricted_current.txt
M navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicActivityNavigatorDestinationBuilderTest.kt
M navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilderTest.kt
M navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilderTest.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicActivityNavigatorDestinationBuilder.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilder.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/NavController.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/NavHost.kt
ap...@google.com <ap...@google.com> #86
Branch: androidx-main
commit 3ad765604152e08a54057843e02258ed607ca3a4
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 14:54:44 2024
Remove ExperimentalSafeArgsApi uses from navigation-runtime
In prepration for beta
Test: TH
Bug: 188693139
Relnote: "ExperimentalSafeArgsApi has been removed from safe args APIs in navigation-runtime. These APIs no longer require opt-in"
Change-Id: Ia5c59da2d7d4e40db08e4fe29167ecc543df8a95
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/ActivityNavigatorDestinationBuilderTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigatorDestinationBuilder.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavHost.kt
ap...@google.com <ap...@google.com> #87
Branch: androidx-main
commit c2270851e460d64c20e138e8274adcb6a5dc99c1
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 14:55:07 2024
Remove ExperimentalSafeArgsApi uses from navigation-compose
In prepration for beta
Test: TH
Bug: 188693139
Relnote: "ExperimentalSafeArgsApi has been removed from safe args APIs in navigation-compose. These APIs no longer require opt-in"
Change-Id: I45f8b649fc3f5e9d738c432c4a53f23db7ab931e
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostControllerTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigatorDestinationBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/DialogNavigatorDestinationBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
ap...@google.com <ap...@google.com> #88
Branch: androidx-main
commit 585ddc7855f040f72d860adb0b5032f7d9a475eb
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 14:51:18 2024
Remove ExperimentalSafeArgsApi uses from navigation-common
In prepration for beta
Test: TH
Bug: 188693139
Relnote: "ExperimentalSafeArgsApi has been removed from safe args APIs in navigation-common. These APIs no longer require opt-in"
Change-Id: Ic30322fdcc6ab6abd383758d996d4007e1bf6375
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavOptionsBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptionsBuilder.kt
M testutils/testutils-navigation/src/main/java/androidx/testutils/TestNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #89
Branch: androidx-main
commit 5a78bef90a694b82a4f59f763ec7292ad702a5f7
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 14:55:36 2024
Remove ExperimentalSafeArgsApi uses from navigation-fragment
In prepration for beta
Test: TH
Bug: 188693139
Relnote: "ExperimentalSafeArgsApi has been removed from safe args APIs in navigation-fragment. These APIs no longer require opt-in"
Change-Id: I08b231168eaedeabcd4add210daa96a99dc5807e
M navigation/navigation-fragment/api/current.txt
M navigation/navigation-fragment/api/restricted_current.txt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/DialogFragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavControllerWithFragmentTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigatorDestinationBuilder.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #90
Branch: androidx-main
commit 1870828f269fc32f994ef1be169ae43aaf181d43
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 15:10:22 2024
Delete ExperimentalSafeArgsApi
Test: TH
Bug: 188693139
Relnote: "Delete ExperimentalSafeArgsApi annotation. All safe args API are safe to use without opt-in."
Change-Id: I11f0bb08a3f2f220f3ba8ba2d72890cd16e56ef3
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
D navigation/navigation-common/src/main/java/androidx/navigation/ExperimentalSafeArgsApi.kt
ap...@google.com <ap...@google.com> #91
Branch: androidx-main
commit 92492a56a2cace5f691b7281f7cad5ed5d4e6100
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 15:09:27 2024
Remove ExperimentalSafeArgsApi uses from navigation-dynamic-features-fragment
In prepration for beta
Test: TH
Bug: 188693139
Relnote: "ExperimentalSafeArgsApi has been removed from safe args APIs in navigation-dynamic-features-fragment. These APIs no longer require opt-in"
Change-Id: Idcdaf353295d64d8162a8e2f792ccd2cdaccee4a
M navigation/navigation-dynamic-features-fragment/api/current.txt
M navigation/navigation-dynamic-features-fragment/api/restricted_current.txt
M navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-dynamic-features-fragment/src/main/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigatorDestinationBuilder.kt
ap...@google.com <ap...@google.com> #92
Branch: androidx-main
commit 501d6aa733a0866819a0ab1471f71de24ffa7e17
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 17 11:43:23 2024
Add hasRoute<T> API for NavDestination
Convenience method to check if the NavDestination's route is based on KClass<T>.
Internally, the implementation is based on destination ID which was set during its initialization. Therefore if the ID was later overridden with a custom ID, the function will always return false.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Added hasRoute<T> API for NavDestination to check if the NavDestination's route is based on KClass<T>."
Change-Id: I6c3a2109d99a3c40102b8a81d7a8bc17746c6a93
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationAndroidTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
ap...@google.com <ap...@google.com> #93
Branch: androidx-main
commit bbf8d5ab440631c99c6ed5d8d0a101c042e5bc2d
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 16 12:45:23 2024
New add deepLink from KClass APIs for NavDestinationBuilder
NavDestinationBuilder supports adding deepLink from a reified serializable KClass by taking a base path and then appending arguments extracted from the KClass.
The deepLink does not take a typeMap and instead relies on the arguments that were added when initializing NavDestinationBuilder with route from KClass. As such, the deeplink is expected to have identital arguments (in name and type) as the destination KClass.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Add NavDestinationBuilder deepLink APIs to add DeepLinks based on serializable KClass"
Change-Id: I3a64b21c11307c1cb409e2bb47e292021d55c0b7
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
ap...@google.com <ap...@google.com> #94
Branch: androidx-main
commit a740327998fd2621a1e60314648bd1927c07eff2
Author: Clara Fok <clarafok@google.com>
Date: Thu Apr 18 10:27:20 2024
Add hasRoute<T> API for NavDestination
Previous merge was reverted aosp/3047794. ExperimentalSafeArgsApi annotations are now removed from tests.
Convenience method to check if the NavDestination's route is based on KClass<T>.
Internally, the implementation is based on destination ID which was set during its initialization. Therefore if the ID was later overridden with a custom ID, the function will always return false.
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Added hasRoute<T> API for NavDestination to check if the NavDestination's route is based on KClass<T>."
Change-Id: I873b7d2beee8a589858e84f8e6f95f295c51e6b9
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationAndroidTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
ap...@google.com <ap...@google.com> #95
Branch: androidx-main
commit 3259e05a28c122d658f86ac65ccd74f0022e4f1a
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 19 09:47:15 2024
Add SavedStateHandle.toRoute() API
This recreates destination instance from a SavedStateHandle to read typed arugments from.
Refactored RouteDecoderTest into kmp-friendly parameterized test with argument source from Bundle or SavedStateHandle.
Test: ./gradlew navigation:navigation-compose:cC
Test: ./gradlew navigation:navigation-common:cC
Bug: 188693139
Relnote: "Added SavedStateHandle.toRoute() to recreate destination object with args."
Change-Id: I0eb0db9fe1dc51c25545d5ef2e915e181d3a9dae
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteDecoderTest.kt
A navigation/navigation-common/src/main/java/androidx/navigation/SavedStateHandle.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteDecoder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteDeserializer.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostControllerTest.kt
ap...@google.com <ap...@google.com> #96
Branch: androidx-main
commit 35770e5dc11ff84cbf79e3dab977cf24ddda3c31
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 19 15:17:20 2024
Update compose demos
Refactored to use safe args
Test: manual
Bug: 188693139
Change-Id: I9ab7d2feb9f9fe3ce9ada075eeafb15a1afa9bc2
M navigation/navigation-compose/integration-tests/navigation-demos/build.gradle
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavByDeepLinkDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavPopUpToDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavSingleTopDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
ap...@google.com <ap...@google.com> #97
Branch: androidx-main
commit dc2cbe2b1ab95589cbdb84add3966d9e3c392289
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 19 16:55:46 2024
Add NavDestionation.hasRoute overload
Add an overload that takes a KClass<T> as parameter in the event where user only has access to the route kclass during runtime. Since KClass<T> cannot be passed as TypeParameter, we need an overload that takes a KClass.
Test: existing tests
Bug: 188693139
Relnote: "Add an overload that takes a KClass<T> as parameter in the case where users only have access to the route kclass during runtime."
Change-Id: Iea94de164795b79e99b8f1c2661e06ca6639b2bc
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
ap...@google.com <ap...@google.com> #98
Branch: androidx-main
commit 6d232ea3f9242d82e8d126e5d72932f75fdf8764
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 19 15:16:33 2024
Update compose samples
Refactored to use safe args
Test: manual
Bug: 188693139
Change-Id: I67d6dd74e93a9d3733f1bb91507b0656453a369b
M navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
M navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/SizeTransformSample.kt
ap...@google.com <ap...@google.com> #99
Branch: androidx-main
commit 63ad7d7cc1613a6773531a828458c4719f4a1802
Author: Clara Fok <clarafok@google.com>
Date: Fri Apr 19 16:26:31 2024
Add new demo NavWithArgsInNestedGraphDemo
Test: manual
Bug: 188693139
Change-Id: I23f0178e28a7fff2a2149776a2d518e4e8040c35
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
A navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsInNestedGraphDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavigationDemos.kt
M navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
ap...@google.com <ap...@google.com> #100
Branch: androidx-main
commit 153cc28e93e502aed8d4abe4941828bda5c4ce51
Author: Ian Lake <ilake@google.com>
Date: Mon Apr 22 20:30:15 2024
Remove Destination interface
Each Serializable destination can be a top
level object / data class, avoiding the need
for coupling all destinations to a single
interface, making it easier to later split
the navigation objects into separate modules.
Test: demos still compile
BUG: 188693139
Change-Id: I3fb109c642183df057bda825df524c83de3c2147
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavByDeepLinkDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
M navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
ap...@google.com <ap...@google.com> #101
Branch: androidx-main
commit ee9653e5370e114d849cb1984ddc42cbf752a4d8
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 23 14:05:05 2024
Use object instance instead of class
Since startDestination can take type Any, object instances should be passed in rather than object::class.
Test: manual demos
Bug: 188693139
Change-Id: I250d775fb1ead8bb5e7d83f0a7deac21dff1f4a5
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
M navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
ap...@google.com <ap...@google.com> #102
Branch: androidx-main
commit fd7d0dc4a56c2aef65424db7986aa057f9717661
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 23 16:35:39 2024
GetBackStack to throw if route not in graph
Getting back stack with route from either serializable KClass or object will throw if route is not found in the root NavController.graph
As for the exception message when route is not in backstack:
1. For KClass, the message is updated to be based on route rather than id
2. For object, the message remains the same as the existing one for route: String
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Change-Id: I3bcf0aa973795b04b4a8f82b9c41b4f0cfde053e
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> #103
Branch: androidx-main
commit bace4be6a3830afbcc72e816751a14568dac5195
Author: Clara Fok <clarafok@google.com>
Date: Tue Apr 23 16:17:27 2024
PopBackStack and Navigate to throw if route not in graph
Popping or navigating with route from either serializable KClass or object will throw if route is not found in the root NavController.graph
For popping, if route is not found in back stack, both overloads maintain existing behavior of returning false.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 188693139
Change-Id: I0a8a5a5a779076f96dacae2c9569ed9638ea13c9
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> #104
Branch: androidx-main
commit 8598bbbd37042faa1fa46771da2f367c049018e3
Author: Clara Fok <clarafok@google.com>
Date: Wed Apr 24 12:14:57 2024
Replace deprecated EmptySerializersModule
With serialization in platform bumped to v1.6.3(aosp/3058343), we can update our implementation to use 1.6.3 api here.
Test: existing tests
Bug: 188693139
Change-Id: Ib276f8cac4823ccea7fab508baf29caaa08e43fc
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteEncoder.kt
cl...@google.com <cl...@google.com> #105
Fixed, with first feature-complete release in navigation 2.8.0-alpha08
.
ka...@gmail.com <ka...@gmail.com> #106
Is this feature also expected to be available in androidx.compose.material.navigation
for the bottomSheet
?
ja...@gmail.com <ja...@gmail.com> #107
What about bottom sheets?
il...@google.com <il...@google.com> #108
Re androidx.compose.material
.
ka...@gmail.com <ka...@gmail.com> #109
See material ticket:
ph...@bankshift.com <ph...@bankshift.com> #110
Is there a non-reified overload of inline fun <reified T : Any> popBackStack(...)
?
fun <T : Any> popBackStack(route: T, ...)
appears to consider args and is not purely destinationId
-based.
With KSerializer<T>.generateHashCode()
annotated library-internal, it'd be useful to have popBackStack(route: KClass<T> ... )
for scenarios where args aren't important.
il...@google.com <il...@google.com> #111
Re
n....@gmail.com <n....@gmail.com> #112
Is it possible to get the destination data class from viewModel
's savedStateHandle
? Or is everybody relying on assisted injection for that?
n....@gmail.com <n....@gmail.com> #114
Is it possible to get the same thing but as a StateFlow
?
il...@google.com <il...@google.com> #115
Re MutableStateFlow(savedStateHandle.toRoute<YourClass>())
if you'd find a StateFlow of a single value easier to work with.
n....@gmail.com <n....@gmail.com> #116
thank you
Description
Component used: Navigation
Version used: 1.0.0-alpha01
Devices/Android versions reproduced on: All
Provide a way for typesafe arguments similar to Jetpack-Navigation-Safeargs in Jetpack-Navigation-Compose. Both in navigating to a destination and in retrieving the arguments at that destination.