Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e143e58c authored by Jim Miller's avatar Jim Miller Committed by Android (Google) Code Review
Browse files

Merge "Move majority of security-related logic from KeyguardHostView to KeyguardSecurityContainer."

parents c0877962 7751ff6c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
        int currentUserId = mLockPatternUtils.getCurrentUser();
        if (authenticatedUserId == currentUserId) {
            if (DEBUG) Log.d(TAG, "Unlocking for user " + authenticatedUserId);
            mKeyguardScreenCallback.reportSuccessfulUnlockAttempt();
            mKeyguardScreenCallback.reportUnlockAttempt(true);
            mKeyguardScreenCallback.dismiss(true);
        } else {
            Log.d(TAG, "Ignoring unlock for authenticated user (" + authenticatedUserId +
@@ -335,7 +335,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
        // next time the user visits keyguard.
        KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);

        mKeyguardScreenCallback.reportFailedUnlockAttempt();
        mKeyguardScreenCallback.reportUnlockAttempt(false);
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -154,14 +154,14 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
    protected void verifyPasswordAndUnlock() {
        String entry = mPasswordEntry.getText().toString();
        if (mLockPatternUtils.checkPassword(entry)) {
            mCallback.reportSuccessfulUnlockAttempt();
            mCallback.reportUnlockAttempt(true);
            mCallback.dismiss(true);
        } else if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT ) {
            // to avoid accidental lockout, only count attempts that are long enough to be a
            // real password. This may require some tweaking.
            mCallback.reportFailedUnlockAttempt();
            if (0 == (mCallback.getFailedAttempts()
                    % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
            mCallback.reportUnlockAttempt(false);
            int attempts = KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts();
            if (0 == (attempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
                long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
                handleAttemptLockout(deadline);
            }
+2 −2
Original line number Diff line number Diff line
@@ -177,14 +177,14 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    mContext.startActivityAsUser(intent,
                            new UserHandle(mLockPatternUtils.getCurrentUser()));
                    mCallback.reportSuccessfulUnlockAttempt();
                    mCallback.reportUnlockAttempt(true);

                    // dismiss keyguard
                    mCallback.dismiss(true);
                } else {
                    mSecurityMessageDisplay.setMessage(R.string.kg_login_invalid_input, true);
                    mPassword.setText("");
                    mCallback.reportFailedUnlockAttempt();
                    mCallback.reportUnlockAttempt(false);
                }
            }
        });
+6 −5
Original line number Diff line number Diff line
@@ -53,10 +53,12 @@ public abstract class KeyguardActivityLauncher {

    abstract Context getContext();

    abstract KeyguardSecurityCallback getCallback();

    abstract LockPatternUtils getLockPatternUtils();

    abstract void setOnDismissAction(OnDismissAction action);

    abstract void requestDismissKeyguard();

    public static class CameraWidgetInfo {
        public String contextPackage;
        public int layoutId;
@@ -190,8 +192,7 @@ public abstract class KeyguardActivityLauncher {
        } else {
            // Create a runnable to start the activity and ask the user to enter their
            // credentials.
            KeyguardSecurityCallback callback = getCallback();
            callback.setOnDismissAction(new OnDismissAction() {
            setOnDismissAction(new OnDismissAction() {
                @Override
                public boolean onDismiss() {
                    dismissKeyguardOnNextActivity();
@@ -199,7 +200,7 @@ public abstract class KeyguardActivityLauncher {
                    return true;
                }
            });
            callback.dismiss(false);
            requestDismissKeyguard();
        }
    }

+131 −506

File changed.

Preview size limit exceeded, changes collapsed.

Loading