Merge changes I5fa8e022,I519fcb99,Ide0e632d into udc-qpr-dev

* changes:
  Do not setenabled to false for edittext.
  Do not finish lockscreen for multiple sims.
  Refine password disappear animation.
This commit is contained in:
Aaron Liu
2023-08-08 15:59:00 +00:00
committed by Android (Google) Code Review
3 changed files with 38 additions and 6 deletions

View File

@@ -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
@@ -189,17 +195,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

View File

@@ -825,7 +825,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
boolean isLockscreenDisabled = mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser());
if (securityMode == SecurityMode.None || isLockscreenDisabled) {
if (securityMode == SecurityMode.None) {
finish = isLockscreenDisabled;
eventSubtype = BOUNCER_DISMISS_SIM;
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_SIM;

View File

@@ -490,6 +490,30 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
}
@Test
fun showNextSecurityScreenOrFinish_SimPinToAnotherSimPin_None() {
// GIVEN the current security method is SimPin
whenever(keyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false)
whenever(keyguardUpdateMonitor.getUserUnlockedWithBiometric(TARGET_USER_ID))
.thenReturn(false)
underTest.showSecurityScreen(SecurityMode.SimPin)
// WHEN a request is made from the SimPin screens to show the next security method
whenever(keyguardSecurityModel.getSecurityMode(TARGET_USER_ID))
.thenReturn(SecurityMode.SimPin)
whenever(lockPatternUtils.isLockScreenDisabled(anyInt())).thenReturn(true)
underTest.showNextSecurityScreenOrFinish(
/* authenticated= */ true,
TARGET_USER_ID,
/* bypassSecondaryLockScreen= */ true,
SecurityMode.SimPin
)
// THEN the next security method of None will dismiss keyguard.
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
}
@Test
fun onSwipeUp_whenFaceDetectionIsNotRunning_initiatesFaceAuth() {
val registeredSwipeListener = registeredSwipeListener