power: Add wake lock based logic to re-suspend after dark resume

Desktop / Chromium - Abhishek Bhardwaj [chromium.org] - 27 February 2019 03:17 EST

This is a rework of https://crrev.com/c/1302866 monitoring all wake locks rather than just ARC++ wake locks.

This change adds functionality to support lock screen notifications for ARC++, Assistant on Chrome OS and other future clients. It adds a new module that listens to dark resume events from the power manager. It -

1. Starts a timer to check for any current app suspension wake locks.

2. After the timer in 1 expires, if no app suspension wake lock is acquired the power manager is requested to re-suspend the system. If an app suspension wake lock is acquired then another hard timeout timer is set and also an observer to the wake lock being released is set.

3. If the wake lock is released, the system is re-suspended immediately.

4. If the hard timeout in 2 expires and a wake lock is still acquired then the system is re-suspended immediately.

5. If the system transitions to a full resume all dark resume related state and timers are cleared.

On top of this change -

1. Changes were added to fix linker errors by declaring static constants in the source file as well.

2. Refactored some functions in the test code.

BUG=chromium:898297 TEST=Unit tests and end to end test with Android applications and Assistant.

Change-Id: I695a7dc666b26fce00f6b0f5d0d2017f6556f83a Reviewed-on: https://chromium-review.googlesource.com/c/1372477 Commit-Queue: Abhishek Bhardwaj

d98628eb0f72 power: Add wake lock based logic to re-suspend after dark resume
.../chromeos/chrome_browser_main_chromeos.cc | 6 +
.../chromeos/chrome_browser_main_chromeos.h | 12 +-
chromeos/BUILD.gn | 9 +
chromeos/DEPS | 3 +
chromeos/system/dark_resume_controller.cc | 140 ++++++++++++++++
chromeos/system/dark_resume_controller.h | 132 +++++++++++++++
chromeos/system/dark_resume_controller_unittest.cc | 183 +++++++++++++++++++++
7 files changed, 482 insertions(+), 3 deletions(-)

Upstream: git.chromium.org


  • Share