Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -198,7 +198,9 @@ public class KeyguardIndicationController { public void onScreenTurnedOn() { public void onScreenTurnedOn() { mHandler.removeMessages(MSG_RESET_ERROR_MESSAGE_ON_SCREEN_ON); mHandler.removeMessages(MSG_RESET_ERROR_MESSAGE_ON_SCREEN_ON); if (mBiometricErrorMessageToShowOnScreenOn != null) { if (mBiometricErrorMessageToShowOnScreenOn != null) { showBiometricMessage(mBiometricErrorMessageToShowOnScreenOn); String followUpMessage = mFaceLockedOutThisAuthSession ? faceLockedOutFollowupMessage() : null; showBiometricMessage(mBiometricErrorMessageToShowOnScreenOn, followUpMessage); // 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 hideBiometricMessageDelayed(DEFAULT_HIDE_DELAY_MS); hideBiometricMessageDelayed(DEFAULT_HIDE_DELAY_MS); mBiometricErrorMessageToShowOnScreenOn = null; mBiometricErrorMessageToShowOnScreenOn = null; Loading Loading @@ -1263,9 +1265,7 @@ public class KeyguardIndicationController { } } private void handleFaceLockoutError(String errString) { private void handleFaceLockoutError(String errString) { int followupMsgId = canUnlockWithFingerprint() ? R.string.keyguard_suggest_fingerprint String followupMessage = faceLockedOutFollowupMessage(); : R.string.keyguard_unlock; String followupMessage = mContext.getString(followupMsgId); // Lockout error can happen multiple times in a session because we trigger face auth // Lockout error can happen multiple times in a session because we trigger face auth // even when it is locked out so that the user is aware that face unlock would have // even when it is locked out so that the user is aware that face unlock would have // triggered but didn't because it is locked out. // triggered but didn't because it is locked out. Loading @@ -1283,6 +1283,12 @@ public class KeyguardIndicationController { } } } } private String faceLockedOutFollowupMessage() { int followupMsgId = canUnlockWithFingerprint() ? R.string.keyguard_suggest_fingerprint : R.string.keyguard_unlock; return mContext.getString(followupMsgId); } private static boolean isLockoutError(int msgId) { private static boolean isLockoutError(int msgId) { return msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT return msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT || msgId == FaceManager.FACE_ERROR_LOCKOUT; || msgId == FaceManager.FACE_ERROR_LOCKOUT; Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +39 −0 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,7 @@ import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewCont import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_OFF; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_OFF; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_ON; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_ON; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_TURNING_ON; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -1503,6 +1504,44 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mContext.getString(R.string.keyguard_face_unlock_unavailable)); mContext.getString(R.string.keyguard_face_unlock_unavailable)); } } @Test public void onBiometricError_screenIsTurningOn_faceLockedOutFpIsNotAvailable_showsMessage() { createController(); screenIsTurningOn(); fingerprintUnlockIsNotPossible(); onFaceLockoutError("lockout error"); verifyNoMoreInteractions(mRotateTextViewController); mScreenObserver.onScreenTurnedOn(); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE, "lockout error"); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, mContext.getString(R.string.keyguard_unlock)); } @Test public void onBiometricError_screenIsTurningOn_faceLockedOutFpIsAvailable_showsMessage() { createController(); screenIsTurningOn(); fingerprintUnlockIsPossible(); onFaceLockoutError("lockout error"); verifyNoMoreInteractions(mRotateTextViewController); mScreenObserver.onScreenTurnedOn(); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE, "lockout error"); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, mContext.getString(R.string.keyguard_suggest_fingerprint)); } private void screenIsTurningOn() { when(mScreenLifecycle.getScreenState()).thenReturn(SCREEN_TURNING_ON); } private void sendUpdateDisclosureBroadcast() { private void sendUpdateDisclosureBroadcast() { mBroadcastReceiver.onReceive(mContext, new Intent()); mBroadcastReceiver.onReceive(mContext, new Intent()); } } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -198,7 +198,9 @@ public class KeyguardIndicationController { public void onScreenTurnedOn() { public void onScreenTurnedOn() { mHandler.removeMessages(MSG_RESET_ERROR_MESSAGE_ON_SCREEN_ON); mHandler.removeMessages(MSG_RESET_ERROR_MESSAGE_ON_SCREEN_ON); if (mBiometricErrorMessageToShowOnScreenOn != null) { if (mBiometricErrorMessageToShowOnScreenOn != null) { showBiometricMessage(mBiometricErrorMessageToShowOnScreenOn); String followUpMessage = mFaceLockedOutThisAuthSession ? faceLockedOutFollowupMessage() : null; showBiometricMessage(mBiometricErrorMessageToShowOnScreenOn, followUpMessage); // 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 hideBiometricMessageDelayed(DEFAULT_HIDE_DELAY_MS); hideBiometricMessageDelayed(DEFAULT_HIDE_DELAY_MS); mBiometricErrorMessageToShowOnScreenOn = null; mBiometricErrorMessageToShowOnScreenOn = null; Loading Loading @@ -1263,9 +1265,7 @@ public class KeyguardIndicationController { } } private void handleFaceLockoutError(String errString) { private void handleFaceLockoutError(String errString) { int followupMsgId = canUnlockWithFingerprint() ? R.string.keyguard_suggest_fingerprint String followupMessage = faceLockedOutFollowupMessage(); : R.string.keyguard_unlock; String followupMessage = mContext.getString(followupMsgId); // Lockout error can happen multiple times in a session because we trigger face auth // Lockout error can happen multiple times in a session because we trigger face auth // even when it is locked out so that the user is aware that face unlock would have // even when it is locked out so that the user is aware that face unlock would have // triggered but didn't because it is locked out. // triggered but didn't because it is locked out. Loading @@ -1283,6 +1283,12 @@ public class KeyguardIndicationController { } } } } private String faceLockedOutFollowupMessage() { int followupMsgId = canUnlockWithFingerprint() ? R.string.keyguard_suggest_fingerprint : R.string.keyguard_unlock; return mContext.getString(followupMsgId); } private static boolean isLockoutError(int msgId) { private static boolean isLockoutError(int msgId) { return msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT return msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT || msgId == FaceManager.FACE_ERROR_LOCKOUT; || msgId == FaceManager.FACE_ERROR_LOCKOUT; Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +39 −0 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,7 @@ import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewCont import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_OFF; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_OFF; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_ON; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_ON; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_TURNING_ON; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -1503,6 +1504,44 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mContext.getString(R.string.keyguard_face_unlock_unavailable)); mContext.getString(R.string.keyguard_face_unlock_unavailable)); } } @Test public void onBiometricError_screenIsTurningOn_faceLockedOutFpIsNotAvailable_showsMessage() { createController(); screenIsTurningOn(); fingerprintUnlockIsNotPossible(); onFaceLockoutError("lockout error"); verifyNoMoreInteractions(mRotateTextViewController); mScreenObserver.onScreenTurnedOn(); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE, "lockout error"); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, mContext.getString(R.string.keyguard_unlock)); } @Test public void onBiometricError_screenIsTurningOn_faceLockedOutFpIsAvailable_showsMessage() { createController(); screenIsTurningOn(); fingerprintUnlockIsPossible(); onFaceLockoutError("lockout error"); verifyNoMoreInteractions(mRotateTextViewController); mScreenObserver.onScreenTurnedOn(); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE, "lockout error"); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, mContext.getString(R.string.keyguard_suggest_fingerprint)); } private void screenIsTurningOn() { when(mScreenLifecycle.getScreenState()).thenReturn(SCREEN_TURNING_ON); } private void sendUpdateDisclosureBroadcast() { private void sendUpdateDisclosureBroadcast() { mBroadcastReceiver.onReceive(mContext, new Intent()); mBroadcastReceiver.onReceive(mContext, new Intent()); } } Loading