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
Attachment actions
Description
Component used: Fragment
Version used: 1.5.5
Devices/Android versions reproduced on: Emulator SDK level 33
The
FragmentStrictMode.Policy
on aFragmentManager
is ignored in many cases and issues are instead handled by the globaldefaultPolicy
. For our usecase we only want to handle fragment issues in our ownActivity
, not other Acitivies, so we would like to use the former.I believe this happens because many issue occur while the fragment is not yet attached, so the library fails to access its
FragmentManager
. Take for example theFragmentReuseViolation
. The fragment will never be already attached when the secondadd
transaction is committed to the fragment manager, so this is never handled by a policy set on a manager. Other violations likeRetainInstanceUsageViolation
are debatable, but I believe it is (well, it was...) perfectly valid to call this during construction of the fragment, even when it is not yet attached.Is this intended behaviour? Maybe the API on FragmentManager should be removed, as this might lead devs to believe there are no violations in their code, when in fact, there are.
I have attached a sample project that displays the difference. I expect all issues to pile up in the policy specific to the fragment manager, but most appear on the global policy instead, ignoring the
FragmentManager.strictModePolicy
.