Encrypt inplace settings.

Change-Id: I5b9cb94c987dedecf3bf31cb67a42e2f24866d3b
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0c51a22..82337dc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -578,10 +578,19 @@
     <!-- In the security screen, the header title for settings related to  Passwords-->
     <string name="security_passwords_title">Passwords</string>
 
-    <string name="encryption_settings_title">Device encryption</string>
-    <string name="encrypt_title">Encrypt data on device</string>
-    <string name="encrypt_summary">Requires you to set a device unlock pin or password</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_desc">Device encryption will convert user data to an ecrypted state, including your accounts, system data, downloaded applications and data, photos, movies, musics, etc.\n\nEncyrption cannot be undone without performing a factory data reset, which would then erase all data.\n\nYou must set up a device lock pin or password to proceed.\n\nThis operation may take up to an hour and may not be interrupted. You must have a fully charged battery and plug in the device to initiate encryption. Running out of power during encryption will cause data loss.</string>
+    
+    <string name="crypt_keeper_button_text" product="tablet">Encrypt tablet</string>
+    <string name="crypt_keeper_button_text" product="default">Encrypt phone</string>
+    
+    <string name="crypt_keeper_final_desc">Encrypt user data? This operation is not reversible and may not be interrupted without loos of data! Encryption may take up to an hour.</string>
+    
+    
     <!-- Unlock Picker Settings --><skip />
 
     <!-- Security Picker --><skip />
diff --git a/res/xml/security_settings_encryption.xml b/res/xml/security_settings_encryption.xml
index fa6d70e..00213df 100644
--- a/res/xml/security_settings_encryption.xml
+++ b/res/xml/security_settings_encryption.xml
@@ -18,14 +18,15 @@
 
     <PreferenceCategory
         android:key="security_category"
-        android:title="@string/encryption_settings_title">
+        android:title="@string/crypt_keeper_settings_title">
 
         <PreferenceScreen
             android:key="encryption"
-            android:title="@string/encrypt_title"
-            android:summary="@string/encrypt_summary"
-            android:persistent="false"/>
-
+            android:title="@string/crypt_keeper_encrypt_title"
+            android:summary="@string/crypt_keeper_encrypt_summary"
+            android:fragment="com.android.settings.CryptKeeperSettings" />
+    
     </PreferenceCategory>
 
+
 </PreferenceScreen>
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index 5447ba8..16c465b 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -31,8 +31,8 @@
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
-import android.view.ViewGroup;
 import android.view.View.OnClickListener;
+import android.view.ViewGroup;
 import android.view.inputmethod.EditorInfo;
 import android.widget.TextView;
 import android.widget.TextView.OnEditorActionListener;
@@ -138,7 +138,11 @@
         private void handleNext() {
             final String pin = mPasswordEntry.getText().toString();
             if (mLockPatternUtils.checkPassword(pin)) {
-                getActivity().setResult(RESULT_OK);
+                
+                Intent intent = new Intent();
+                intent.putExtra("password", pin);
+                
+                getActivity().setResult(RESULT_OK, intent);
                 getActivity().finish();
             } else {
                 showError(R.string.lockpattern_need_to_unlock_wrong);
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index f8ed599..bcaab7f 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -406,8 +406,6 @@
         } else if (preference == mAssistedGps) {
             Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSISTED_GPS_ENABLED,
                     mAssistedGps.isChecked() ? 1 : 0);
-        } else if (KEY_ENCRYPTION.equals(key)) {
-            new Encryption().showPasswordDialog();
         } else {
             // If we didn't handle it, let preferences handle it.
             return super.onPreferenceTreeClick(preferenceScreen, preference);