Commit 3e3bfb0e authored by Henrique Grandinetti's avatar Henrique Grandinetti Committed by Commit Bot

Fix TimeLimit notifications scheduled time.

Bug: 860674
Change-Id: Iac33adab459abf7bae5f4fae513eea5c06335412
Reviewed-on: https://chromium-review.googlesource.com/1133460Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Henrique Grandinetti <hgrandinetti@google.com>
Cr-Commit-Position: refs/heads/master@{#574721}
parent 3c279f29
......@@ -129,18 +129,18 @@ void ScreenTimeController::CheckTimeLimit() {
}
if (notification_type.has_value()) {
// Schedule notification based on the remaining screen time.
const base::TimeDelta remaining_usage = state.remaining_usage;
if (remaining_usage >= kWarningNotificationTimeout) {
// Schedule notification based on the remaining screen time until lock.
const base::TimeDelta remaining_time = state.next_state_change_time - now;
if (remaining_time >= kWarningNotificationTimeout) {
warning_notification_timer_.Start(
FROM_HERE, remaining_usage - kWarningNotificationTimeout,
FROM_HERE, remaining_time - kWarningNotificationTimeout,
base::BindRepeating(
&ScreenTimeController::ShowNotification, base::Unretained(this),
notification_type.value(), kWarningNotificationTimeout));
}
if (remaining_usage >= kExitNotificationTimeout) {
if (remaining_time >= kExitNotificationTimeout) {
exit_notification_timer_.Start(
FROM_HERE, remaining_usage - kExitNotificationTimeout,
FROM_HERE, remaining_time - kExitNotificationTimeout,
base::BindRepeating(
&ScreenTimeController::ShowNotification, base::Unretained(this),
notification_type.value(), kExitNotificationTimeout));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment