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

Commit 9a3caf39 authored by Jim Miller's avatar Jim Miller
Browse files

Fix 5636798: clear PIN/PUK fields when device sleeps or user cancels

This bug is the result of onPause()/onResume() not being called properly
when we have both lock and unlock screens present, which is true for the SIM
and PUK unlock cases.

The fix is to invoke onPause() and onResume() on both of them if they exist.

Verified the rest of the code correctly handles having both.

Also, when the user cancels, we now clear the fields.

Change-Id: If7fbd31df7eab9e3d60656d50d2392607a4bf471
parent 34a62348
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -558,9 +558,12 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
        mScreenOn = false;
        mForgotPattern = false;
        mHasOverlay = mUpdateMonitor.getPhoneState() != TelephonyManager.CALL_STATE_IDLE;
        if (mMode == Mode.LockScreen) {

        // Emulate activity life-cycle for both lock and unlock screen.
        if (mLockScreen != null) {
            ((KeyguardScreen) mLockScreen).onPause();
        } else {
        }
        if (mUnlockScreen != null) {
            ((KeyguardScreen) mUnlockScreen).onPause();
        }

@@ -651,9 +654,11 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler

    @Override
    public void show() {
        if (mMode == Mode.LockScreen) {
        // Emulate activity life-cycle for both lock and unlock screen.
        if (mLockScreen != null) {
            ((KeyguardScreen) mLockScreen).onResume();
        } else {
        }
        if (mUnlockScreen != null) {
            ((KeyguardScreen) mUnlockScreen).onResume();
        }

+3 −0
Original line number Diff line number Diff line
@@ -379,6 +379,9 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,

        public void onClick(View v) {
            if (v == mCancelButton) {
                // clear the PIN/PUK entry fields if the user cancels
                mPinText.setText("");
                mPukText.setText("");
                mCallback.goToLockScreen();
                return;
            }
+1 −0
Original line number Diff line number Diff line
@@ -355,6 +355,7 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie

        public void onClick(View v) {
            if (v == mCancelButton) {
                mPinText.setText(""); // clear the PIN entry field if the user cancels
                mCallback.goToLockScreen();
                return;
            }