diff --git a/res/values/strings.xml b/res/values/strings.xml index 9724e6088c2..7bbaf7e53c5 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -583,11 +583,17 @@ Passwords Device encryption + Encrypt data on device Requires you to set a device unlock pin or password - Confirm encrypt + Encrypted + + Confirm encryption + - You can encrypt your accounts, settings, downloaded applications and their data, media, and other files. Once you encrypt your tablet, you can\'t unencrypt it except by performing a factory data reset, erasing all the data on your tablet.\n\nEncryption takes up to an hour. You must start with a charged battery and keep your tablet plugged in until encryption is complete. If you interrupt the encryption process, you will lose some or all of your data. + You can encrypt your accounts, settings, downloaded applications and their data, media, and other files. Once you encrypt your tablet, you can\'t unencrypt it except by performing a factory data reset, erasing all the data on your tablet.\n\nEncryption takes up to an hour. You must start with a charged battery and keep your tablet plugged in until encryption is complete. If you interrupt the encryption process, you will lose some or all of your data. + You can encrypt your accounts, settings, downloaded applications and their data, media, and other files. Once you encrypt your phone, you can\'t unencrypt it except by performing a factory data reset, erasing all the data on your phone.\n\nEncryption takes up to an hour. You must start with a charged battery and keep your phone plugged in until encryption is complete. If you interrupt the encryption process, you will lose some or all of your data. + Encrypt tablet Encrypt phone diff --git a/res/xml/security_settings_encrypted.xml b/res/xml/security_settings_encrypted.xml new file mode 100644 index 00000000000..e82dc561001 --- /dev/null +++ b/res/xml/security_settings_encrypted.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/res/xml/security_settings_encryption.xml b/res/xml/security_settings_unencrypted.xml similarity index 100% rename from res/xml/security_settings_encryption.xml rename to res/xml/security_settings_unencrypted.xml diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index aaaf265a545..e4139157959 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -29,6 +29,7 @@ import android.content.Intent; import android.database.Cursor; import android.location.LocationManager; import android.os.Bundle; +import android.os.SystemProperties; import android.os.Vibrator; import android.preference.CheckBoxPreference; import android.preference.ListPreference; @@ -50,7 +51,6 @@ import java.util.Observer; */ public class SecuritySettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener { - private static final String KEY_ENCRYPTION = "encryption"; // Lock Settings private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change"; @@ -161,12 +161,6 @@ public class SecuritySettings extends SettingsPreferenceFragment mUseLocation = useLocation; } - // Add options for device encryption - // TODO: It still needs to be determined how a device specifies that it supports - // encryption. That mechanism needs to be checked before adding the following code - - addPreferencesFromResource(R.xml.security_settings_encryption); - // Add options for lock/unlock screen int resid = 0; if (!mLockPatternUtils.isSecure()) { @@ -192,6 +186,19 @@ public class SecuritySettings extends SettingsPreferenceFragment } addPreferencesFromResource(resid); + + // Add options for device encryption + + String status = SystemProperties.get("ro.crypto.state", "unsupported"); + if ("encrypted".equalsIgnoreCase(status)) { + // The device is currently encrypted + addPreferencesFromResource(R.xml.security_settings_encrypted); + } else if ("unencrypted".equalsIgnoreCase(status)) { + // This device support encryption but isn't encrypted + addPreferencesFromResource(R.xml.security_settings_unencrypted); + } + + // lock after preference mLockAfter = (ListPreference) root.findPreference(KEY_LOCK_AFTER_TIMEOUT); if (mLockAfter != null) {