Merge "KeyguardIndication text updates" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-06-17 12:48:23 +00:00
committed by Android (Google) Code Review
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 if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT
|| msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) { || msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) {
mFingerprintLockedOut = true; mFingerprintLockedOut = true;
if (isUdfpsEnrolled()) {
updateFingerprintListeningState();
}
} }
for (int i = 0; i < mCallbacks.size(); i++) { for (int i = 0; i < mCallbacks.size(); i++) {
@@ -2115,7 +2118,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|| (!getUserCanSkipBouncer(getCurrentUser()) || (!getUserCanSkipBouncer(getCurrentUser())
&& !isEncryptedOrLockdown(getCurrentUser()) && !isEncryptedOrLockdown(getCurrentUser())
&& !userNeedsStrongAuth() && !userNeedsStrongAuth()
&& userDoesNotHaveTrust); && userDoesNotHaveTrust
&& !mFingerprintLockedOut);
return shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState return shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState
&& shouldListenUdfpsState; && shouldListenUdfpsState;
} }
@@ -3244,6 +3248,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags)); pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
pw.println(" trustManaged=" + getUserTrustIsManaged(userId)); pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
pw.println(" udfpsEnrolled=" + isUdfpsEnrolled()); pw.println(" udfpsEnrolled=" + isUdfpsEnrolled());
pw.println(" mFingerprintLockedOut=" + mFingerprintLockedOut);
pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId)); pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId));
if (isUdfpsEnrolled()) { if (isUdfpsEnrolled()) {
pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true)); pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true));

View File

@@ -20,7 +20,6 @@ import android.annotation.Nullable;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Color; import android.graphics.Color;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
@@ -202,10 +201,7 @@ public class KeyguardIndicationRotateTextViewController extends
mCurrIndicationType = type; mCurrIndicationType = type;
mIndicationQueue.removeIf(x -> x == type); mIndicationQueue.removeIf(x -> x == type);
if (mCurrIndicationType == INDICATION_TYPE_NONE) { if (mCurrIndicationType != INDICATION_TYPE_NONE) {
mView.setVisibility(View.GONE);
} else {
mView.setVisibility(View.VISIBLE);
mIndicationQueue.add(type); // re-add to show later 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_OWNER_INFO = 0;
public static final int INDICATION_TYPE_DISCLOSURE = 1; public static final int INDICATION_TYPE_DISCLOSURE = 1;
public static final int INDICATION_TYPE_LOGOUT = 2; 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 final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private ViewGroup mIndicationArea; private ViewGroup mIndicationArea;
private KeyguardIndicationTextView mTopIndicationView; private KeyguardIndicationTextView mTopIndicationView;
private KeyguardIndicationTextView mLockScreenIndicationView;
private final IBatteryStats mBatteryInfo; private final IBatteryStats mBatteryInfo;
private final SettableWakeLock mWakeLock; private final SettableWakeLock mWakeLock;
private final DockManager mDockManager; private final DockManager mDockManager;
@@ -208,15 +209,19 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
mKeyguardUpdateMonitor.registerCallback(mTickReceiver); mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
mStatusBarStateController.addCallback(mStatusBarStateListener); mStatusBarStateController.addCallback(mStatusBarStateListener);
mKeyguardStateController.addCallback(this); mKeyguardStateController.addCallback(this);
mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing());
} }
public void setIndicationArea(ViewGroup indicationArea) { public void setIndicationArea(ViewGroup indicationArea) {
mIndicationArea = indicationArea; mIndicationArea = indicationArea;
mTopIndicationView = indicationArea.findViewById(R.id.keyguard_indication_text); mTopIndicationView = indicationArea.findViewById(R.id.keyguard_indication_text);
mLockScreenIndicationView = indicationArea.findViewById(
R.id.keyguard_indication_text_bottom);
mInitialTextColorState = mTopIndicationView != null mInitialTextColorState = mTopIndicationView != null
? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE); ? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
mRotateTextViewController = new KeyguardIndicationRotateTextViewController( mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
indicationArea.findViewById(R.id.keyguard_indication_text_bottom), mLockScreenIndicationView,
mExecutor, mExecutor,
mStatusBarStateController); mStatusBarStateController);
updateIndication(false /* animate */); updateIndication(false /* animate */);
@@ -630,6 +635,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
// should be shown based on user or device state // should be shown based on user or device state
// AoD // AoD
if (mDozing) { if (mDozing) {
mLockScreenIndicationView.setVisibility(View.GONE);
mTopIndicationView.setVisibility(VISIBLE); mTopIndicationView.setVisibility(VISIBLE);
// When dozing we ignore any text color and use white instead, because // When dozing we ignore any text color and use white instead, because
// colors can be hard to read in low brightness. // colors can be hard to read in low brightness.
@@ -659,6 +665,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
// LOCK SCREEN // LOCK SCREEN
mTopIndicationView.setVisibility(GONE); mTopIndicationView.setVisibility(GONE);
mTopIndicationView.setText(null);
mLockScreenIndicationView.setVisibility(View.VISIBLE);
updateIndications(animate, KeyguardUpdateMonitor.getCurrentUser()); updateIndications(animate, KeyguardUpdateMonitor.getCurrentUser());
} }
@@ -914,7 +922,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
} else if (mStatusBarKeyguardViewManager.isBouncerShowing()) { } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState); mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState);
} else if (mKeyguardUpdateMonitor.isScreenOn()) { } 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 // We want to keep this message around in case the screen was off
hideTransientIndicationDelayed(HIDE_DELAY_MS); hideTransientIndicationDelayed(HIDE_DELAY_MS);
} else { } else {
@@ -1032,9 +1041,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
if (mHideTransientMessageOnScreenOff && mDozing) { if (mHideTransientMessageOnScreenOff && mDozing) {
hideTransientIndication(); 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"). * A view to show hints on Keyguard ("Swipe up to unlock", "Tap again to open").
*/ */
public class KeyguardIndicationTextView extends TextView { 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 long mNextAnimationTime = 0;
private boolean mAnimationsEnabled = true; private boolean mAnimationsEnabled = true;
private LinkedList<CharSequence> mMessages = new LinkedList<>(); private LinkedList<CharSequence> mMessages = new LinkedList<>();

View File

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