Builder
Creates Policy instances. Methods whose names start with detect
specify what problems we should look for. Methods whose names start with penalty
specify what we should do when we detect a problem.
You can call as many detect
and penalty
methods as you like. Currently order is insignificant: all penalties apply to all detected problems.
Functions
Construct the Policy instance.
Detects cases, where a Fragment instance is reused, after it was previously removed from a FragmentManager.
Detects usage of the
Detects calls to Fragment.setRetainInstance and Fragment.getRetainInstance.
Detects calls to Fragment.setUserVisibleHint.
Detects cases where a Fragment is added to a container other than a androidx.fragment.app.FragmentContainerView.
Detects nested fragments that do not use the expected parent's childFragmentManager.
Throws an exception on violation. This penalty runs at the end of all enabled penalties so you'll still get to see logging or other violations before the exception is thrown.
Call OnViolationListener.onViolation for every violation. The listener will be called on the main thread of the fragment host.
Log detected violations to the system log.