Status Update
Comments
ma...@mksolutions.com.br <ma...@mksolutions.com.br> #2
Is this specific to navigation? Or can this be reproduced with another other Composable component?
uc...@google.com <uc...@google.com>
bo...@google.com <bo...@google.com> #3
It only happens inside of a NavHost. So, yes, it seems to be specific to navigation.
ch...@lovefurniture.ie <ch...@lovefurniture.ie> #4
This was caused by the fix to BackHandler
lifecycle aware. The problem here is that the NavController
registers its lifecycle and added an observer to the Activity
Lifecycle
in composition while the BackHandler
registers its observer on the Activity
Lifecycle
in a DisposbleEffect
. This means that the NavController
will always get Lifecycle callbacks before the BackHandler
, so the components listening the the NavController
's lifecycle (like the NavBackStackEntry) will always get their Lifecycle callbacks before the BackHandler
as well.
This should be addressed by work coming in 2.7 to integrate the BackHandler
into the NavHost
.
de...@google.com <de...@google.com> #5
Branch: androidx-main
commit d2c5efe67531a30fb9f1a129d52beb1e9ece0b29
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed May 31 23:09:54 2023
Integrate BackHandler into NavHost
Instead of NavHost taking over the onBackPressedDispatcher from the
Activity, we should just make it use a BackHandler. This will ensure
that it interacters with the other BackHandlers in Compose correctly.
RelNote: "`NavHost` now correctly intercepts system back calls even
after the Activity has been `STOPPED` and `RESUMED`."
Test: modified tests
Bug: 279118447
Change-Id: Icb6deab996d122487243f0d3d775af8c15fc7c25
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
ma...@mksolutions.com.br <ma...@mksolutions.com.br> #6
This has been fixed internally and will be available in Navigation 2.7.0-beta01.
Description
Android Studio Version: Unknown
Emulator Version (Emulator--> Extended Controls--> Emulator Version): 31.2.10-8420304
HAXM / KVM Version: KVM 12.0.0
Android SDK Tools: 26.1.1
Host Operating System: Ubuntu 22.04.1 LTS
CPU Manufacturer: AMD CPU
Virtualization is supported
64-bit CPU
RAM: 9887 MB
GPU:
Build Fingerprint:
AVD Details: Name: Pixel_4_API_31
CPU/ABI: x86_64
Path: /home/mauricio/.android/avd/Pixel_4_API_31.avd
Target: google_apis_playstore [Google Play] (API level 31)
Skin: 1080x2280
SD Card: 512 MB
AvdId: Pixel_4_API_31
PlayStore.enabled: true
avd.ini.displayname: Pixel 4 API 31
avd.ini.encoding: UTF-8
disk.dataPartition.size: 2G
fastboot.chosenSnapshotFile:
fastboot.forceChosenSnapshotBoot: no
fastboot.forceColdBoot: yes
fastboot.forceFastBoot: no
hw.accelerometer: yes
hw.arc: false
hw.audioInput: yes
hw.battery: yes
hw.camera.back: virtualscene
hw.camera.front: emulated
hw.cpu.ncore: 4
hw.dPad: no
hw.device.hash2: MD5:6b5943207fe196d842659d2e43022e20
hw.device.manufacturer: Google
hw.gps: yes
hw.gpu.enabled: yes
hw.gpu.mode: auto
hw.initialOrientation: Portrait
hw.keyboard: yes
hw.lcd.density: 440
hw.lcd.height: 2280
hw.lcd.width: 1080
hw.mainKeys: no
hw.ramSize: 1536
hw.sdCard: yes
hw.sensors.orientation: yes
hw.sensors.proximity: yes
hw.trackBall: no
image.sysdir.1: system-images/android-31/google_apis_playstore/x86_64/
runtime.network.latency: none
runtime.network.speed: full
showDeviceFrame: no
skin.dynamic: yes
skin.path.backup: _no_skin
tag.display: Google Play
vm.heapSize: 256
Steps to Reproduce Bug:
Expected Behavior:
Observed Behavior: