From 64af0e1b68bf26533df9bbe634ee83380c4dc0f5 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 24 May 2023 12:19:25 -0700 Subject: Start 2d animation when view laid out. In Pattern view, we are starting the appear animation before the view is completely laid out. When the appear animation completes, the dots in the grid are not in the true position, so when you trigger a layout, the dots will move to the true position from the position set by the appear animation. To address this, post the animation in the message queue of the view. To avoid a bad transition, set alpha to 0 until runnable in the queue is triggered. Fixes: 277037626 Test: Pattern View portrait on tablet. Open pattern view and tapping on top left most dot. Test: Unlock the device. Change-Id: I5b0f80fe823615087f5b60646225c6373529fd56 --- .../src/com/android/keyguard/KeyguardPatternView.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java index afc25909ca91..99b5d52f8322 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java @@ -158,15 +158,18 @@ public class KeyguardPatternView extends KeyguardInputView public void startAppearAnimation() { enableClipping(false); - setAlpha(1f); + setAlpha(0f); setTranslationY(mAppearAnimationUtils.getStartTranslation()); AppearAnimationUtils.startTranslationYAnimation(this, 0 /* delay */, 500 /* duration */, 0, mAppearAnimationUtils.getInterpolator(), getAnimationListener(InteractionJankMonitor.CUJ_LOCKSCREEN_PATTERN_APPEAR)); - mAppearAnimationUtils.startAnimation2d( - mLockPatternView.getCellStates(), - () -> enableClipping(true), - this); + mLockPatternView.post(() -> { + setAlpha(1f); + mAppearAnimationUtils.startAnimation2d( + mLockPatternView.getCellStates(), + () -> enableClipping(true), + KeyguardPatternView.this); + }); if (!TextUtils.isEmpty(mSecurityMessageDisplay.getText())) { mAppearAnimationUtils.createAnimation(mSecurityMessageDisplay, 0, AppearAnimationUtils.DEFAULT_APPEAR_DURATION, -- cgit v1.2.3-59-g8ed1b