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

Commit 1f8fb0f8 authored by Paul Lawrence's avatar Paul Lawrence
Browse files

Stop crash on repeated enters on virtual keyboard

Change https://googleplex-android-review.git.corp.google.com/#/c/742462/
removed the mDone since graying out the button seemed to remove the need
for this. However, you can also enter this command repeatedly from the
soft keyboard.

Put mDone back.

Bug: 23181625
Change-Id: I42e8ecb9824b17825778c9c113130506cc3a200b
parent 62fdd558
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -146,6 +146,10 @@ public class ChooseLockPassword extends SettingsActivity {
        private int mRequestedQuality = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
        private ChooseLockSettingsHelper mChooseLockSettingsHelper;
        private Stage mUiStage = Stage.Introduction;

        // True once we have confirmed new PIN/password to prevent virtual keyboard
        // re-entries of the same PIN
        private boolean mDone = false;
        private TextView mHeaderText;
        private String mFirstPin;
        private KeyboardView mKeyboardView;
@@ -302,6 +306,7 @@ public class ChooseLockPassword extends SettingsActivity {
                    mCurrentPassword = savedInstanceState.getString(KEY_CURRENT_PASSWORD);
                }
            }
            mDone = false;
            if (activity instanceof SettingsActivity) {
                final SettingsActivity sa = (SettingsActivity) activity;
                int id = mIsAlphaMode ? R.string.lockpassword_choose_your_password_header
@@ -509,6 +514,7 @@ public class ChooseLockPassword extends SettingsActivity {


        public void handleNext() {
            if (mDone) return;
            mChosenPassword = mPasswordEntry.getText().toString();
            if (TextUtils.isEmpty(mChosenPassword)) {
                return;
@@ -524,6 +530,7 @@ public class ChooseLockPassword extends SettingsActivity {
            } else if (mUiStage == Stage.NeedToConfirm) {
                if (mFirstPin.equals(mChosenPassword)) {
                    setNextEnabled(false);
                    mDone = true;
                    new SaveChosenPasswordAndFinish().execute();
                } else {
                    CharSequence tmp = mPasswordEntry.getText();