OSDN Git Service

am 4b2a602e: am 323fa9c6: Merge "Display the correct encryption settings." into honeycomb
authorJason parks <jparks@google.com>
Tue, 25 Jan 2011 17:59:07 +0000 (09:59 -0800)
committerAndroid Git Automerger <android-git-automerger@android.com>
Tue, 25 Jan 2011 17:59:07 +0000 (09:59 -0800)
* commit '4b2a602eaac76ab117e96271ac4474a0de15795e':
  Display the correct encryption settings.

res/values/strings.xml
res/xml/security_settings_encrypted.xml [new file with mode: 0644]
res/xml/security_settings_unencrypted.xml [moved from res/xml/security_settings_encryption.xml with 100% similarity]
src/com/android/settings/SecuritySettings.java

index df11d4f..eed510b 100644 (file)
     <string name="security_passwords_title">Passwords</string>
 
     <string name="crypt_keeper_settings_title">Device encryption</string>
+
     <string name="crypt_keeper_encrypt_title">Encrypt data on device</string>
     <string name="crypt_keeper_encrypt_summary">Requires you to set a device unlock pin or password</string>
-    <string name="crypt_keeper_confirm_title">Confirm encrypt</string>
+    <string name="crypt_keeper_encrypted_summary">Encrypted</string>
+
+    <string name="crypt_keeper_confirm_title">Confirm encryption</string>
+
     
-    <string name="crypt_keeper_desc">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.</string>
+    <string name="crypt_keeper_desc" product="tablet">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.</string>
+    <string name="crypt_keeper_desc" product="default">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.</string>
+
     
     <string name="crypt_keeper_button_text" product="tablet">Encrypt tablet</string>
     <string name="crypt_keeper_button_text" product="default">Encrypt phone</string>
diff --git a/res/xml/security_settings_encrypted.xml b/res/xml/security_settings_encrypted.xml
new file mode 100644 (file)
index 0000000..e82dc56
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <PreferenceCategory
+        android:key="security_category"
+        android:title="@string/crypt_keeper_settings_title"
+    >
+        <Preference
+            style="?android:preferenceInformationStyle"
+            android:title="@string/crypt_keeper_encrypt_title"
+            android:summary="@string/crypt_keeper_encrypted_summary"
+        />
+
+    </PreferenceCategory>
+
+
+</PreferenceScreen>
index aaaf265..e413915 100644 (file)
@@ -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) {