Register / Unregister UI listener in onResume / onPause.

This can cause the UI listener to be called when the UI is not meant to
be interacted with otherwise.

Bug: 226099985
Test: atest CtsSafetyCenterTestCases
Change-Id: I51ba547c140fc9eb28aacdd7e7dcffc2cbde0eab
1 file changed