Fixed
Status Update
Comments
ix...@gmail.com <ix...@gmail.com> #2
Could you please provide a sample project that reproduces your issue?
You are right about restoring the request codes, but under normal usage of the API, that should not cause this failure.
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #3
Unfortunately I'm unable to reproduce the issue neither in a sample nor in the real project.
These crashes are received from the users of production app. I'll try to add more logs for better understanding what users do before the crash.
jb...@google.com <jb...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b2a3eca325760e3686411e619048e2bc52befda8
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Sep 16 16:55:46 2020
Ensure request code start is consistent after restore
When the ActivityResultRegistry is recreated due to either config change
or process death, the next request code is started at the number of
current request codes without including the initial offset.
We should make sure to include the initial offset on restore to remain
consistent.
Relnote: "When restoring the ActivityResultRegistry, the request codes
are now properly started from their previous value instead of the value
of the number of existing request codes."
Test: all ActivityResultRegistryTest pass
Bug: 168374000
Change-Id: I463711fe19233877f1b534e4a7a3325fcfd8f983
M activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistry.java
https://android-review.googlesource.com/1428862
Branch: androidx-master-dev
commit b2a3eca325760e3686411e619048e2bc52befda8
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Sep 16 16:55:46 2020
Ensure request code start is consistent after restore
When the ActivityResultRegistry is recreated due to either config change
or process death, the next request code is started at the number of
current request codes without including the initial offset.
We should make sure to include the initial offset on restore to remain
consistent.
Relnote: "When restoring the ActivityResultRegistry, the request codes
are now properly started from their previous value instead of the value
of the number of existing request codes."
Test: all ActivityResultRegistryTest pass
Bug: 168374000
Change-Id: I463711fe19233877f1b534e4a7a3325fcfd8f983
M activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistry.java
Description
Component used: Fragment
Version used: 1.3.0-rc01
Devices/Android versions reproduced on: Samsuns S10e/Android 10, Google Pixel 4XL/Android 11
Reproducing: Attached a sample app, look at
MainActivity
/MainActivityViewModel
/FirstFragment
.Description of the issue:
I have stumbled upon a Fragment lifecycle issue where under certain conditions the
Fragment#onResume()
method does not get called. Conditions of reproducing:ChangeBounds
in my example),Activity#onCreate()
as a result of aLiveData
emission.It feels like some race condition, but is surprisingly stable at reproducing (pretty much at 100%, I only failed to reproduce it once on a fresh install) at different devices.
In the logs:
Any of the following actions fix the issue:
StateFlow
instead ofLiveData
in Activity (for initiating a Fragment transaction),Once one of these workarounds has been applied, logs are like this:
or