• Abhishek Bhardwaj's avatar
    Reland "arc: Add wake lock based logic to re-suspend after dark resume" · 91b547aa
    Abhishek Bhardwaj authored
    This is a reland of https://crrev.com/c/1297474.
    
    This change adds functionality to support lock screen notifications for
    Android. The wake lock module now listens to dark resume notifications
    from the power manager. It -
    
    1. Starts a timer to check for partial wake locks acquired by Android.
    
    2. After the timer in 1 expires, if no partial wake lock is acquired the
    power manager is requested to re-suspend the system. If a partial wake
    lock is acquired, then another hard timeout timer is set and also an
    observer to wake lock release is set.
    
    3. If wake lock is released, the system is re-suspended immediately.
    
    4. If a wake lock is still acquired but the hard timeout expires 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.
    
    Change-Id: I573f130fad2ed092d8acb83fb3319614b4ce8e02
    Reviewed-on: https://chromium-review.googlesource.com/c/1302866Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
    Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#603264}
    91b547aa
wake_lock_observer.h 951 Bytes