Add KeyStore storage type to Settings UI

Give the user an idea of what kind of credential storage is in use on
this device for keystore daemon.

(cherry picked from commit 39b56008be)

Change-Id: Id89a1e210b3627914f080b0925bd0d0585872dd2
This commit is contained in:
Kenny Root
2013-03-29 11:12:55 -07:00
parent 899e4f27f1
commit 028634b6af
3 changed files with 22 additions and 2 deletions

View File

@@ -3522,6 +3522,12 @@
<string name="trusted_credentials">Trusted credentials</string> <string name="trusted_credentials">Trusted credentials</string>
<!-- Summary of preference to display trusted credentials (aka CA certificates) [CHAR LIMIT=NONE] --> <!-- Summary of preference to display trusted credentials (aka CA certificates) [CHAR LIMIT=NONE] -->
<string name="trusted_credentials_summary">Display trusted CA certificates</string> <string name="trusted_credentials_summary">Display trusted CA certificates</string>
<!-- Title of preference of what type of credential storage this device has: hardware or software [CHAR LIMIT=30] -->
<string name="credential_storage_type">Storage type</string>
<!-- Summary text for preference showing what type of credential storage this device has when it is stored in a hardware-backed storage (as opposed to "software only") [CHAR LIMIT=NONE] -->
<string name="credential_storage_type_hardware">Hardware-backed</string>
<!-- Summary text for preference showing what type of credential storage this device has when it is stored in software only (as opposed to "hardware-backed") [CHAR LIMIT=NONE] -->
<string name="credential_storage_type_software">Software only</string>
<!-- Message to draw an unlock pattern when installing credentials --> <!-- Message to draw an unlock pattern when installing credentials -->
<string name="credentials_install_gesture_prompt">Draw your unlock pattern</string> <string name="credentials_install_gesture_prompt">Draw your unlock pattern</string>

View File

@@ -63,6 +63,11 @@
<PreferenceCategory android:key="credentials_management" <PreferenceCategory android:key="credentials_management"
android:title="@string/credentials_title" android:title="@string/credentials_title"
android:persistent="false"> android:persistent="false">
<Preference android:key="credential_storage_type"
android:title="@string/credential_storage_type"
style="?android:attr/preferenceInformationStyle"
android:persistent="false" />
<Preference android:title="@string/trusted_credentials" <Preference android:title="@string/trusted_credentials"
android:summary="@string/trusted_credentials_summary" android:summary="@string/trusted_credentials_summary"
android:persistent="false" android:persistent="false"

View File

@@ -73,6 +73,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
// Misc Settings // Misc Settings
private static final String KEY_SIM_LOCK = "sim_lock"; private static final String KEY_SIM_LOCK = "sim_lock";
private static final String KEY_SHOW_PASSWORD = "show_password"; private static final String KEY_SHOW_PASSWORD = "show_password";
private static final String KEY_CREDENTIAL_STORAGE_TYPE = "credential_storage_type";
private static final String KEY_RESET_CREDENTIALS = "reset_credentials"; private static final String KEY_RESET_CREDENTIALS = "reset_credentials";
private static final String KEY_TOGGLE_INSTALL_APPLICATIONS = "toggle_install_applications"; private static final String KEY_TOGGLE_INSTALL_APPLICATIONS = "toggle_install_applications";
private static final String KEY_TOGGLE_VERIFY_APPLICATIONS = "toggle_verify_applications"; private static final String KEY_TOGGLE_VERIFY_APPLICATIONS = "toggle_verify_applications";
@@ -91,6 +92,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
private CheckBoxPreference mShowPassword; private CheckBoxPreference mShowPassword;
private KeyStore mKeyStore;
private Preference mResetCredentials; private Preference mResetCredentials;
private CheckBoxPreference mToggleAppInstallation; private CheckBoxPreference mToggleAppInstallation;
@@ -231,6 +233,14 @@ public class SecuritySettings extends SettingsPreferenceFragment
// Credential storage, only for primary user // Credential storage, only for primary user
if (mIsPrimary) { if (mIsPrimary) {
mKeyStore = KeyStore.getInstance();
Preference credentialStorageType = root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE);
final int storageSummaryRes =
mKeyStore.isHardwareBacked() ? R.string.credential_storage_type_hardware
: R.string.credential_storage_type_software;
credentialStorageType.setSummary(storageSummaryRes);
mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS); mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS);
} else { } else {
removePreference(KEY_CREDENTIALS_MANAGER); removePreference(KEY_CREDENTIALS_MANAGER);
@@ -427,8 +437,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
} }
if (mResetCredentials != null) { if (mResetCredentials != null) {
KeyStore keyStore = KeyStore.getInstance(); mResetCredentials.setEnabled(!mKeyStore.isUnlocked());
mResetCredentials.setEnabled(!keyStore.isUnlocked());
} }
} }