From 6883edae21f61aacbad6efb925d2d920015e9243 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 3 Aug 2023 09:11:16 -0700 Subject: [PATCH 1/3] Refine password disappear animation. In the disappear animation, tie alpha of the view to animated value. Before this fix, the view alpha is 1 until the animation is complete and looks janky. Fixes: 284436144 Test: unlock password with swipe up. Test: unlock password with tap on notificaiton. Test: unlock password with tap on settings from QS. Change-Id: Ide0e632df5f4f32ecdb5ab27d4435f3e3785eecc --- .../src/com/android/keyguard/KeyguardPasswordView.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java index 03d9eb3455fdb..a9910a128e13d 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java @@ -189,17 +189,18 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { if (controller.isCancelled()) { return; } + float value = (float) animation.getAnimatedValue(); + float fraction = anim.getAnimatedFraction(); Insets shownInsets = controller.getShownStateInsets(); int dist = (int) (-shownInsets.bottom / 4 - * anim.getAnimatedFraction()); + * fraction); Insets insets = Insets.add(shownInsets, Insets.of(0, 0, 0, dist)); if (mDisappearAnimationListener != null) { mDisappearAnimationListener.setTranslationY(-dist); } - controller.setInsetsAndAlpha(insets, - (float) animation.getAnimatedValue(), - anim.getAnimatedFraction()); + controller.setInsetsAndAlpha(insets, value, fraction); + setAlpha(value); }); anim.addListener(new AnimatorListenerAdapter() { @Override From 0f0a5bd651d6184ed6c45e1cd8069bb8f09559d1 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 3 Aug 2023 11:20:37 -0700 Subject: [PATCH 2/3] Do not finish lockscreen for multiple sims. Currently, in the logic, if the lockscreen is disabled, we finish lockscreen instead of proceeding ot the second sim. I have removed this logic. We are expecting the security mode to be SimPin/SimPuk if we are expecting an additional sim. We also do not want to finish if the security mode is supposed to be secure. Fixes: 282107332 Test: added a unit test. Test: test 2 esim cards and restart with none security. Test: test 2 esim cards and restart with swipe security. Test: test 2 esim cards and restart with pin security. Test: test 2 esim cards and restart with pin security from sim-puk to sim- pin. Change-Id: I519fcb995a5915100bd97faaa9618d573c64bcc2 --- .../KeyguardSecurityContainerController.java | 3 ++- ...KeyguardSecurityContainerControllerTest.kt | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 3b09910fbe88a..8469335b371df 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -826,7 +826,8 @@ public class KeyguardSecurityContainerController extends ViewController Date: Fri, 4 Aug 2023 11:22:33 -0700 Subject: [PATCH 3/3] Do not setenabled to false for edittext. calling #setEnabled(false) and #setEnabled(true) for some reason prevents the edit text from registering the backspace key. Also #setFocusable(boolean) also has the same behavior. By setting the cursor visibility, with the text input filter, we see the edit text but cannot add any characters into it and there is no cursor. There is a visual difference here as the old behavior would grey out the textview. Fixes: 288469866 Test: lockout with password security method. Type some stuff, exit bouncer and re-enter and type some stuff. Wait for lockout to finish and type stuff and then try to hit the backspace key. Change-Id: I5fa8e022a765c95e65c0342e68136e648d0e4ac0 --- .../src/com/android/keyguard/KeyguardPasswordView.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java index a9910a128e13d..59ee0d817ef3d 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java @@ -32,6 +32,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; +import android.content.res.ColorStateList; import android.graphics.Insets; import android.graphics.Rect; import android.os.Trace; @@ -71,6 +72,8 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { private Interpolator mLinearOutSlowInInterpolator; private Interpolator mFastOutLinearInInterpolator; private DisappearAnimationListener mDisappearAnimationListener; + private static final int[] DISABLE_STATE_SET = {-android.R.attr.state_enabled}; + private static final int[] ENABLE_STATE_SET = {android.R.attr.state_enabled}; public KeyguardPasswordView(Context context) { this(context, null); @@ -148,7 +151,10 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { @Override protected void setPasswordEntryEnabled(boolean enabled) { - mPasswordEntry.setEnabled(enabled); + int color = mPasswordEntry.getTextColors().getColorForState( + enabled ? ENABLE_STATE_SET : DISABLE_STATE_SET, 0); + mPasswordEntry.setBackgroundTintList(ColorStateList.valueOf(color)); + mPasswordEntry.setCursorVisible(enabled); } @Override