- Create a Snackbar and reference it in an Activity
- Don't call Snackbar.show()
- Open and close the Activity
- Notice that the Activity is not garbage collected because snackbar has a reference to it
addTouchExplorationStateChangeListener() is called in the constructor of SnackbarBaseLayout while removeTouchExplorationStateChangeListener() is called in SnackbarBaseLayout.onDetachedFromWindow().
And SnackbarBaseLayout is not attached to window until Snackbar.show() is called. So removeTouchExplorationStateChangeListener() is never called if Snackbar.show() is never called.
Therefore, touchExplorationStateChangeListener is added to AccessibilityManager without being removed.
Update to AndroidX and use com.google.android.material.snackbar.Snackbar instead.
Do not create the Snackbar unless you are ready to show it.