Merge lp:~mterry/unity-system-compositor/inactivity-zero-fix into lp:unity-system-compositor

Proposed by Michael Terry
Status: Rejected
Rejected by: Michael Terry
Proposed branch: lp:~mterry/unity-system-compositor/inactivity-zero-fix
Merge into: lp:unity-system-compositor
Diff against target: 22 lines (+6/-0)
1 file modified
src/mir_screen.cpp (+6/-0)
To merge this branch: bzr merge lp:~mterry/unity-system-compositor/inactivity-zero-fix
Reviewer Review Type Date Requested Status
Michael Terry (community) Disapprove
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+268276@code.launchpad.net

Commit message

Fix screen turning off in middle of interacting with phone after receiving an SMS with an inactivity value of "never".

This branch cancels power-off and dimmer timeout alarms when resetting for a reason that has zero-timeout value. Historically, we could entirely ignore such resets, because when the zero-timeout value was set (in set_inactivity_timeouts), we cancelled timers. And just never re-enabled them. So the reset() call due to input activity didn't matter.

But now that we have two sets of timeout values [1], the alarms might be active when we try to reset a zero-timer for inactivity. We can't just ignore such an event, we now need to cancel the alarms.

[1] https://code.launchpad.net/~afrantzis/unity-system-compositor/notification-timeouts/+merge/264853

Description of the change

Fix screen turning off in middle of interacting with phone after receiving an SMS with an inactivity value of "never".

This branch cancels power-off and dimmer timeout alarms when resetting for a reason that has zero-timeout value. Historically, we could entirely ignore such resets, because when the zero-timeout value was set (in set_inactivity_timeouts), we cancelled timers. And just never re-enabled them. So the reset() call due to input activity didn't matter.

But now that we have two sets of timeout values [1], the alarms might be active when we try to reset a zero-timer for inactivity. We can't just ignore such an event, we now need to cancel the alarms.

I've assumed that a zero value for *any* timeout reason means "never". I don't think that's a super reasonable value for a notification timeout. But neither is zero milliseconds. So I left it as "never". But if you all don't like that, I can also add a check that reason==inactivity before cancelling the alarms.

I also have not added any unit tests, though this would be an excellent candidate for them. I'll do that as a future MP. I just wanted to get this MP in there soon to increase its chances of landing in OTA6.

[1] https://code.launchpad.net/~afrantzis/unity-system-compositor/notification-timeouts/+merge/264853

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

Hrm... There might also be a bug in MirScreen around a notification happening while the screen is on. This would set a timeout of, say, 15s. And if the user didn't cause any activity in those 15s, the screen would turn off, which isn't correct...

This needs a quick additional think.

Revision history for this message
Josh Arenson (josharenson) wrote :

> Hrm... There might also be a bug in MirScreen around a notification happening
> while the screen is on. This would set a timeout of, say, 15s. And if the
> user didn't cause any activity in those 15s, the screen would turn off, which
> isn't correct...
>
> This needs a quick additional think.

I was able to reproduce the original bug, and this patch _does_ seems to fix it. However, the screen still does turn off after a period of no activity as you mentioned.

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> Hrm... There might also be a bug in MirScreen around a notification happening
> while the screen is on. This would set a timeout of, say, 15s. And if the
> user didn't cause any activity in those 15s, the screen would turn off, which
> isn't correct...
>
> This needs a quick additional think.

I have proposed an alternative branch (which incorporates the change proposed in this branch), plus behavioral improvements for the scenario you describe, plus tests:

https://code.launchpad.net/~afrantzis/unity-system-compositor/fix-1485737-notification-with-inactivity-zero

Let me know how it works for you.

Revision history for this message
Michael Terry (mterry) wrote :

Rejecting in favor of alf's branch

review: Disapprove

Unmerged revisions

243. By Michael Terry

Cancel power timeout alarms when a timeout value is set to zero (never timeout)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/mir_screen.cpp'
2--- src/mir_screen.cpp 2015-07-27 17:01:28 +0000
3+++ src/mir_screen.cpp 2015-08-17 21:35:44 +0000
4@@ -256,6 +256,9 @@
5 power_off_alarm->reschedule_in(timeouts.power_off_timeout);
6 next_power_off = new_next_power_off;
7 }
8+ } else {
9+ power_off_alarm->cancel();
10+ next_power_off = {};
11 }
12
13 if (timeouts.dimming_timeout.count() > 0)
14@@ -266,6 +269,9 @@
15 dimmer_alarm->reschedule_in(timeouts.dimming_timeout);
16 next_dimming = new_next_dimming;
17 }
18+ } else {
19+ dimmer_alarm->cancel();
20+ next_dimming = {};
21 }
22 }
23

Subscribers

People subscribed via source and target branches