Reduce the number of keystore connections.
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 5a5804e..7f8cec7 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -233,9 +233,10 @@
PreferenceCategory credStoreCat = new PreferenceCategory(this);
credStoreCat.setTitle(R.string.cstor_settings_category);
root.addPreference(credStoreCat);
- credStoreCat.addPreference(mCstorHelper.createAccessCheckBox());
+ boolean i = mCstorHelper.isCstorInitialized();
+ credStoreCat.addPreference(mCstorHelper.createAccessCheckBox(i));
credStoreCat.addPreference(mCstorHelper.createSetPasswordPreference());
- credStoreCat.addPreference(mCstorHelper.createResetPreference());
+ credStoreCat.addPreference(mCstorHelper.createResetPreference(i));
return root;
}
@@ -793,12 +794,12 @@
mResetButton.setEnabled(enabled);
}
- private Preference createAccessCheckBox() {
+ private Preference createAccessCheckBox(boolean isInitialized) {
CheckBoxPreference pref = new CheckBoxPreference(
SecuritySettings.this);
pref.setTitle(R.string.cstor_access_title);
pref.setSummary(R.string.cstor_access_summary);
- pref.setChecked(isCstorUnlocked());
+ if (isInitialized) pref.setChecked(isCstorUnlocked());
pref.setOnPreferenceChangeListener(
new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(
@@ -813,7 +814,7 @@
return true;
}
});
- pref.setEnabled(isCstorInitialized());
+ pref.setEnabled(isInitialized);
mAccessCheckBox = pref;
return pref;
}
@@ -834,7 +835,7 @@
return pref;
}
- private Preference createResetPreference() {
+ private Preference createResetPreference(boolean isInitialized) {
Preference pref = new Preference(SecuritySettings.this);
pref.setTitle(R.string.cstor_reset_title);
pref.setSummary(R.string.cstor_reset_summary);
@@ -845,7 +846,7 @@
return true;
}
});
- pref.setEnabled(isCstorInitialized());
+ pref.setEnabled(isInitialized);
mResetButton = pref;
return pref;
}