diff options
author | Beverly <beverlyt@google.com> | 2021-07-16 10:07:51 -0400 |
---|---|---|
committer | Beverly Tai <beverlyt@google.com> | 2021-07-16 19:50:42 +0000 |
commit | 126e94e2c2c349d5bb26bae5fb1275aa64ac30c7 (patch) | |
tree | fa9e0f708fc6727a0329efe1db8b8c3145b2f0e1 /packages/SystemUI/src/com/android/keyguard/LockIconViewController.java | |
parent | dea99bf55e69d9d4b6b359e4160dec99ec40067f (diff) |
Update kg lock icon logic
- don't animate fp => unlock unless udfps was enrolled
- show a static unlock icon if the device wasn't previously locked
Test: manual
- swipe to unlock
- face only
- fp only
- co-ex
- removing biometric auth => swipe to unlock
Bug: 193878791
Change-Id: I35d393383674acb03f06ea58fb8aabc2a820ad7c
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/LockIconViewController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/LockIconViewController.java | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index 373d4df146d5..5957be3c271b 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -93,6 +93,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull private final AnimatedVectorDrawable mFpToUnlockIcon; @NonNull private final AnimatedVectorDrawable mLockToUnlockIcon; @NonNull private final Drawable mLockIcon; + @NonNull private final Drawable mUnlockIcon; @NonNull private final CharSequence mUnlockedLabel; @NonNull private final CharSequence mLockedLabel; @Nullable private final Vibrator mVibrator; @@ -148,6 +149,10 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mVibrator = vibrator; final Context context = view.getContext(); + mUnlockIcon = mView.getContext().getResources().getDrawable( + R.anim.lock_to_unlock, + mView.getContext().getTheme()); + ((AnimatedVectorDrawable) mUnlockIcon).start(); mLockIcon = mView.getContext().getResources().getDrawable( R.anim.lock_to_unlock, mView.getContext().getTheme()); @@ -227,8 +232,9 @@ public class LockIconViewController extends ViewController<LockIconView> impleme return; } - boolean wasShowingFpIcon = mHasUdfps && !mShowUnlockIcon && !mShowLockIcon; + boolean wasShowingFpIcon = mUdfpsEnrolled && !mShowUnlockIcon && !mShowLockIcon; boolean wasShowingLockIcon = mShowLockIcon; + boolean wasShowingUnlockIcon = mShowUnlockIcon; mShowLockIcon = !mCanDismissLockScreen && !mUserUnlockedWithBiometric && isLockScreen() && (!mUdfpsEnrolled || !mRunningFPS); mShowUnlockIcon = mCanDismissLockScreen && isLockScreen(); @@ -239,14 +245,18 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mView.setVisibility(View.VISIBLE); mView.setContentDescription(mLockedLabel); } else if (mShowUnlockIcon) { - if (wasShowingFpIcon) { - mView.setImageDrawable(mFpToUnlockIcon); - mFpToUnlockIcon.forceAnimationOnUI(); - mFpToUnlockIcon.start(); - } else if (wasShowingLockIcon) { - mView.setImageDrawable(mLockToUnlockIcon); - mLockToUnlockIcon.forceAnimationOnUI(); - mLockToUnlockIcon.start(); + if (!wasShowingUnlockIcon) { + if (wasShowingFpIcon) { + mView.setImageDrawable(mFpToUnlockIcon); + mFpToUnlockIcon.forceAnimationOnUI(); + mFpToUnlockIcon.start(); + } else if (wasShowingLockIcon) { + mView.setImageDrawable(mLockToUnlockIcon); + mLockToUnlockIcon.forceAnimationOnUI(); + mLockToUnlockIcon.start(); + } else { + mView.setImageDrawable(mUnlockIcon); + } } mView.setVisibility(View.VISIBLE); mView.setContentDescription(mUnlockedLabel); @@ -300,6 +310,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mFpToUnlockIcon.setTint(color); mLockToUnlockIcon.setTint(color); mLockIcon.setTint(color); + mUnlockIcon.setTint(color); } private void updateConfiguration() { @@ -427,7 +438,16 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void onKeyguardShowingChanged() { + // Reset values in case biometrics were removed (ie: pin/pattern/password => swipe). + // If biometrics were removed, local vars mCanDismissLockScreen and + // mUserUnlockedWithBiometric may not be updated. + mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen(); updateKeyguardShowing(); + if (mIsKeyguardShowing) { + mUserUnlockedWithBiometric = + mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( + KeyguardUpdateMonitor.getCurrentUser()); + } mUdfpsEnrolled = mKeyguardUpdateMonitor.isUdfpsEnrolled(); updateVisibility(); } |