
There are two main changes in this commit: * Listen to the `prepare-for-sleep` signal from `LoginManager`, which is emitted just before suspending and just after resuming. When the signal is received, update the user’s screen time state (active or inactive), add a transition if necessary, and save the screen time history if necessary. * Factor the `preparingForSleep` property of `LoginManager` into the user’s screen time state, meaning that the user will be considered inactive between the system going for suspend and coming back from resume. The rest of the changes in the commit are boilerplate to allow for this functionality to be unit tested. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8185 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3643>