diff options
| author | 2022-01-10 15:21:07 -0800 | |
|---|---|---|
| committer | 2022-01-10 15:37:01 -0800 | |
| commit | 5cfcf44e13d548b633e71f76e989b0202c5e62da (patch) | |
| tree | cd01ab1481dacefb3e7f1caf6adfc4405144c18c | |
| parent | cd88027c3eb12baaefbee93b95f088d2611e18e4 (diff) | |
Only execute relayout after animation is over
After the keyguard dismissal animation is over, there will be an
expensive frame where a relayout is needed.
This relayout should only happen after processing the whole animation,
otherwise there will be jank. In order to do so, we'll post
onKeyguardExitFinished() and related methods to the next frame.
Test: atest KeyguardViewMediator
Test: perfetto trace
Fixes: 210434695
Change-Id: Ic2387474e095189ed2e23b177c243247af2198bf
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 4658a745b680..094b1927480d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -100,6 +100,7 @@ import com.android.keyguard.KeyguardViewController; import com.android.keyguard.ViewMediatorCallback; import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.systemui.CoreStartable; +import com.android.systemui.DejankUtils; import com.android.systemui.Dumpable; import com.android.systemui.animation.Interpolators; import com.android.systemui.broadcast.BroadcastDispatcher; @@ -2345,16 +2346,20 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, // Block the panel from expanding, in case we were doing a swipe to dismiss gesture. mKeyguardViewControllerLazy.get().blockPanelExpansionFromCurrentTouch(); final boolean wasShowing = mShowing; - onKeyguardExitFinished(); + InteractionJankMonitor.getInstance().end(CUJ_LOCKSCREEN_UNLOCK_ANIMATION); - if (mKeyguardStateController.isDismissingFromSwipe() || wasShowing) { - mKeyguardUnlockAnimationControllerLazy.get().hideKeyguardViewAfterRemoteAnimation(); - } + // Post layout changes to the next frame, so we don't hang at the end of the animation. + DejankUtils.postAfterTraversal(() -> { + onKeyguardExitFinished(); - finishSurfaceBehindRemoteAnimation(cancelled); - mSurfaceBehindRemoteAnimationRequested = false; - mKeyguardUnlockAnimationControllerLazy.get().notifyFinishedKeyguardExitAnimation(); - InteractionJankMonitor.getInstance().end(CUJ_LOCKSCREEN_UNLOCK_ANIMATION); + if (mKeyguardStateController.isDismissingFromSwipe() || wasShowing) { + mKeyguardUnlockAnimationControllerLazy.get().hideKeyguardViewAfterRemoteAnimation(); + } + + finishSurfaceBehindRemoteAnimation(cancelled); + mSurfaceBehindRemoteAnimationRequested = false; + mKeyguardUnlockAnimationControllerLazy.get().notifyFinishedKeyguardExitAnimation(); + }); } /** |