Moved user visibility callback to its own listener.
Commit 9edf758fd65ab786314ccec29fdb64f396dc0ed3 introduced a
onUserVisibilityChanged() method on SystemService, but although
the user visibility change is typically associated with its
lifecycle state changes (which is what is reported by those
SystemService callback), that's not always the case. For example,
if the user that is switched to the foreground was already running
in the background, both that user visibility and the visibility of
its profiles would be changed to visible (if they were also in the
background), even though their "lifecycle state" didn't change.
So, it's better to handle these changes in a separate listener.
Test: adb logcat -D -b events | egrep '(I um_|I ssm_)' # while changing users
Test: atest FrameworksServicesTests:UserControllerTest
Bug: 244333150
Bug: 255895655
Change-Id: Ic5a51a4c75a0ec343be944f2628a3cd1f9e75898
8 files changed