From cb3d45a92f10b624533076af907ec631f4ea3617 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 8 Sep 2017 18:00:18 -0700 Subject: [PATCH] Fixed an issue where the pattern wouldn't show properly Because we were still collapsed, the height of the pattern could still remain 0 and we would try to animate in a state that doesn't make sense. we're now delaying it until we're drawn. Change-Id: I2588e5ccd45f1f472825e5502590a9890029a9b8 Fixes: 65441390 Test: follow steps on bug, observe normal pattern --- .../android/systemui/statusbar/phone/KeyguardBouncer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index fd95cc4adc1d6..42c454db90022 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -69,6 +69,7 @@ public class KeyguardBouncer { } }; private final Runnable mRemoveViewRunnable = this::removeView; + private int mStatusBarHeight; public KeyguardBouncer(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils, ViewGroup container, @@ -128,7 +129,9 @@ public class KeyguardBouncer { mRoot.setVisibility(View.VISIBLE); mKeyguardView.onResume(); showPromptReason(mBouncerPromptReason); - if (mKeyguardView.getHeight() != 0) { + // We might still be collapsed and the view didn't have time to layout yet or still + // be small, let's wait on the predraw to do the animation in that case. + if (mKeyguardView.getHeight() != 0 && mKeyguardView.getHeight() != mStatusBarHeight) { mKeyguardView.startAppearAnimation(); } else { mKeyguardView.getViewTreeObserver().addOnPreDrawListener( @@ -251,6 +254,8 @@ public class KeyguardBouncer { mKeyguardView.setLockPatternUtils(mLockPatternUtils); mKeyguardView.setViewMediatorCallback(mCallback); mContainer.addView(mRoot, mContainer.getChildCount()); + mStatusBarHeight = mRoot.getResources().getDimensionPixelOffset( + com.android.systemui.R.dimen.status_bar_height); mRoot.setVisibility(View.INVISIBLE); mRoot.dispatchApplyWindowInsets(mRoot.getRootWindowInsets()); }