Loading packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +5 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey private boolean mDismissing; protected AsyncTask<?, ?, ?> mPendingLockCheck; protected boolean mResumed; protected boolean mLockedOut; private final KeyDownListener mKeyDownListener = (keyCode, keyEvent) -> { // Fingerprint sensor sends a KeyEvent.KEYCODE_UNKNOWN. Loading Loading @@ -137,6 +138,8 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey // Prevent user from using the PIN/Password entry until scheduled deadline. protected void handleAttemptLockout(long elapsedRealtimeDeadline) { mView.setPasswordEntryEnabled(false); mView.setPasswordEntryInputEnabled(false); mLockedOut = true; long elapsedRealtime = SystemClock.elapsedRealtime(); long secondsInFuture = (long) Math.ceil( (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0); Loading @@ -158,6 +161,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey @Override public void onFinish() { mMessageAreaController.setMessage(""); mLockedOut = false; resetState(); } }.start(); Loading Loading @@ -193,6 +197,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey protected void verifyPasswordAndUnlock() { if (mDismissing) return; // already verified but haven't been dismissed; don't do it again. if (mLockedOut) return; final LockscreenCredential password = mView.getEnteredCredential(); mView.setPasswordEntryInputEnabled(false); Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import android.os.SystemClock; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; import android.view.KeyEvent; Loading Loading @@ -183,4 +184,15 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase { mKeyguardAbsKeyInputViewController.onResume(KeyguardSecurityView.VIEW_REVEALED); verify(mLockPatternUtils).getLockoutAttemptDeadline(anyInt()); } @Test public void testLockedOut_verifyPasswordAndUnlock_doesNotEnableViewInput() { mKeyguardAbsKeyInputViewController.handleAttemptLockout( SystemClock.elapsedRealtime() + 1000); mKeyguardAbsKeyInputViewController.verifyPasswordAndUnlock(); verify(mAbsKeyInputView).setPasswordEntryInputEnabled(false); verify(mAbsKeyInputView).setPasswordEntryEnabled(false); verify(mAbsKeyInputView, never()).setPasswordEntryInputEnabled(true); verify(mAbsKeyInputView, never()).setPasswordEntryEnabled(true); } } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +5 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey private boolean mDismissing; protected AsyncTask<?, ?, ?> mPendingLockCheck; protected boolean mResumed; protected boolean mLockedOut; private final KeyDownListener mKeyDownListener = (keyCode, keyEvent) -> { // Fingerprint sensor sends a KeyEvent.KEYCODE_UNKNOWN. Loading Loading @@ -137,6 +138,8 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey // Prevent user from using the PIN/Password entry until scheduled deadline. protected void handleAttemptLockout(long elapsedRealtimeDeadline) { mView.setPasswordEntryEnabled(false); mView.setPasswordEntryInputEnabled(false); mLockedOut = true; long elapsedRealtime = SystemClock.elapsedRealtime(); long secondsInFuture = (long) Math.ceil( (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0); Loading @@ -158,6 +161,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey @Override public void onFinish() { mMessageAreaController.setMessage(""); mLockedOut = false; resetState(); } }.start(); Loading Loading @@ -193,6 +197,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey protected void verifyPasswordAndUnlock() { if (mDismissing) return; // already verified but haven't been dismissed; don't do it again. if (mLockedOut) return; final LockscreenCredential password = mView.getEnteredCredential(); mView.setPasswordEntryInputEnabled(false); Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import android.os.SystemClock; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; import android.view.KeyEvent; Loading Loading @@ -183,4 +184,15 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase { mKeyguardAbsKeyInputViewController.onResume(KeyguardSecurityView.VIEW_REVEALED); verify(mLockPatternUtils).getLockoutAttemptDeadline(anyInt()); } @Test public void testLockedOut_verifyPasswordAndUnlock_doesNotEnableViewInput() { mKeyguardAbsKeyInputViewController.handleAttemptLockout( SystemClock.elapsedRealtime() + 1000); mKeyguardAbsKeyInputViewController.verifyPasswordAndUnlock(); verify(mAbsKeyInputView).setPasswordEntryInputEnabled(false); verify(mAbsKeyInputView).setPasswordEntryEnabled(false); verify(mAbsKeyInputView, never()).setPasswordEntryInputEnabled(true); verify(mAbsKeyInputView, never()).setPasswordEntryEnabled(true); } }