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

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

Merge "Fix 3409550: Fix crash caused when max pattern attempts met."

parents 17cc1a1a 79628c66
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -361,10 +361,12 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient

    /** {@inheritDoc} */
    public void cleanUp() {
        if (DEBUG) Log.v(TAG, "Cleanup() called on " + this);
        mUpdateMonitor.removeCallback(this);
        mLockPatternUtils = null;
        mUpdateMonitor = null;
        mCallback = null;
        mLockPatternView.setOnPatternListener(null);
    }

    @Override
@@ -406,6 +408,7 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
                mCallback.keyguardDone(true);
                mCallback.reportSuccessfulUnlockAttempt();
            } else {
                boolean reportFailedAttempt = false;
                if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) {
                    mCallback.pokeWakelock(UNLOCK_PATTERN_WAKE_INTERVAL_MS);
                }
@@ -413,9 +416,10 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
                if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) {
                    mTotalFailedPatternAttempts++;
                    mFailedPatternAttemptsSinceLastTimeout++;
                    mCallback.reportFailedUnlockAttempt();
                    reportFailedAttempt = true;
                }
                if (mFailedPatternAttemptsSinceLastTimeout >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
                if (mFailedPatternAttemptsSinceLastTimeout
                        >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
                    long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
                    handleAttemptLockout(deadline);
                } else {
@@ -427,6 +431,12 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
                            mCancelPatternRunnable,
                            PATTERN_CLEAR_TIMEOUT_MS);
                }

                // Because the following can result in cleanUp() being called on this screen,
                // member variables reset in cleanUp() shouldn't be accessed after this call.
                if (reportFailedAttempt) {
                    mCallback.reportFailedUnlockAttempt();
                }
            }
        }
    }