Loading src/com/android/settings/ChooseLockPassword.java +39 −24 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ public class ChooseLockPassword extends SettingsActivity { private static final String KEY_CURRENT_PASSWORD = "current_password"; private String mCurrentPassword; private String mChosenPassword; private boolean mHasChallenge; private long mChallenge; private TextView mPasswordEntry; Loading @@ -145,7 +146,6 @@ public class ChooseLockPassword extends SettingsActivity { private int mRequestedQuality = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC; private ChooseLockSettingsHelper mChooseLockSettingsHelper; private Stage mUiStage = Stage.Introduction; private boolean mDone = false; private TextView mHeaderText; private String mFirstPin; private KeyboardView mKeyboardView; Loading Loading @@ -302,7 +302,6 @@ 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 Loading Loading @@ -478,37 +477,54 @@ public class ChooseLockPassword extends SettingsActivity { return null; } public void handleNext() { if (mDone) return; private class SaveChosenPasswordAndFinish extends AsyncTask<Void, Void, Void> { boolean mWasSecureBefore; final String pin = mPasswordEntry.getText().toString(); if (TextUtils.isEmpty(pin)) { return; } String errorMsg = null; if (mUiStage == Stage.Introduction) { errorMsg = validatePassword(pin); if (errorMsg == null) { mFirstPin = pin; mPasswordEntry.setText(""); updateStage(Stage.NeedToConfirm); } } else if (mUiStage == Stage.NeedToConfirm) { if (mFirstPin.equals(pin)) { boolean wasSecureBefore = mLockPatternUtils.isSecure(UserHandle.myUserId()); @Override public void onPreExecute() { mWasSecureBefore = mLockPatternUtils.isSecure(UserHandle.myUserId()); final boolean required = getActivity().getIntent().getBooleanExtra( EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true); mLockPatternUtils.setCredentialRequiredToDecrypt(required); mLockPatternUtils.saveLockPassword(pin, mCurrentPassword, mRequestedQuality, } @Override public Void doInBackground(Void... v) { mLockPatternUtils.saveLockPassword(mChosenPassword, mCurrentPassword, mRequestedQuality, UserHandle.myUserId()); return null; } @Override public void onPostExecute(Void v) { if (mHasChallenge) { startVerifyPassword(pin, wasSecureBefore); startVerifyPassword(mChosenPassword, mWasSecureBefore); return; } else { getActivity().setResult(RESULT_FINISHED); } finishConfirmStage(wasSecureBefore); finishConfirmStage(mWasSecureBefore); } } public void handleNext() { mChosenPassword = mPasswordEntry.getText().toString(); if (TextUtils.isEmpty(mChosenPassword)) { return; } String errorMsg = null; if (mUiStage == Stage.Introduction) { errorMsg = validatePassword(mChosenPassword); if (errorMsg == null) { mFirstPin = mChosenPassword; mPasswordEntry.setText(""); updateStage(Stage.NeedToConfirm); } } else if (mUiStage == Stage.NeedToConfirm) { if (mFirstPin.equals(mChosenPassword)) { setNextEnabled(false); new SaveChosenPasswordAndFinish().execute(); } else { CharSequence tmp = mPasswordEntry.getText(); if (tmp != null) { Loading Loading @@ -557,7 +573,6 @@ public class ChooseLockPassword extends SettingsActivity { private void finishConfirmStage(boolean wasSecureBefore) { getActivity().finish(); mDone = true; if (!wasSecureBefore) { Intent intent = getRedactionInterstitialIntent(getActivity()); if (intent != null) { Loading src/com/android/settings/ChooseLockPattern.java +35 −23 Original line number Diff line number Diff line Loading @@ -346,7 +346,6 @@ public class ChooseLockPattern extends SettingsActivity { } private Stage mUiStage = Stage.Introduction; private boolean mDone = false; private Runnable mClearPatternRunnable = new Runnable() { public void run() { Loading Loading @@ -435,7 +434,6 @@ public class ChooseLockPattern extends SettingsActivity { } updateStage(Stage.values()[savedInstanceState.getInt(KEY_UI_STAGE)]); } mDone = false; } @Override Loading Loading @@ -483,7 +481,7 @@ public class ChooseLockPattern extends SettingsActivity { throw new IllegalStateException("expected ui stage " + Stage.ChoiceConfirmed + " when button is " + RightButtonMode.Confirm); } saveChosenPatternAndFinish(); new SaveChosenPatternAndFinish().execute(); } else if (mUiStage.rightMode == RightButtonMode.Ok) { if (mUiStage != Stage.HelpScreen) { throw new IllegalStateException("Help screen is only mode with ok button, " Loading Loading @@ -623,27 +621,41 @@ public class ChooseLockPattern extends SettingsActivity { mLockPatternView.postDelayed(mClearPatternRunnable, WRONG_PATTERN_CLEAR_TIMEOUT_MS); } private void saveChosenPatternAndFinish() { if (mDone) return; LockPatternUtils utils = mChooseLockSettingsHelper.utils(); final boolean lockVirgin = !utils.isPatternEverChosen(UserHandle.myUserId()); private class SaveChosenPatternAndFinish extends AsyncTask<Void,Void,Void> { boolean mLockVirgin; LockPatternUtils mUtils; boolean mWasSecureBefore; boolean wasSecureBefore = utils.isSecure(UserHandle.myUserId()); @Override protected void onPreExecute(){ setRightButtonEnabled(false); mUtils = mChooseLockSettingsHelper.utils(); mLockVirgin = !mUtils.isPatternEverChosen(UserHandle.myUserId()); mWasSecureBefore = mUtils.isSecure(UserHandle.myUserId()); final boolean required = getActivity().getIntent().getBooleanExtra( EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true); utils.setCredentialRequiredToDecrypt(required); utils.saveLockPattern(mChosenPattern, mCurrentPattern, UserHandle.myUserId()); mUtils.setCredentialRequiredToDecrypt(required); } if (lockVirgin) { utils.setVisiblePatternEnabled(true, UserHandle.myUserId()); @Override protected Void doInBackground(Void... params){ mUtils.saveLockPattern(mChosenPattern, mCurrentPattern, UserHandle.myUserId()); return null; } @Override protected void onPostExecute(Void param) { if (mLockVirgin) { mUtils.setVisiblePatternEnabled(true, UserHandle.myUserId()); } if (mHasChallenge) { startVerifyPattern(utils, wasSecureBefore); startVerifyPattern(mUtils, mWasSecureBefore); } else { if (!wasSecureBefore) { if (!mWasSecureBefore) { Intent intent = getRedactionInterstitialIntent(getActivity()); if (intent != null) { startActivity(intent); Loading @@ -653,6 +665,7 @@ public class ChooseLockPattern extends SettingsActivity { doFinish(); } } } private void startVerifyPattern(LockPatternUtils utils, final boolean wasSecureBefore) { mLockPatternView.disableInput(); Loading Loading @@ -693,7 +706,6 @@ public class ChooseLockPattern extends SettingsActivity { private void doFinish() { getActivity().finish(); mDone = true; } } } Loading
src/com/android/settings/ChooseLockPassword.java +39 −24 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ public class ChooseLockPassword extends SettingsActivity { private static final String KEY_CURRENT_PASSWORD = "current_password"; private String mCurrentPassword; private String mChosenPassword; private boolean mHasChallenge; private long mChallenge; private TextView mPasswordEntry; Loading @@ -145,7 +146,6 @@ public class ChooseLockPassword extends SettingsActivity { private int mRequestedQuality = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC; private ChooseLockSettingsHelper mChooseLockSettingsHelper; private Stage mUiStage = Stage.Introduction; private boolean mDone = false; private TextView mHeaderText; private String mFirstPin; private KeyboardView mKeyboardView; Loading Loading @@ -302,7 +302,6 @@ 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 Loading Loading @@ -478,37 +477,54 @@ public class ChooseLockPassword extends SettingsActivity { return null; } public void handleNext() { if (mDone) return; private class SaveChosenPasswordAndFinish extends AsyncTask<Void, Void, Void> { boolean mWasSecureBefore; final String pin = mPasswordEntry.getText().toString(); if (TextUtils.isEmpty(pin)) { return; } String errorMsg = null; if (mUiStage == Stage.Introduction) { errorMsg = validatePassword(pin); if (errorMsg == null) { mFirstPin = pin; mPasswordEntry.setText(""); updateStage(Stage.NeedToConfirm); } } else if (mUiStage == Stage.NeedToConfirm) { if (mFirstPin.equals(pin)) { boolean wasSecureBefore = mLockPatternUtils.isSecure(UserHandle.myUserId()); @Override public void onPreExecute() { mWasSecureBefore = mLockPatternUtils.isSecure(UserHandle.myUserId()); final boolean required = getActivity().getIntent().getBooleanExtra( EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true); mLockPatternUtils.setCredentialRequiredToDecrypt(required); mLockPatternUtils.saveLockPassword(pin, mCurrentPassword, mRequestedQuality, } @Override public Void doInBackground(Void... v) { mLockPatternUtils.saveLockPassword(mChosenPassword, mCurrentPassword, mRequestedQuality, UserHandle.myUserId()); return null; } @Override public void onPostExecute(Void v) { if (mHasChallenge) { startVerifyPassword(pin, wasSecureBefore); startVerifyPassword(mChosenPassword, mWasSecureBefore); return; } else { getActivity().setResult(RESULT_FINISHED); } finishConfirmStage(wasSecureBefore); finishConfirmStage(mWasSecureBefore); } } public void handleNext() { mChosenPassword = mPasswordEntry.getText().toString(); if (TextUtils.isEmpty(mChosenPassword)) { return; } String errorMsg = null; if (mUiStage == Stage.Introduction) { errorMsg = validatePassword(mChosenPassword); if (errorMsg == null) { mFirstPin = mChosenPassword; mPasswordEntry.setText(""); updateStage(Stage.NeedToConfirm); } } else if (mUiStage == Stage.NeedToConfirm) { if (mFirstPin.equals(mChosenPassword)) { setNextEnabled(false); new SaveChosenPasswordAndFinish().execute(); } else { CharSequence tmp = mPasswordEntry.getText(); if (tmp != null) { Loading Loading @@ -557,7 +573,6 @@ public class ChooseLockPassword extends SettingsActivity { private void finishConfirmStage(boolean wasSecureBefore) { getActivity().finish(); mDone = true; if (!wasSecureBefore) { Intent intent = getRedactionInterstitialIntent(getActivity()); if (intent != null) { Loading
src/com/android/settings/ChooseLockPattern.java +35 −23 Original line number Diff line number Diff line Loading @@ -346,7 +346,6 @@ public class ChooseLockPattern extends SettingsActivity { } private Stage mUiStage = Stage.Introduction; private boolean mDone = false; private Runnable mClearPatternRunnable = new Runnable() { public void run() { Loading Loading @@ -435,7 +434,6 @@ public class ChooseLockPattern extends SettingsActivity { } updateStage(Stage.values()[savedInstanceState.getInt(KEY_UI_STAGE)]); } mDone = false; } @Override Loading Loading @@ -483,7 +481,7 @@ public class ChooseLockPattern extends SettingsActivity { throw new IllegalStateException("expected ui stage " + Stage.ChoiceConfirmed + " when button is " + RightButtonMode.Confirm); } saveChosenPatternAndFinish(); new SaveChosenPatternAndFinish().execute(); } else if (mUiStage.rightMode == RightButtonMode.Ok) { if (mUiStage != Stage.HelpScreen) { throw new IllegalStateException("Help screen is only mode with ok button, " Loading Loading @@ -623,27 +621,41 @@ public class ChooseLockPattern extends SettingsActivity { mLockPatternView.postDelayed(mClearPatternRunnable, WRONG_PATTERN_CLEAR_TIMEOUT_MS); } private void saveChosenPatternAndFinish() { if (mDone) return; LockPatternUtils utils = mChooseLockSettingsHelper.utils(); final boolean lockVirgin = !utils.isPatternEverChosen(UserHandle.myUserId()); private class SaveChosenPatternAndFinish extends AsyncTask<Void,Void,Void> { boolean mLockVirgin; LockPatternUtils mUtils; boolean mWasSecureBefore; boolean wasSecureBefore = utils.isSecure(UserHandle.myUserId()); @Override protected void onPreExecute(){ setRightButtonEnabled(false); mUtils = mChooseLockSettingsHelper.utils(); mLockVirgin = !mUtils.isPatternEverChosen(UserHandle.myUserId()); mWasSecureBefore = mUtils.isSecure(UserHandle.myUserId()); final boolean required = getActivity().getIntent().getBooleanExtra( EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true); utils.setCredentialRequiredToDecrypt(required); utils.saveLockPattern(mChosenPattern, mCurrentPattern, UserHandle.myUserId()); mUtils.setCredentialRequiredToDecrypt(required); } if (lockVirgin) { utils.setVisiblePatternEnabled(true, UserHandle.myUserId()); @Override protected Void doInBackground(Void... params){ mUtils.saveLockPattern(mChosenPattern, mCurrentPattern, UserHandle.myUserId()); return null; } @Override protected void onPostExecute(Void param) { if (mLockVirgin) { mUtils.setVisiblePatternEnabled(true, UserHandle.myUserId()); } if (mHasChallenge) { startVerifyPattern(utils, wasSecureBefore); startVerifyPattern(mUtils, mWasSecureBefore); } else { if (!wasSecureBefore) { if (!mWasSecureBefore) { Intent intent = getRedactionInterstitialIntent(getActivity()); if (intent != null) { startActivity(intent); Loading @@ -653,6 +665,7 @@ public class ChooseLockPattern extends SettingsActivity { doFinish(); } } } private void startVerifyPattern(LockPatternUtils utils, final boolean wasSecureBefore) { mLockPatternView.disableInput(); Loading Loading @@ -693,7 +706,6 @@ public class ChooseLockPattern extends SettingsActivity { private void doFinish() { getActivity().finish(); mDone = true; } } }