KeyguardIndication text updates

- update show/hide logic of text areas on AOD and lock screen so that
the transition isn't as jumpy
- increase minimum time to show a message from 600 to 1500 (now there
are animations playing that obscure the text)
- make auth errors show in red
- update fingerprint listening state on lockout changes (still a bug
where resetLockout isn't called for udfps: b/189802462)

Test: manual
Fixes: 187675377
Bug: 190459902
Bug: 189802462
Fixes: 189072438
Change-Id: I5862ce8d0e139f0d045d77b6a7b9797aeb573186
This commit is contained in:
Beverly
2021-06-15 19:49:03 -04:00
parent f34c9ede73
commit 51a565fa9e
5 changed files with 25 additions and 17 deletions

View File

@@ -775,6 +775,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT
|| msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) {
mFingerprintLockedOut = true;
if (isUdfpsEnrolled()) {
updateFingerprintListeningState();
}
}
for (int i = 0; i < mCallbacks.size(); i++) {
@@ -2115,7 +2118,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|| (!getUserCanSkipBouncer(getCurrentUser())
&& !isEncryptedOrLockdown(getCurrentUser())
&& !userNeedsStrongAuth()
&& userDoesNotHaveTrust);
&& userDoesNotHaveTrust
&& !mFingerprintLockedOut);
return shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState
&& shouldListenUdfpsState;
}
@@ -3244,6 +3248,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
pw.println(" udfpsEnrolled=" + isUdfpsEnrolled());
pw.println(" mFingerprintLockedOut=" + mFingerprintLockedOut);
pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId));
if (isUdfpsEnrolled()) {
pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true));

View File

@@ -20,7 +20,6 @@ import android.annotation.Nullable;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import androidx.annotation.IntDef;
@@ -202,10 +201,7 @@ public class KeyguardIndicationRotateTextViewController extends
mCurrIndicationType = type;
mIndicationQueue.removeIf(x -> x == type);
if (mCurrIndicationType == INDICATION_TYPE_NONE) {
mView.setVisibility(View.GONE);
} else {
mView.setVisibility(View.VISIBLE);
if (mCurrIndicationType != INDICATION_TYPE_NONE) {
mIndicationQueue.add(type); // re-add to show later
}
@@ -299,7 +295,7 @@ public class KeyguardIndicationRotateTextViewController extends
}
}
private static final int INDICATION_TYPE_NONE = -1;
static final int INDICATION_TYPE_NONE = -1;
public static final int INDICATION_TYPE_OWNER_INFO = 0;
public static final int INDICATION_TYPE_DISCLOSURE = 1;
public static final int INDICATION_TYPE_LOGOUT = 2;

View File

@@ -112,6 +112,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private ViewGroup mIndicationArea;
private KeyguardIndicationTextView mTopIndicationView;
private KeyguardIndicationTextView mLockScreenIndicationView;
private final IBatteryStats mBatteryInfo;
private final SettableWakeLock mWakeLock;
private final DockManager mDockManager;
@@ -208,17 +209,21 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
mStatusBarStateController.addCallback(mStatusBarStateListener);
mKeyguardStateController.addCallback(this);
mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing());
}
public void setIndicationArea(ViewGroup indicationArea) {
mIndicationArea = indicationArea;
mTopIndicationView = indicationArea.findViewById(R.id.keyguard_indication_text);
mLockScreenIndicationView = indicationArea.findViewById(
R.id.keyguard_indication_text_bottom);
mInitialTextColorState = mTopIndicationView != null
? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
indicationArea.findViewById(R.id.keyguard_indication_text_bottom),
mExecutor,
mStatusBarStateController);
mLockScreenIndicationView,
mExecutor,
mStatusBarStateController);
updateIndication(false /* animate */);
updateDisclosure();
if (mBroadcastReceiver == null) {
@@ -630,6 +635,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
// should be shown based on user or device state
// AoD
if (mDozing) {
mLockScreenIndicationView.setVisibility(View.GONE);
mTopIndicationView.setVisibility(VISIBLE);
// When dozing we ignore any text color and use white instead, because
// colors can be hard to read in low brightness.
@@ -659,6 +665,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
// LOCK SCREEN
mTopIndicationView.setVisibility(GONE);
mTopIndicationView.setText(null);
mLockScreenIndicationView.setVisibility(View.VISIBLE);
updateIndications(animate, KeyguardUpdateMonitor.getCurrentUser());
}
@@ -914,7 +922,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
} else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState);
} else if (mKeyguardUpdateMonitor.isScreenOn()) {
showTransientIndication(errString);
showTransientIndication(errString, /* isError */ true,
/* hideOnScreenOff */ true);
// We want to keep this message around in case the screen was off
hideTransientIndicationDelayed(HIDE_DELAY_MS);
} else {
@@ -1032,9 +1041,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
if (mHideTransientMessageOnScreenOff && mDozing) {
hideTransientIndication();
} else {
updateIndication(false);
}
updateIndication(false);
}
};
}

View File

@@ -38,7 +38,7 @@ import java.util.LinkedList;
* A view to show hints on Keyguard ("Swipe up to unlock", "Tap again to open").
*/
public class KeyguardIndicationTextView extends TextView {
private static final long MSG_DURATION_MILLIS = 600;
private static final long MSG_DURATION_MILLIS = 1500;
private long mNextAnimationTime = 0;
private boolean mAnimationsEnabled = true;
private LinkedList<CharSequence> mMessages = new LinkedList<>();

View File

@@ -34,7 +34,6 @@ import android.content.res.ColorStateList;
import android.graphics.Color;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.view.View;
import androidx.test.filters.SmallTest;
@@ -258,8 +257,8 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas
// WHEN the device is dozing
mStatusBarStateListener.onDozingChanged(true);
// THEN the view is GONE
verify(mView).setVisibility(View.GONE);
// THEN switch to INDICATION_TYPE_NONE
verify(mView).switchIndication(null);
}
@Test