Status Update
Comments
km...@google.com <km...@google.com>
lo...@gmail.com <lo...@gmail.com> #2
Is this specific to navigation? Or can this be reproduced with another other Composable component?
bo...@google.com <bo...@google.com>
wd...@google.com <wd...@google.com> #3
It only happens inside of a NavHost. So, yes, it seems to be specific to navigation.
wd...@google.com <wd...@google.com> #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
ra...@google.com <ra...@google.com> #6
This has been fixed internally and will be available in Navigation 2.7.0-beta01.
wd...@google.com <wd...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.7.0-beta01
wd...@google.com <wd...@google.com> #9
I wouldn't say this is fixed. If you add a back-callback in the activity which is lifecycle aware, and then background->foreground the app, the activity back-callback will be put on top of the callback pile. This leads to that any BackHandler in your composable will NOT be triggered.
The best workaround I have for now is to use the non-lifecycle aware function in the activity.
class MainActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// open fragment which hoists the composables
...
if (savedInstanceState == null) {
onBackPressedDispatcher.addCallback(onBackPressedCallback = someBackHandling())
// onBackPressedDispatcher.addCallback(owner = this, onBackPressedCallback = someBackHandling) // not this one
}
}
wd...@google.com <wd...@google.com> #10
bo...@google.com <bo...@google.com>
de...@google.com <de...@google.com>
wd...@google.com <wd...@google.com> #11
ra...@google.com <ra...@google.com> #12
Bug Fixes : NavHost in Navigation Compose now correctly intercepts system back calls even after the Activity has been STOPPED and RESUMED.
It works fine for me.
wd...@google.com <wd...@google.com> #13
ra...@google.com <ra...@google.com> #14
In my case it works fine when the app is first ran, but my custom callback calls navController.popBackStack internally if it can't handle back press on its own. So, when I run the app and click back, everything works, but after I pop up all the Composables from the stack and return to the app, the custom callback is not called anymore.
wd...@google.com <wd...@google.com> #15
Re
Note that you should never, ever be calling navController.popBackStack()
in your own BackHandler
as Navigation must be the only one handling its own back stack with the system back button so that Predictive Back works correctly in the future.
mi...@mercurydevelopment.com <mi...@mercurydevelopment.com> #16
wd...@google.com <wd...@google.com> #17
I believe this is still an issue even without using NavHost like mentioned in
mi...@mercurydevelopment.com <mi...@mercurydevelopment.com> #18
Hi
I'm using MacBook Pro with Apple Silicon and macOS Ventura 13.0.1.
Steps are pretty straightforward:
- Power adapter is plugged in. Energy mode is set to Automatic for both 'On battery' and 'On power adapter' options.
- Run emulator.
- Keep it running until macbook automatically goes to sleep.
- Wake it up after ~10 minutes and observe the time in the emulator. It shows not the actual time but the time when macbook fell asleep.
I'm not sure that this happens all the time but often enough.
wd...@google.com <wd...@google.com> #19
RE#18 Really appreciate it. I will start testing it.
wd...@google.com <wd...@google.com> #20
#18
One more question: After step 4 Wake it up after ~10 minutes and observe the time in the emulator. It shows not the actual time but the time when macbook fell asleep.
, have you tried to move the emulator window? I think the time should be updated when you starting using the emulator.
mi...@mercurydevelopment.com <mi...@mercurydevelopment.com> #21
I'm not sure that I've moved the emulator window but usually I install our app using Android Studio and see network errors due to time difference between the app and our servers. So it looks like the time isn't updated in this case.
ne...@gmail.com <ne...@gmail.com> #22
Em sex., 3 de fev. de 2023 15:08, <buganizer-system@google.com> escreveu:
wd...@google.com <wd...@google.com> #23
RE#21 Another question, are you using the emulator in a tool window? I think it might be the specific scenario which still has bug.
mi...@mercurydevelopment.com <mi...@mercurydevelopment.com> #24
I'm launching the emulator in a standalone window.
wd...@google.com <wd...@google.com> #25
RE#24
Ok, I tried it myself and I could not reproduce unfortunately. With have you tried to move the emulator window? I think the time should be updated when you starting using the emulator.
being said, would it be possible for you to try it again?
mi...@mercurydevelopment.com <mi...@mercurydevelopment.com> #26
Sure, will try
ne...@gmail.com <ne...@gmail.com> #27
mandaram aí por escrito
Em sex., 3 de fev. de 2023 15:59, <buganizer-system@google.com> escreveu:
mi...@mercurydevelopment.com <mi...@mercurydevelopment.com> #28
Unfortunately, it happened again. Moving a window did not help.
Some additional info:
- I use a pair of external displays connected via Type-C, Bluetooth keyboard and mouse.
- Power adapter is plugged in. This way I can safely close a macbook lid and continue using it with the external displays. When macbook is sleeping I can wake it up by pressing a key on a keyboard or by clicking a mouse button.
- Today I left my workplace for 40-50 minutes. When I came back, external displays were in standby mode. After waking the macbook up, I've reproduced the issue.
wd...@google.com <wd...@google.com> #29
RE#28 I realized what went wrong. My fix didn't merge into the 32 release. It's only available in the 31 release and the dev branch. Let me resolve that issue real quick and release a new version. Thanks for your input!
mi...@mercurydevelopment.com <mi...@mercurydevelopment.com> #30
Thank you!
wd...@google.com <wd...@google.com>
wd...@google.com <wd...@google.com>
de...@google.com <de...@google.com> #31
ranjitkumar@
mp...@gmail.com <mp...@gmail.com> #32
pa...@marketrebellion.com <pa...@marketrebellion.com> #33
Host: Darwin Kernel Version 22.4.0 arm64
wd...@google.com <wd...@google.com>
wd...@google.com <wd...@google.com>
wd...@google.com <wd...@google.com> #35
The fix is available in the next canary and stable release in June.
de...@google.com <de...@google.com> #36
de...@google.com <de...@google.com> #39
si...@gmail.com <si...@gmail.com> #40
Android emulator version 33.1.4-9936625
Host: macbook pro M1 Max, macOs: 13.5.1 (22G90)
Is there anything I need to do to fix this?
si...@meta.com <si...@meta.com> #42
wd...@google.com <wd...@google.com> #43
RE#42 Thanks for the feedback on the emulator. To help us troubleshoot this issue further, we will need more information. Please share detailed reproduction steps as much as possible of the following information:
1, Run the emulator from command line with “$ANDROID_SDK_ROOT/emulator/emulator -avd <NameOfAVD> -verbose -wipe-data” and send the logs from terminal
2, Run adb bugreport and send the zip file.
ra...@google.com <ra...@google.com>
wd...@google.com <wd...@google.com>
ra...@gmail.com <ra...@gmail.com> #44
I confirm 34.1.9 has no this issue anymore
Description
Please Read:https://developer.android.com/studio/report-bugs.html#emulator-bugs
Android Studio Version: 2021.3
Emulator Version (Emulator--> Extended Controls--> Emulator Version): 31.3.13-9189900 HAXM / KVM Version: HVF 12.6.0
Android SDK Tools: 26.1.1
Host Operating System: macOS 12.6
CPU Manufacturer: Apple CPU: Apple M1 Max
RAM: 65536 MB
GPU:
Build Fingerprint:
AVD Details: Name: Pixel_3a_API_33_arm64-v8a CPU/ABI: arm64 Path: /Users/ralfeus/.android/avd/Pixel_3a_API_33_arm64-v8a.avd Target: google_apis [Google APIs] (API level 33) Skin: 1080x2220 SD Card: 800 MB AvdId: Pixel_3a_API_33_arm64-v8a PlayStore.enabled: false avd.ini.displayname: Pixel_3a_API_33_arm64-v8a avd.ini.encoding: UTF-8 disk.dataPartition.size: 2G fastboot.chosenSnapshotFile: fastboot.forceChosenSnapshotBoot: no fastboot.forceColdBoot: no fastboot.forceFastBoot: yes hw.accelerometer: yes hw.arc: false hw.audioInput: yes hw.battery: yes hw.camera.back: emulated hw.camera.front: emulated hw.cpu.ncore: 1 hw.dPad: no hw.device.hash2: MD5:0e6953ebf01bdc6b33a2f54746629c50 hw.device.manufacturer: Google hw.device.name: pixel_3a hw.gps: yes hw.gpu.enabled: yes hw.gpu.mode: auto hw.initialOrientation: Portrait hw.keyboard: yes hw.lcd.density: 440 hw.lcd.height: 2220 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-33/google_apis/arm64-v8a/ runtime.network.latency: none runtime.network.speed: full showDeviceFrame: no skin.dynamic: yes skin.path.backup: _no_skin tag.display: Google APIs tag.id: google_apis vm.heapSize: 256
Steps to Reproduce Bug:
Expected Behavior: Time matches one of host or real one from NTP server
Observed Behavior: Time is behind real one