diff options
author | 2023-06-07 15:11:09 -0700 | |
---|---|---|
committer | 2023-06-07 15:11:09 -0700 | |
commit | f3306171de61aac1ccfabf1c58ee41ed972b206f (patch) | |
tree | dc7171abeff323b2dd20bd8b8c5e6d39944bc62f | |
parent | 4188bb6ed78378fd1a30be9048f0c085b93a4941 (diff) |
Abort queued-sleep transition if display shouldn't sleep anymore
If a SLEEP gets queued due to an ongoing transition, there's a chance
that, by the time it is executed, the display won't be sleeping
anymore. In that case, we should abort the sleep.
Bug: 283461350
Test: Use CtsControls and long-press home-controls on lockscreen
Change-Id: I2465e1e98ed459bb7d8a459e175ecf2cbbd16fbc
-rw-r--r-- | services/core/java/com/android/server/wm/RootWindowContainer.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 4995236da1be..bc7fa31125f9 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -2357,10 +2357,14 @@ class RootWindowContainer extends WindowContainer<DisplayContent> final Transition transition = new Transition(TRANSIT_SLEEP, 0 /* flags */, display.mTransitionController, mWmService.mSyncEngine); final TransitionController.OnStartCollect sendSleepTransition = (deferred) -> { - display.mTransitionController.requestStartTransition(transition, - null /* trigger */, null /* remote */, null /* display */); - // Force playing immediately so that unrelated ops can't be collected. - transition.playNow(); + if (deferred && !display.shouldSleep()) { + transition.abort(); + } else { + display.mTransitionController.requestStartTransition(transition, + null /* trigger */, null /* remote */, null /* display */); + // Force playing immediately so that unrelated ops can't be collected. + transition.playNow(); + } }; if (!display.mTransitionController.isCollecting()) { // Since this bypasses sync, submit directly ignoring whether sync-engine |