From 05904655ba7e7a2cd188ecdf5ebd930ead78a48e Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 9 Apr 2019 16:16:15 -0700 Subject: [PATCH] Only show 'scanning' animation on bouncer We're trying to minimize how much information the user has to parse when authenticating. Fixes: 130223968 Test: manually swipe up and down Change-Id: I35fa0c417965dd64eefd67ec5a3b7b5076663752 --- .../statusbar/KeyguardIndicationController.java | 7 ++++++- .../android/systemui/statusbar/phone/LockIcon.java | 24 +++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index a87e50c50f51..44542eb45f93 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -83,7 +83,7 @@ public class KeyguardIndicationController implements StateListener { private final int mSlowThreshold; private final int mFastThreshold; - private LockIcon mLockIcon; + private final LockIcon mLockIcon; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private String mRestingIndication; @@ -686,5 +686,10 @@ public class KeyguardIndicationController implements StateListener { updateIndication(false); } } + + @Override + public void onKeyguardBouncerChanged(boolean bouncer) { + mLockIcon.setBouncerVisible(bouncer); + } }; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java index 6ebd6b3f04cd..3cc4a7bfa1eb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java @@ -57,8 +57,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange private int mDensity; private boolean mPulsing; private boolean mDozing; + private boolean mBouncerVisible; private boolean mLastDozing; private boolean mLastPulsing; + private boolean mLastBouncerVisible; private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */); private float mDarkAmount; @@ -109,9 +111,9 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange int state = getState(); mIsFaceUnlockState = state == STATE_SCANNING_FACE; if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing - || mLastScreenOn != mScreenOn || force) { + || mLastScreenOn != mScreenOn || mLastBouncerVisible != mBouncerVisible || force) { int iconAnimRes = getAnimationResForTransition(mLastState, state, mLastPulsing, - mPulsing, mLastDozing, mDozing); + mPulsing, mLastDozing, mDozing, mBouncerVisible); boolean isAnim = iconAnimRes != -1; Drawable icon; @@ -159,6 +161,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange mLastScreenOn = mScreenOn; mLastDozing = mDozing; mLastPulsing = mPulsing; + mLastBouncerVisible = mBouncerVisible; } setVisibility(mDozing && !mPulsing ? GONE : VISIBLE); @@ -231,8 +234,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange } private static int getAnimationResForTransition(int oldState, int newState, - boolean wasPulsing, boolean pulsing, - boolean wasDozing, boolean dozing) { + boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing, + boolean bouncerVisible) { // Never animate when screen is off if (dozing && !pulsing) { @@ -249,7 +252,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange return com.android.internal.R.anim.lock_unlock; } else if (justLocked) { return com.android.internal.R.anim.lock_lock; - } else if (newState == STATE_SCANNING_FACE) { + } else if (newState == STATE_SCANNING_FACE && bouncerVisible) { return com.android.internal.R.anim.lock_scanning; } else if (!wasPulsing && pulsing && newState != STATE_LOCK_OPEN) { return com.android.internal.R.anim.lock_in; @@ -298,4 +301,15 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange int color = ColorUtils.blendARGB(Color.TRANSPARENT, Color.WHITE, mDarkAmount); drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); } + + /** + * If bouncer is visible or not. + */ + public void setBouncerVisible(boolean bouncerVisible) { + if (mBouncerVisible == bouncerVisible) { + return; + } + mBouncerVisible = bouncerVisible; + update(); + } } -- 2.11.0