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

Commit 69082a29 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Require strong authentication after a timeout" into mnc-dr-dev

parents 9512a857 25b4d4b2
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -316,6 +316,15 @@
    <!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_restart_password">Password required when you restart device.</string>

    <!-- An explanation text that the pattern needs to be solved since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_timeout_pattern">Pattern required for additional security.</string>

    <!-- An explanation text that the pin needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_timeout_pin">PIN required for additional security.</string>

    <!-- An explanation text that the password needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_timeout_password">Password required for additional security.</string>

    <!-- An explanation text that the pattern needs to be solved since profiles have just been switched. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_switch_profiles_pattern">Pattern required when you switch profiles.</string>

+9 −31
Original line number Diff line number Diff line
@@ -163,8 +163,9 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
     * Show a string explaining why the security view needs to be solved.
     *
     * @param reason a flag indicating which string should be shown, see
     *               {@link KeyguardSecurityView#PROMPT_REASON_NONE}
     *               and {@link KeyguardSecurityView#PROMPT_REASON_RESTART}
     *               {@link KeyguardSecurityView#PROMPT_REASON_NONE},
     *               {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and
     *               {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}.
     */
    public void showPromptReason(int reason) {
        mSecurityContainer.showPromptReason(reason);
@@ -213,9 +214,12 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
    /**
     * Authentication has happened and it's time to dismiss keyguard. This function
     * should clean up and inform KeyguardViewMediator.
     *
     * @param strongAuth whether the user has authenticated with strong authentication like
     *                   pattern, password or PIN but not by trust agents or fingerprint
     */
    @Override
    public void finish() {
    public void finish(boolean strongAuth) {
        // If there's a pending runnable because the user interacted with a widget
        // and we're leaving keyguard, then run it.
        boolean deferKeyguardDone = false;
@@ -226,9 +230,9 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
        }
        if (mViewMediatorCallback != null) {
            if (deferKeyguardDone) {
                mViewMediatorCallback.keyguardDonePending();
                mViewMediatorCallback.keyguardDonePending(strongAuth);
            } else {
                mViewMediatorCallback.keyguardDone(true);
                mViewMediatorCallback.keyguardDone(strongAuth);
            }
        }
    }
@@ -284,32 +288,6 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
        }
    }

    /**
     * Verify that the user can get past the keyguard securely.  This is called,
     * for example, when the phone disables the keyguard but then wants to launch
     * something else that requires secure access.
     *
     * The result will be propogated back via {@link KeyguardViewCallback#keyguardDone(boolean)}
     */
    public void verifyUnlock() {
        SecurityMode securityMode = mSecurityContainer.getSecurityMode();
        if (securityMode == KeyguardSecurityModel.SecurityMode.None) {
            if (mViewMediatorCallback != null) {
                mViewMediatorCallback.keyguardDone(true);
            }
        } else if (securityMode != KeyguardSecurityModel.SecurityMode.Pattern
                && securityMode != KeyguardSecurityModel.SecurityMode.PIN
                && securityMode != KeyguardSecurityModel.SecurityMode.Password) {
            // can only verify unlock when in pattern/password mode
            if (mViewMediatorCallback != null) {
                mViewMediatorCallback.keyguardDone(false);
            }
        } else {
            // otherwise, go to the unlock screen, see if they can verify it
            mSecurityContainer.verifyUnlock();
        }
    }

    /**
     * Called before this view is being removed.
     */
+2 −0
Original line number Diff line number Diff line
@@ -115,6 +115,8 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
        switch (reason) {
            case PROMPT_REASON_RESTART:
                return R.string.kg_prompt_reason_restart_password;
            case PROMPT_REASON_TIMEOUT:
                return R.string.kg_prompt_reason_timeout_password;
            default:
                return 0;
        }
+5 −0
Original line number Diff line number Diff line
@@ -332,7 +332,12 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
                mSecurityMessageDisplay.setMessage(R.string.kg_prompt_reason_restart_pattern,
                        true /* important */);
                break;
            case PROMPT_REASON_TIMEOUT:
                mSecurityMessageDisplay.setMessage(R.string.kg_prompt_reason_timeout_pattern,
                        true /* important */);
                break;
            default:
                break;
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
        switch (reason) {
            case PROMPT_REASON_RESTART:
                return R.string.kg_prompt_reason_restart_pin;
            case PROMPT_REASON_TIMEOUT:
                return R.string.kg_prompt_reason_timeout_pin;
            default:
                return 0;
        }
Loading