Skip to content

Draft: suspendsession: reenter suspend after waking up due to AC state change or mouse move with lid closed

Natalie Clarius requested to merge work/natalie/go-back-to-sleep into master

On some devices, plugging or unplugging AC power or moving the mouse while suspended will wake the system up, and it will not go back to sleep.

Before suspending, remember

  • the state of AC (plugged/unplugged),
  • the suspension mode (to ram/to disk) and
  • the suspension trigger (idle/button/lid close).

On about to resume, if

  • AC state has changed
  • or the reason for suspend was lid close and the lid is still closed,
  • and the suspend method was not suspend-then-hibernate,

then abort the resume and instead send the device back to sleep, in the mode appropriate for the new AC state.

Doesn't catch the cases of

  • plugged before sleep, unplugged during suspend, plugged again,
  • suspend-then-hiberated and AC state changed during suspend.

BUG: 476492 CCBUG: 466025

Edited by Natalie Clarius

Merge request reports

Loading