diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java index 2ff7266baecf9..a4b6958498c8e 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java @@ -310,7 +310,9 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout @Override public void showMessage(CharSequence message, ColorStateList colorState) { - mSecurityMessageDisplay.setNextMessageColor(colorState); + if (colorState != null) { + mSecurityMessageDisplay.setNextMessageColor(colorState); + } mSecurityMessageDisplay.setMessage(message); } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java index 0e91e4109ec0c..f3baf8d3fd991 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java @@ -438,7 +438,9 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit @Override public void showMessage(CharSequence message, ColorStateList colorState) { - mSecurityMessageDisplay.setNextMessageColor(colorState); + if (colorState != null) { + mSecurityMessageDisplay.setNextMessageColor(colorState); + } mSecurityMessageDisplay.setMessage(message); } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 0914fb8330beb..72592325c511f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -229,8 +229,10 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe } if (action == MotionEvent.ACTION_UP) { if (-getTranslationY() > TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, - MIN_DRAG_SIZE, getResources().getDisplayMetrics())) { + MIN_DRAG_SIZE, getResources().getDisplayMetrics()) + && !mUpdateMonitor.isFaceDetectionRunning()) { mUpdateMonitor.requestFaceAuth(); + showMessage(null, null); } } return true; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index ea8565e8d301d..21b9ad9485d71 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -168,6 +168,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { */ private static final int BIOMETRIC_STATE_CANCELLING_RESTARTING = 3; + private static final int BIOMETRIC_HELP_FINGERPRINT_NOT_RECOGNIZED = -1; + public static final int BIOMETRIC_HELP_FACE_NOT_RECOGNIZED = -2; + private static final int DEFAULT_CHARGING_VOLTAGE_MICRO_VOLT = 5000000; private static final ComponentName FALLBACK_HOME_COMPONENT = new ComponentName( @@ -570,7 +573,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { cb.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); } } - handleFingerprintHelp(-1, mContext.getString(R.string.kg_fingerprint_not_recognized)); + handleFingerprintHelp(BIOMETRIC_HELP_FINGERPRINT_NOT_RECOGNIZED, + mContext.getString(R.string.kg_fingerprint_not_recognized)); } private void handleFingerprintAcquired(int acquireInfo) { @@ -722,7 +726,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { cb.onBiometricAuthFailed(BiometricSourceType.FACE); } } - handleFaceHelp(-1, mContext.getString(R.string.kg_face_not_recognized)); + handleFaceHelp(BIOMETRIC_HELP_FACE_NOT_RECOGNIZED, + mContext.getString(R.string.kg_face_not_recognized)); } private void handleFaceAcquired(int acquireInfo) { @@ -803,6 +808,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { getCurrentUser()); } + // The face timeout message is not very actionable, let's ask the user to + // manually retry. + if (msgId == FaceManager.FACE_ERROR_TIMEOUT) { + errString = mContext.getString(R.string.keyguard_unlock); + } for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index fd76a79eab2ef..25bde3bbe2faa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -78,6 +78,7 @@ public class KeyguardIndicationController implements StateListener, private static final int MSG_HIDE_TRANSIENT = 1; private static final int MSG_CLEAR_BIOMETRIC_MSG = 2; + private static final int MSG_SWIPE_UP_TO_UNLOCK = 3; private static final long TRANSIENT_BIOMETRIC_ERROR_TIMEOUT = 1300; private final Context mContext; @@ -318,6 +319,7 @@ public class KeyguardIndicationController implements StateListener, mTransientIndication = transientIndication; mTransientTextColorState = textColorState; mHandler.removeMessages(MSG_HIDE_TRANSIENT); + mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK); if (mDozing && !TextUtils.isEmpty(mTransientIndication)) { // Make sure this doesn't get stuck and burns in. Acquire wakelock until its cleared. mWakeLock.setAcquired(true); @@ -536,10 +538,26 @@ public class KeyguardIndicationController implements StateListener, hideTransientIndication(); } else if (msg.what == MSG_CLEAR_BIOMETRIC_MSG) { mLockIcon.setTransientBiometricsError(false); + } else if (msg.what == MSG_SWIPE_UP_TO_UNLOCK) { + showSwipeUpToUnlock(); } } }; + private void showSwipeUpToUnlock() { + if (mDozing) { + return; + } + + String message = mContext.getString(R.string.keyguard_unlock); + if (mStatusBarKeyguardViewManager.isBouncerShowing()) { + mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState); + } else if (mKeyguardUpdateMonitor.isScreenOn()) { + showTransientIndication(message); + hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS); + } + } + public void setDozing(boolean dozing) { if (mDozing == dozing) { return; @@ -620,12 +638,20 @@ public class KeyguardIndicationController implements StateListener, return; } animatePadlockError(); + boolean showSwipeToUnlock = + msgId == KeyguardUpdateMonitor.BIOMETRIC_HELP_FACE_NOT_RECOGNIZED; if (mStatusBarKeyguardViewManager.isBouncerShowing()) { mStatusBarKeyguardViewManager.showBouncerMessage(helpString, mInitialTextColorState); } else if (updateMonitor.isScreenOn()) { showTransientIndication(helpString); - hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); + if (!showSwipeToUnlock) { + hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); + } + } + if (showSwipeToUnlock) { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SWIPE_UP_TO_UNLOCK), + TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); } }