diff options
| author | 2018-03-21 15:59:15 -0700 | |
|---|---|---|
| committer | 2018-03-22 23:20:19 +0000 | |
| commit | 28dc9d7dfd28703cd1c8c80349bfb33fb439f8e3 (patch) | |
| tree | 07ebc695924f09f60ebe6d748c4c6f76937ff7ef | |
| parent | 3d565fa8dd654fc2473db7a4bba5d4a41a3a6254 (diff) | |
Do not show bouncer when fading away
Change-Id: I2d09a84ec7cda04dab3095f16f3c6e3acd425c76
Fixes: 76035580
Test: atest packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
Test: double tap on notification, dismiss bouncer
Test: swipe up, dismiss bouncer
Test: go to emergency dialer, hit back
Test: fp from lock screen
Test: fp from AOD
3 files changed, 32 insertions, 4 deletions
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 0370d4cd6929..d609ae7b7374 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -75,6 +75,7 @@ public class KeyguardBouncer { protected ViewGroup mRoot; private boolean mShowingSoon; private int mBouncerPromptReason; + private boolean mIsAnimatingAway; public KeyguardBouncer(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils, ViewGroup container, @@ -254,6 +255,7 @@ public class KeyguardBouncer { mKeyguardView.cancelDismissAction(); mKeyguardView.cleanUp(); } + mIsAnimatingAway = false; if (mRoot != null) { mRoot.setVisibility(View.INVISIBLE); if (destroyView) { @@ -269,6 +271,7 @@ public class KeyguardBouncer { * See {@link StatusBarKeyguardViewManager#startPreHideAnimation}. */ public void startPreHideAnimation(Runnable runnable) { + mIsAnimatingAway = true; if (mKeyguardView != null) { mKeyguardView.startDisappearAnimation(runnable); } else if (runnable != null) { @@ -296,6 +299,14 @@ public class KeyguardBouncer { && mExpansion == 0; } + /** + * @return {@code true} when bouncer's pre-hide animation already started but isn't completely + * hidden yet, {@code false} otherwise. + */ + public boolean isAnimatingAway() { + return mIsAnimatingAway; + } + public void prepare() { boolean wasInitialized = mRoot != null; ensureView(); @@ -312,7 +323,7 @@ public class KeyguardBouncer { */ public void setExpansion(float fraction) { mExpansion = fraction; - if (mKeyguardView != null) { + if (mKeyguardView != null && !mIsAnimatingAway) { float alpha = MathUtils.map(ALPHA_EXPANSION_THRESHOLD, 1, 1, 0, fraction); mKeyguardView.setAlpha(MathUtils.constrain(alpha, 0f, 1f)); mKeyguardView.setTranslationY(fraction * mKeyguardView.getHeight()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 537d465b6d4b..56a7b1ba37d1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -150,7 +150,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBouncer.setExpansion(expansion); if (expansion == 1) { mBouncer.onFullyHidden(); - } else if (!mBouncer.isShowing()) { + } else if (!mBouncer.isShowing() && !mBouncer.isAnimatingAway()) { mBouncer.show(true /* resetSecuritySelection */, false /* notifyFalsing */); } else if (noLongerTracking) { // Notify that falsing manager should stop its session when user stops touching, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java index 3a8f443627ed..a37947df7094 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java @@ -22,8 +22,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.calls; -import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; @@ -279,6 +277,25 @@ public class KeyguardBouncerTest extends SysuiTestCase { } @Test + public void testIsHiding_preHideOrHide() { + Assert.assertFalse("Should not be hiding on initial state", mBouncer.isAnimatingAway()); + mBouncer.startPreHideAnimation(null /* runnable */); + Assert.assertTrue("Should be hiding during pre-hide", mBouncer.isAnimatingAway()); + mBouncer.hide(false /* destroyView */); + Assert.assertFalse("Should be hidden after hide()", mBouncer.isAnimatingAway()); + } + + @Test + public void testIsHiding_skipsTranslation() { + mBouncer.show(false /* reset */); + reset(mKeyguardHostView); + mBouncer.startPreHideAnimation(null /* runnable */); + mBouncer.setExpansion(0.5f); + verify(mKeyguardHostView, never()).setTranslationY(anyFloat()); + verify(mKeyguardHostView, never()).setAlpha(anyFloat()); + } + + @Test public void testIsSecure() { Assert.assertTrue("Bouncer is secure before inflating views", mBouncer.isSecure()); |