fix(screen-time):pause tracking while session is locked - #3897
fix(screen-time):pause tracking while session is locked#3897AdityaKr015 wants to merge 3 commits into
Conversation
[P3] PR 3897 can restart the timer while lockedScreenTimeService::setEnabled() / restartTicking() Trigger:
No usage is currently misattributed because the active app key remains empty, but the service is |
|
Done, tell me if there anything else is wrong too |
[P2] Preserve the suspend pause when the lock clearsapplication_ui.cpp unlock callback /src/app/application_ui.cpp#L333-L340 unconditionally calls: m_screenTimeService.setTrackingPaused(false);m_trackingPaused now represents two independent reasons: session lock and system suspend. This transition is incorrect:
The wake callback cannot restore the lost invariant: because the session is unlocked, it calls setTrackingPaused(false) again, which is a no-op. Track the causes independently—e.g. sessionLocked and preparingForSleep—and derive pause state as sessionLocked || preparingForSleep. Alternatively, gate the unlock resume on an explicit sleep-preparation flag. Previous findingThe earlier timer-restart finding is fixed correctly: restartTicking() now returns while paused, including when configuration enables screen time during a lock. Non-blocking correctionIn PrepareForSleep(false): if (!m_lockScreen.isSessionLocked()) {
// Still locked after wake; the unlock hook resumes tracking.The comment is inverted. This branch runs when the session is not locked. |
|
Done. pushed a fix. Sorry for the wrong comment, used |
|
Closing it. Will push for suspend since it is missing. |
Summary
This PR fixes the screen time accumulating usage while the session is locked.
Motivation
Just to keep screen time not counting usage when session is locked or suspended.
Type of Change
Related Issue
Closes #3882
Testing
just format,just build,just testall were clean and passed.pkill noctaliathen started build debug./build-debug/noctaliaManual Coverage
Checklist
CONTRIBUTING.md.just formatwith clang-format v22+ installed.assets/translations/en.json, or this PR adds no new user-facing strings.