Merge "Update kg lock icon logic" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-07-16 20:06:22 +00:00
committed by Android (Google) Code Review

View File

@@ -93,6 +93,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
@NonNull private final AnimatedVectorDrawable mFpToUnlockIcon; @NonNull private final AnimatedVectorDrawable mFpToUnlockIcon;
@NonNull private final AnimatedVectorDrawable mLockToUnlockIcon; @NonNull private final AnimatedVectorDrawable mLockToUnlockIcon;
@NonNull private final Drawable mLockIcon; @NonNull private final Drawable mLockIcon;
@NonNull private final Drawable mUnlockIcon;
@NonNull private final CharSequence mUnlockedLabel; @NonNull private final CharSequence mUnlockedLabel;
@NonNull private final CharSequence mLockedLabel; @NonNull private final CharSequence mLockedLabel;
@Nullable private final Vibrator mVibrator; @Nullable private final Vibrator mVibrator;
@@ -148,6 +149,10 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
mVibrator = vibrator; mVibrator = vibrator;
final Context context = view.getContext(); 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( mLockIcon = mView.getContext().getResources().getDrawable(
R.anim.lock_to_unlock, R.anim.lock_to_unlock,
mView.getContext().getTheme()); mView.getContext().getTheme());
@@ -227,8 +232,9 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
return; return;
} }
boolean wasShowingFpIcon = mHasUdfps && !mShowUnlockIcon && !mShowLockIcon; boolean wasShowingFpIcon = mUdfpsEnrolled && !mShowUnlockIcon && !mShowLockIcon;
boolean wasShowingLockIcon = mShowLockIcon; boolean wasShowingLockIcon = mShowLockIcon;
boolean wasShowingUnlockIcon = mShowUnlockIcon;
mShowLockIcon = !mCanDismissLockScreen && !mUserUnlockedWithBiometric && isLockScreen() mShowLockIcon = !mCanDismissLockScreen && !mUserUnlockedWithBiometric && isLockScreen()
&& (!mUdfpsEnrolled || !mRunningFPS); && (!mUdfpsEnrolled || !mRunningFPS);
mShowUnlockIcon = mCanDismissLockScreen && isLockScreen(); mShowUnlockIcon = mCanDismissLockScreen && isLockScreen();
@@ -239,14 +245,18 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
mView.setVisibility(View.VISIBLE); mView.setVisibility(View.VISIBLE);
mView.setContentDescription(mLockedLabel); mView.setContentDescription(mLockedLabel);
} else if (mShowUnlockIcon) { } else if (mShowUnlockIcon) {
if (wasShowingFpIcon) { if (!wasShowingUnlockIcon) {
mView.setImageDrawable(mFpToUnlockIcon); if (wasShowingFpIcon) {
mFpToUnlockIcon.forceAnimationOnUI(); mView.setImageDrawable(mFpToUnlockIcon);
mFpToUnlockIcon.start(); mFpToUnlockIcon.forceAnimationOnUI();
} else if (wasShowingLockIcon) { mFpToUnlockIcon.start();
mView.setImageDrawable(mLockToUnlockIcon); } else if (wasShowingLockIcon) {
mLockToUnlockIcon.forceAnimationOnUI(); mView.setImageDrawable(mLockToUnlockIcon);
mLockToUnlockIcon.start(); mLockToUnlockIcon.forceAnimationOnUI();
mLockToUnlockIcon.start();
} else {
mView.setImageDrawable(mUnlockIcon);
}
} }
mView.setVisibility(View.VISIBLE); mView.setVisibility(View.VISIBLE);
mView.setContentDescription(mUnlockedLabel); mView.setContentDescription(mUnlockedLabel);
@@ -300,6 +310,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
mFpToUnlockIcon.setTint(color); mFpToUnlockIcon.setTint(color);
mLockToUnlockIcon.setTint(color); mLockToUnlockIcon.setTint(color);
mLockIcon.setTint(color); mLockIcon.setTint(color);
mUnlockIcon.setTint(color);
} }
private void updateConfiguration() { private void updateConfiguration() {
@@ -427,7 +438,16 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
@Override @Override
public void onKeyguardShowingChanged() { 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(); updateKeyguardShowing();
if (mIsKeyguardShowing) {
mUserUnlockedWithBiometric =
mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(
KeyguardUpdateMonitor.getCurrentUser());
}
mUdfpsEnrolled = mKeyguardUpdateMonitor.isUdfpsEnrolled(); mUdfpsEnrolled = mKeyguardUpdateMonitor.isUdfpsEnrolled();
updateVisibility(); updateVisibility();
} }