Fix bugs in credential storage settings:
* resume credential storage settings in onResume() in case if a new activity changes the settings and switches back. * reset mRetry in case the dialog is retried and canceled. * update preferences in onDismiss handler in case the dialog is canceled and need to revert the checkbox.
This commit is contained in:
@@ -231,6 +231,8 @@ public class SecuritySettings extends PreferenceActivity {
|
|||||||
|
|
||||||
mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),
|
mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),
|
||||||
Settings.System.TEXT_SHOW_PASSWORD, 1) != 0);
|
Settings.System.TEXT_SHOW_PASSWORD, 1) != 0);
|
||||||
|
|
||||||
|
mCstorHelper.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -362,7 +364,7 @@ public class SecuritySettings extends PreferenceActivity {
|
|||||||
|
|
||||||
private View mView;
|
private View mView;
|
||||||
private int mDialogId;
|
private int mDialogId;
|
||||||
private boolean mRetry = false;
|
private boolean mRetry;
|
||||||
private CheckBoxPreference mAccessCheckBox;
|
private CheckBoxPreference mAccessCheckBox;
|
||||||
private Preference mResetButton;
|
private Preference mResetButton;
|
||||||
|
|
||||||
@@ -383,6 +385,11 @@ public class SecuritySettings extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resume() {
|
||||||
|
if (mExternalIntent != null) return;
|
||||||
|
updatePreferences(mKeyStore.test());
|
||||||
|
}
|
||||||
|
|
||||||
private void updatePreferences(int state) {
|
private void updatePreferences(int state) {
|
||||||
mAccessCheckBox.setEnabled(state != KeyStore.UNINITIALIZED);
|
mAccessCheckBox.setEnabled(state != KeyStore.UNINITIALIZED);
|
||||||
mAccessCheckBox.setChecked(state == KeyStore.NO_ERROR);
|
mAccessCheckBox.setChecked(state == KeyStore.NO_ERROR);
|
||||||
@@ -428,6 +435,7 @@ public class SecuritySettings extends PreferenceActivity {
|
|||||||
|
|
||||||
private void showCstorDialog(int dialogId) {
|
private void showCstorDialog(int dialogId) {
|
||||||
mDialogId = dialogId;
|
mDialogId = dialogId;
|
||||||
|
mRetry = false;
|
||||||
showDialog(dialogId);
|
showDialog(dialogId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,6 +463,7 @@ public class SecuritySettings extends PreferenceActivity {
|
|||||||
showCstorDialog(mDialogId);
|
showCstorDialog(mDialogId);
|
||||||
} else {
|
} else {
|
||||||
removeDialog(mDialogId);
|
removeDialog(mDialogId);
|
||||||
|
updatePreferences(mState); // may revert checkbox
|
||||||
|
|
||||||
if (mExternalIntent != null) {
|
if (mExternalIntent != null) {
|
||||||
finish();
|
finish();
|
||||||
|
Reference in New Issue
Block a user