• Toni Barzic's avatar
    Wait for animated wallpaper changes to finish before suspending displays · c7dbb870
    Toni Barzic authored
    PowerEventObserver delays display suspend until lock screen UI is shown
    and compositors submit enough frames to know the UI changes have reached
    displays.
    This does not account for wallpaper changes due to screen lock:
      * On screen lock, the active wallpaper will be changed with its blurred
        version.
      * If screen lock changes the active user (e.g. if the screen is locked
        from the secondary user), the wallpaper will change to the new
        active user's blurred wallpaper.
    Given that PowerEventObserver does not ensure wallpaper switch is done
    before it stops drawing to the display, the first frame shown on the
    device resume might still contain the UI from before wallpaper change.
    
    This changes PowerEventObserver to additionally wait for any active
    wallpaper changes (which can be detected by checking
    WallpaperWidgetController::IsAnimating - set while wallpaper widget is
    being changed) to finish before it starts waiting for compositor frames
    to get composited, thus ensuring the correct wallpaper is set when the
    display/compositing is suspended.
    
    Adds the following methods to WallpaperWidgetController:
      * AddPendingAnimationEndCallback - to provide a way for
        PowerEventObserver to get notified when the pending wallpaper change
        completes
      * EndPendingAnimation which can be used to force immediate wallpaper
        change when device starts suspending (and prevents suspend flow from
        being blocked on unnecessarily waiting for new wallpaper animation)
    
    BUG=820436,803762
    
    Change-Id: Iad2074280ebba740b95c50b9d60a028bf5a0d45c
    Reviewed-on: https://chromium-review.googlesource.com/956757Reviewed-by: default avatarDan Erat <derat@chromium.org>
    Reviewed-by: default avatarWenzhao (Colin) Zang <wzang@chromium.org>
    Commit-Queue: Toni Barzic <tbarzic@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#542945}
    c7dbb870
power_event_observer_unittest.cc 23.8 KB