Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Component used: Core
Version used: 1.7.0-alpha02. Also affects Activity
1.4.0-alpha01
and up.When using the
addMenuProvider
methods that take aLifecycle
, callingremoveMenuProvider
doesn't actually remove the underlyingLifecycleObserver
thatMenuHostHelper
adds.This has a couple of implications:
removeMenuProvider
is called when the Lifecycle is below the givenstate
,removeMenuProvider
doesn't remove theMenuProvider
and when the Lifecycle reaches the given state, it still gets addedremoveMenuProvider
is called when the Lifecycle is above the givenstate
,removeMenuProvider
does remove theMenuProvider
, but if the Lifecycle goes down and then back up again, it gets re-added.ActivityResultRegistry
handles these cases (register
with aLifecycleOwner
, then callingunregister
) byLifecycleOwner
+LifecycleObserver
instancesMenuProvider
as the key.