Status Update
Comments
ap...@google.com <ap...@google.com> #2
pe...@gmail.com <pe...@gmail.com> #4
ba...@gmail.com <ba...@gmail.com> #6
The resolution to this issue means that Composable functions can no longer call activity.registerForActivityResult()
via user interaction.
Is this intentional, and if so, what is the solution?
ba...@gmail.com <ba...@gmail.com> #7
Maybe I should clarify that by "Composable functions" I of course mean functions with the @Composable
flag created using Jetpack Compose.
il...@google.com <il...@google.com> #8
Re #6 - You should be using the ActivityResultRegistry
's register()
method that does not take a LifecycleOwner
register
and unregister
calls to onCommit
and onDispose
). That method is unaffected by these changes.
am...@gmail.com <am...@gmail.com> #9
I have a dynamic ui Screen that rendered based on the response. and this solved it.
wa...@gmail.com <wa...@gmail.com> #10
ku...@gmail.com <ku...@gmail.com> #12
ow...@gmail.com <ow...@gmail.com> #13
So this update completely broke our ability to launch a file picker on button click as the function to invoke the file picker is in an entirely different class and by the time it's invoked is going to just kill the app. Not really sure what the actual logic was here.
Description
Much like was done for Fragments in b/162255449 , When using the ActivityResultRegistry with a
LifecycleOwner
, the latest possible time thatregister()
should be called is while the lifecycle is CREATED. This ensures that any registered callbacks are always registered in the same exact order.If there is an attempt to register after the
LifecycleOwner
is STARTED, we should throw.This is different from b/162255449 because fragments don't move their Lifecycle until after their lifecycle callbacks (another joy of the multiple fragment lifecycles). Once b/127528777 is fixed, this will go for fragments as well.