Infeasible
Status Update
Comments
vi...@google.com <vi...@google.com> #2
vi...@google.com <vi...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit e465976de8f05f0d1db49b4e2887c9f3cd4beab5
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Mar 17 17:07:42 2021
Add OnBackPressedDispatcher observer before NavController observer
If you add a OnBackPressed callback with the NavBackStackEntry as the
lifecycle owner, if the Activity Lifecycle is STOPPED and STARTED again, the navController callback and NavBackStackEntry callback are readded to the Activity Lifecycle in the wrong order. This means that the new callback will not properly intercept onBackPressed() calls from the system, they will instead be intercepted by NavController.
If an OnBackPressedDispatcher is set, we should remove and readd the
NavController observer after we add the callback to the dispatcher.
RelNote: "OnBackPressedCallbacks added to a dispatcher with the
NavBackStackEntry as the LifecycleOwner now properly intercept back
after the Activity Lifecycle is STOPPED, then STARTED"
Test: NavControllerTest
Bug: 182284739
Change-Id: I6acf78848546160eaea7ed700ef8875664a125d0
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/1643646
Branch: androidx-main
commit e465976de8f05f0d1db49b4e2887c9f3cd4beab5
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Mar 17 17:07:42 2021
Add OnBackPressedDispatcher observer before NavController observer
If you add a OnBackPressed callback with the NavBackStackEntry as the
lifecycle owner, if the Activity Lifecycle is STOPPED and STARTED again, the navController callback and NavBackStackEntry callback are readded to the Activity Lifecycle in the wrong order. This means that the new callback will not properly intercept onBackPressed() calls from the system, they will instead be intercepted by NavController.
If an OnBackPressedDispatcher is set, we should remove and readd the
NavController observer after we add the callback to the dispatcher.
RelNote: "OnBackPressedCallbacks added to a dispatcher with the
NavBackStackEntry as the LifecycleOwner now properly intercept back
after the Activity Lifecycle is STOPPED, then STARTED"
Test: NavControllerTest
Bug: 182284739
Change-Id: I6acf78848546160eaea7ed700ef8875664a125d0
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
vi...@google.com <vi...@google.com> #4
This has been fixed internally and will be part of the Navigation 2.3.5
release (via 2.4.0-alpha01
).
Description