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
This commit is contained in:
Lucas Dupin
2019-04-09 16:16:15 -07:00
parent a29d434006
commit 05904655ba
2 changed files with 25 additions and 6 deletions

View File

@@ -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);
}
};
}

View File

@@ -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();
}
}