Merge "Rearrange Applications settings items." into honeycomb
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f822ff6..e07f38e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -656,9 +656,9 @@
             </intent-filter>
         </activity>
 
-        <activity android:name="DeviceAdminSettings"
+        <activity android:name="Settings$DeviceAdminSettingsActivity"
                 android:label="@string/device_admin_settings_title"
-                android:theme="@style/TallTitleBarTheme"
+                android:theme="@android:style/Theme.Holo"
                 android:clearTaskOnLaunch="true"
                 >
             <intent-filter>
@@ -667,11 +667,19 @@
                 <category android:name="android.intent.category.VOICE_LAUNCH" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                android:value="com.android.settings.DeviceAdminSettings" />
+            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+                android:resource="@id/security_settings" />
+            <meta-data android:name="com.android.settings.PARENT_FRAGMENT_TITLE"
+                android:resource="@string/location_security_settings_title" />
+            <meta-data android:name="com.android.settings.PARENT_FRAGMENT_CLASS"
+                android:value="com.android.settings.Settings$SecuritySettingsActivity" />
         </activity>
 
         <activity android:name="DeviceAdminAdd"
                 android:label="@string/device_admin_add_title"
-                android:theme="@style/TallTitleBarTheme"
+                android:theme="@android:style/Theme.Holo.DialogWhenLarge"
                 android:clearTaskOnLaunch="true"
                 >
             <intent-filter>
@@ -1071,7 +1079,7 @@
         <activity android:name=".CryptKeeper"
                   android:immersive="true"
                   android:launchMode="singleTop"
-                  android:theme="@android:style/Theme.Holo.NoActionBar"
+                  android:theme="@style/CryptKeeperTheme"
                   android:windowSoftInputMode="stateAlwaysHidden">
             <intent-filter android:priority="10">
                 <action android:name="android.intent.action.MAIN" />
@@ -1080,6 +1088,12 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".CryptKeeper$Blank"
+            android:immersive="true"
+            android:launchMode="singleTop"
+            android:theme="@style/CryptKeeperBlankTheme"
+        />
+
         <!-- Pseudo-activity used to provide an intent-filter entry point to encryption settings -->
         <activity android:name="Settings$CryptKeeperSettingsActivity"
                 android:theme="@android:style/Theme.Holo"
diff --git a/res/anim/crypt_keeper_exit.xml b/res/anim/crypt_keeper_exit.xml
new file mode 100644
index 0000000..3ab34e9
--- /dev/null
+++ b/res/anim/crypt_keeper_exit.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator"
+>
+
+    <scale
+        android:fromXScale="1.0"
+        android:toXScale="0.0"
+        android:fromYScale="1.0"
+        android:toYScale="0.0"
+        android:pivotX="50%"
+        android:pivotY="50%"
+        android:fillAfter="false"
+        android:duration="500"
+    />
+
+</set>
+
diff --git a/res/layout-xlarge-land/choose_lock_password.xml b/res/layout-xlarge-land/choose_lock_password.xml
index 586e7d5..9518672 100644
--- a/res/layout-xlarge-land/choose_lock_password.xml
+++ b/res/layout-xlarge-land/choose_lock_password.xml
@@ -64,26 +64,19 @@
 
     <!-- confirm / restart buttons -->
     <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        style="@style/SecurityPreferenceButtonContainer"
         android:layout_alignParentRight="true"
         android:layout_alignParentBottom="true"
         android:orientation="horizontal">
 
         <!-- left / top button: skip, or re-try -->
         <Button android:id="@+id/cancel_button"
-            android:layout_width="140dip"
-            android:layout_height="wrap_content"
-            android:ellipsize="marquee"
-            android:singleLine="true"
+            style="@style/SecurityPreferenceButton"
             android:text="@string/lockpassword_cancel_label"/>
 
         <!-- right / bottom button: confirm or ok -->
         <Button android:id="@+id/next_button"
-            android:layout_width="140dip"
-            android:layout_height="wrap_content"
-            android:ellipsize="marquee"
-            android:singleLine="true"
+            style="@style/SecurityPreferenceButton"
             android:text="@string/lockpassword_continue_label"/>
 
     </LinearLayout>
diff --git a/res/layout-xlarge-land/choose_lock_pattern.xml b/res/layout-xlarge-land/choose_lock_pattern.xml
index e2cbdab..fc5e787 100644
--- a/res/layout-xlarge-land/choose_lock_pattern.xml
+++ b/res/layout-xlarge-land/choose_lock_pattern.xml
@@ -59,26 +59,19 @@
 
         <!-- confirm / restart buttons -->
         <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:layout_alignParentBottom="true"
             android:orientation="horizontal">
 
             <!-- left / top button: skip, or re-try -->
             <Button android:id="@+id/footerLeftButton"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_restart_button_text"/>
 
             <!-- right / bottom button: confirm or ok -->
             <Button android:id="@+id/footerRightButton"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_confirm_button_text"/>
 
         </LinearLayout>
diff --git a/res/layout-xlarge-land/choose_lock_pattern_tutorial.xml b/res/layout-xlarge-land/choose_lock_pattern_tutorial.xml
index 56addbb..32b452d 100644
--- a/res/layout-xlarge-land/choose_lock_pattern_tutorial.xml
+++ b/res/layout-xlarge-land/choose_lock_pattern_tutorial.xml
@@ -48,26 +48,19 @@
             android:textSize="22sp"/>
 
         <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:layout_alignParentBottom="true"
             android:orientation="horizontal">
 
             <!-- left / top button: skip, or re-try -->
             <Button android:id="@+id/skip_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_tutorial_cancel_label"/>
 
             <!-- right / bottom button: confirm or ok -->
             <Button android:id="@+id/next_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_tutorial_continue_label"/>
 
         </LinearLayout>
diff --git a/res/layout-xlarge-land/confirm_lock_password.xml b/res/layout-xlarge-land/confirm_lock_password.xml
index 7ae8944..3874f11 100644
--- a/res/layout-xlarge-land/confirm_lock_password.xml
+++ b/res/layout-xlarge-land/confirm_lock_password.xml
@@ -65,26 +65,19 @@
 
     <!-- confirm / restart buttons -->
     <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        style="@style/SecurityPreferenceButtonContainer"
         android:layout_alignParentRight="true"
         android:layout_alignParentBottom="true"
         android:orientation="horizontal">
 
         <!-- left / top button: skip, or re-try -->
         <Button android:id="@+id/cancel_button"
-            android:layout_width="140dip"
-            android:layout_height="wrap_content"
-            android:ellipsize="marquee"
-            android:singleLine="true"
+            style="@style/SecurityPreferenceButton"
             android:text="@string/lockpassword_cancel_label"/>
 
         <!-- right / bottom button: confirm or ok -->
         <Button android:id="@+id/next_button"
-            android:layout_width="140dip"
-            android:layout_height="wrap_content"
-            android:ellipsize="marquee"
-            android:singleLine="true"
+            style="@style/SecurityPreferenceButton"
             android:text="@string/lockpassword_continue_label"/>
 
     </LinearLayout>
diff --git a/res/layout-xlarge-land/crypt_keeper_password_entry.xml b/res/layout-xlarge-land/crypt_keeper_password_entry.xml
index 76d2278..ffbdf89 100644
--- a/res/layout-xlarge-land/crypt_keeper_password_entry.xml
+++ b/res/layout-xlarge-land/crypt_keeper_password_entry.xml
@@ -20,51 +20,53 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="horizontal"
+    android:orientation="vertical"
 >
-    <LinearLayout
-           android:layout_height="match_parent"
-           android:layout_weight="1"
-           android:layout_width="0dip"
-           android:orientation="vertical"
-           android:gravity="center_vertical"
-               >
-       <include layout="@layout/crypt_keeper_status" />
-   </LinearLayout>
-   
-   <!-- right side: password -->
-   <LinearLayout
-       android:layout_width="0dip"
-       android:layout_height="match_parent"
-       android:orientation="vertical"
-       android:layout_weight="1"
-       android:gravity="center">
 
-       <!-- Password entry field -->
-       <EditText android:id="@+id/passwordEntry"
-           android:layout_height="wrap_content"
-           android:layout_width="450dip"
-           android:singleLine="true"
-           android:textStyle="normal"
-           android:inputType="textPassword"
-           android:gravity="center"
-           android:layout_gravity="center"
-           android:textSize="24sp"
-           android:layout_marginTop="120dip"
-           android:layout_marginBottom="5dip"
-           android:textAppearance="?android:attr/textAppearanceMedium"
-           android:textColor="#ffffffff"
-           android:editable="false"
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1"
+    >
+        <!-- left side: status -->
+        <include layout="@layout/crypt_keeper_status"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="102dip"
+            android:layout_marginTop="20dip"
+            android:gravity="left"
+            android:paddingTop="50dip"
+            android:layout_centerVertical="true"
+            android:layout_alignParentLeft="true"
         />
 
-       <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
-           android:layout_width="450dip"
-           android:layout_height="230dip"
-           android:background="#00000000"
-           android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
-           android:visibility="visible"
-       />
-       
-   </LinearLayout>
-    
+        <!-- Password entry field -->
+        <EditText android:id="@+id/passwordEntry"
+            android:layout_height="wrap_content"
+            android:layout_width="450dip"
+            android:layout_marginRight="155dip"
+            android:layout_alignParentRight="true"
+            android:singleLine="true"
+            android:textStyle="normal"
+            android:inputType="textPassword"
+            android:gravity="center"
+            android:layout_gravity="center"
+            android:textSize="24sp"
+            android:layout_marginTop="120dip"
+            android:layout_marginBottom="5dip"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="#ffffffff"
+            android:editable="false"
+        />
+
+    </RelativeLayout>
+
+    <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="#00000000"
+        android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
+        android:visibility="visible"
+    />
+
 </LinearLayout>
\ No newline at end of file
diff --git a/res/layout-xlarge/choose_lock_password.xml b/res/layout-xlarge/choose_lock_password.xml
index f923971..c8a0866 100644
--- a/res/layout-xlarge/choose_lock_password.xml
+++ b/res/layout-xlarge/choose_lock_password.xml
@@ -84,23 +84,16 @@
         android:layout_width="match_parent">
 
         <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:orientation="horizontal">
 
             <Button android:id="@+id/cancel_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpassword_cancel_label"/>
 
             <Button android:id="@+id/next_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpassword_continue_label"/>
 
         </LinearLayout>
diff --git a/res/layout-xlarge/choose_lock_pattern.xml b/res/layout-xlarge/choose_lock_pattern.xml
index 5995c26..6b7b90e 100644
--- a/res/layout-xlarge/choose_lock_pattern.xml
+++ b/res/layout-xlarge/choose_lock_pattern.xml
@@ -54,25 +54,18 @@
         android:layout_height="wrap_content">
 
         <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:orientation="horizontal">
 
             <!-- left / top button: skip, or re-try -->
             <Button android:id="@+id/footerLeftButton"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_restart_button_text"/>
 
             <!-- right / bottom button: confirm or ok -->
             <Button android:id="@+id/footerRightButton"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_confirm_button_text"/>
 
         </LinearLayout>
diff --git a/res/layout-xlarge/choose_lock_pattern_tutorial.xml b/res/layout-xlarge/choose_lock_pattern_tutorial.xml
index ea09727..c7bdc88 100644
--- a/res/layout-xlarge/choose_lock_pattern_tutorial.xml
+++ b/res/layout-xlarge/choose_lock_pattern_tutorial.xml
@@ -47,25 +47,18 @@
         android:layout_height="wrap_content">
 
         <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:orientation="horizontal">
 
             <!-- left / top button: skip, or re-try -->
             <Button android:id="@+id/skip_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_tutorial_cancel_label"/>
 
             <!-- right / bottom button: confirm or ok -->
             <Button android:id="@+id/next_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpattern_tutorial_continue_label"/>
 
         </LinearLayout>
diff --git a/res/layout-xlarge/confirm_lock_password.xml b/res/layout-xlarge/confirm_lock_password.xml
index abb0d79..5ffc5e7 100644
--- a/res/layout-xlarge/confirm_lock_password.xml
+++ b/res/layout-xlarge/confirm_lock_password.xml
@@ -87,23 +87,16 @@
         android:layout_width="match_parent">
 
         <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:orientation="horizontal">
 
             <Button android:id="@+id/cancel_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpassword_cancel_label"/>
 
             <Button android:id="@+id/next_button"
-                android:layout_width="140dip"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
+                style="@style/SecurityPreferenceButton"
                 android:text="@string/lockpassword_continue_label"/>
 
         </LinearLayout>
diff --git a/res/layout-xlarge/crypt_keeper_password_entry.xml b/res/layout-xlarge/crypt_keeper_password_entry.xml
index 4dce67a..b67eed0 100644
--- a/res/layout-xlarge/crypt_keeper_password_entry.xml
+++ b/res/layout-xlarge/crypt_keeper_password_entry.xml
@@ -17,52 +17,49 @@
 */
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
+    android:gravity="center_horizontal"
 >
-    <LinearLayout
-           android:layout_height="wrap_content"
-           android:layout_width="match_parent"
-           android:orientation="vertical"
-           android:gravity="center_vertical"
-               >
-       <include layout="@layout/crypt_keeper_status" />
-   </LinearLayout>
-   
-   <!-- right side: password -->
-   <LinearLayout
-       android:layout_width="match_parent"
-       android:layout_height="match_parent"
-       android:orientation="vertical"
-       android:gravity="center">
 
-       <!-- Password entry field -->
-       <EditText android:id="@+id/passwordEntry"
-           android:layout_height="wrap_content"
-           android:layout_width="450dip"
-           android:singleLine="true"
-           android:textStyle="normal"
-           android:inputType="textPassword"
-           android:gravity="center"
-           android:layout_gravity="center"
-           android:textSize="24sp"
-           android:layout_marginTop="120dip"
-           android:layout_marginBottom="5dip"
-           android:textAppearance="?android:attr/textAppearanceMedium"
-           android:textColor="#ffffffff"
-           android:editable="false"
-        />
+    <!-- left side: status -->
+    <include layout="@layout/crypt_keeper_status"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="134dip"
+        android:paddingTop="50dip"
+        android:layout_alignParentTop="true"
+        android:layout_gravity="center_horizontal"
+        android:layout_centerHorizontal="true"
+    />
 
-       <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
-           android:layout_width="450dip"
-           android:layout_height="230dip"
-           android:background="#00000000"
-           android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
-           android:visibility="visible"
-       />
-       
-   </LinearLayout>
-    
-</LinearLayout>
\ No newline at end of file
+    <!-- Password entry field -->
+    <EditText android:id="@+id/passwordEntry"
+        android:layout_above="@id/keyboard"
+        android:layout_height="wrap_content"
+        android:layout_width="450dip"
+        android:singleLine="true"
+        android:textStyle="normal"
+        android:inputType="textPassword"
+        android:gravity="center"
+        android:layout_gravity="center_horizontal"
+        android:layout_centerHorizontal="true"
+        android:textSize="24sp"
+        android:layout_marginTop="120dip"
+        android:layout_marginBottom="5dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="#ffffffff"
+        android:editable="false"
+    />
+
+    <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:background="#00000000"
+        android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
+        android:visibility="visible"
+    />
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/crypt_keeper_status.xml b/res/layout/crypt_keeper_status.xml
index ba2584f..d106c69 100644
--- a/res/layout/crypt_keeper_status.xml
+++ b/res/layout/crypt_keeper_status.xml
@@ -23,10 +23,7 @@
         android:orientation="vertical"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="140dip"
-        android:layout_marginTop="20dip"
-        android:gravity="left"
-        >
+>
 
     <com.android.internal.widget.DigitalClock android:id="@+id/time"
         android:layout_width="wrap_content"
diff --git a/res/layout/device_admin_add.xml b/res/layout/device_admin_add.xml
index f3ba59e..ac30ed9 100644
--- a/res/layout/device_admin_add.xml
+++ b/res/layout/device_admin_add.xml
@@ -21,25 +21,12 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:background="@*android:drawable/title_bar_medium">
-        <TextView android:id="@+id/title"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="center"
-            android:textAppearance="?android:attr/textAppearanceLarge"
-            android:textColor="?android:attr/textColorPrimary"
-            android:shadowColor="?android:attr/colorBackground"
-            android:shadowRadius="2" />
-    </LinearLayout>
-
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1.0"
+        android:layout_marginLeft="16dip"
+        android:layout_marginRight="16dip"
         android:gravity="top">
         <LinearLayout
             android:layout_width="match_parent"
@@ -111,31 +98,50 @@
         </LinearLayout>
     </ScrollView>
 
-    <LinearLayout style="@android:style/ButtonBar"
+    <LinearLayout android:id="@+id/buttonPanel"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:orientation="horizontal">
-        <View
-           android:layout_width="0dip"
-           android:layout_height="0dip"
-           android:layout_weight="1" />
-        <Button android:id="@+id/action_button"
-            android:layout_width="wrap_content"
+        android:minHeight="54dip"
+        android:orientation="vertical"
+        android:divider="?android:attr/dividerHorizontal"
+        android:showDividers="beginning"
+        android:dividerPadding="16dip">
+        <LinearLayout
+            style="?android:attr/buttonBarStyle"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_weight="1" />
-        <View
-           android:layout_width="0dip"
-           android:layout_height="0dip"
-           android:layout_weight="1" />
-        <Button android:id="@+id/cancel_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/cancel" />
-        <View
-           android:layout_width="0dip"
-           android:layout_height="0dip"
-           android:layout_weight="1" />
-    </LinearLayout>
+            android:orientation="horizontal"
+            android:paddingLeft="2dip"
+            android:paddingRight="2dip"
+            android:measureWithLargestChild="true">
+            <LinearLayout android:id="@+id/leftSpacer"
+                android:layout_weight="0.25"
+                android:layout_width="0dip"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:visibility="gone" />
+            <Button android:id="@+id/action_button"
+                android:layout_width="0dip"
+                android:layout_gravity="left"
+                android:layout_weight="1"
+                android:maxLines="2"
+                style="?android:attr/buttonBarButtonStyle"
+                android:layout_height="wrap_content" />
+            <Button android:id="@+id/cancel_button"
+                android:layout_width="0dip"
+                android:layout_gravity="right"
+                android:layout_weight="1"
+                android:maxLines="2"
+                android:text="@string/cancel"
+                style="?android:attr/buttonBarButtonStyle"
+                android:layout_height="wrap_content" />
+            <LinearLayout android:id="@+id/rightSpacer"
+                android:layout_width="0dip"
+                android:layout_weight="0.25"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:visibility="gone" />
+        </LinearLayout>
+     </LinearLayout>
 
 </LinearLayout>
diff --git a/res/layout/device_admin_item.xml b/res/layout/device_admin_item.xml
index 49cbc61..fe9e45a 100644
--- a/res/layout/device_admin_item.xml
+++ b/res/layout/device_admin_item.xml
@@ -21,49 +21,62 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
-    android:orientation="vertical"
+    android:orientation="horizontal"
     android:paddingRight="6dip"
     android:paddingLeft="6dip"
-    android:gravity="fill" >
+    android:gravity="center_vertical" >
 
     <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:minWidth="64dip"
+        android:gravity="center"
+        android:padding="8dip"
         android:orientation="horizontal">
-    
-        <ImageView android:id="@+id/icon"
+        <ImageView
+            android:id="@+id/icon"
             android:layout_width="@android:dimen/app_icon_size"
             android:layout_height="@android:dimen/app_icon_size"
-            android:layout_marginLeft="5dip"
-            android:layout_marginRight="11dip"
             android:layout_gravity="center_vertical"
-            android:scaleType="fitCenter"/>
-    
+            />
+    </LinearLayout>
+
+    <RelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dip"
+        android:layout_marginBottom="8dip"
+        android:layout_weight="1">
+
         <TextView android:id="@+id/name"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:layout_gravity="center_vertical"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textStyle="bold"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:layout_marginBottom="2dip" />
-            
-        <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
-            android:id="@+id/checkbox" 
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:focusable="false"
-            android:clickable="false" />
-    </LinearLayout>
-    
-    <TextView android:id="@+id/description"
-        android:layout_width="match_parent"
+            android:singleLine="true"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:ellipsize="marquee"
+            android:layout_alignParentTop="true"
+            android:fadingEdge="horizontal" />
+
+        <TextView android:id="@+id/description"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="4dip"
+            android:layout_below="@id/name"
+            android:layout_alignLeft="@id/name"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorSecondary"
+            android:maxLines="4" />
+
+    </RelativeLayout>
+
+    <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/checkbox"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:singleLine="true"
-        android:ellipsize="end" />
-            
+        android:layout_gravity="center_vertical"
+        android:layout_marginRight="16dip"
+        android:layout_marginLeft="16dip"
+        android:focusable="false"
+        android:clickable="false" />
+
 </LinearLayout>
diff --git a/res/layout/device_admin_settings.xml b/res/layout/device_admin_settings.xml
index eaf42fe..669ac3c 100644
--- a/res/layout/device_admin_settings.xml
+++ b/res/layout/device_admin_settings.xml
@@ -18,27 +18,10 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:background="@*android:drawable/title_bar_medium">
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:text="@string/select_device_admin_msg"
-            android:gravity="center"
-            android:textAppearance="?android:attr/textAppearanceLarge"
-            android:textColor="?android:attr/textColorPrimary"
-            android:shadowColor="?android:attr/colorBackground"
-            android:shadowRadius="2" />
-    </LinearLayout>
     <FrameLayout
             android:layout_width="match_parent"
             android:layout_height="0px"
-            android:layout_weight="1"
-            android:paddingTop="10dip"
-            android:paddingBottom="10dip">
+            android:layout_weight="1">
         <ListView android:id="@android:id/list"
                 android:layout_width="match_parent" 
                 android:layout_height="match_parent"
@@ -49,6 +32,6 @@
                 android:layout_height="match_parent"
                 android:gravity="center"
                 android:text="@string/no_device_admins"
-                android:textAppearance="?android:attr/textAppearanceLarge" />
+                android:textAppearance="?android:attr/textAppearanceMedium" />
     </FrameLayout>
 </LinearLayout>
diff --git a/res/layout/preference_bluetooth.xml b/res/layout/preference_bluetooth.xml
index d363dc9..bd437a9 100644
--- a/res/layout/preference_bluetooth.xml
+++ b/res/layout/preference_bluetooth.xml
@@ -31,7 +31,6 @@
         android:id="@+id/divider"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginRight="8dip"
         android:layout_gravity="center_vertical"
         android:src="@drawable/nav_divider"
          />
@@ -42,6 +41,8 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
+        android:padding="8dip"
+        android:background="?android:attr/selectableItemBackground"
         android:src="@drawable/ic_bt_config" />
 
 </LinearLayout>
diff --git a/res/layout/preference_bluetooth_profile.xml b/res/layout/preference_bluetooth_profile.xml
index 03f598a..4b6f1dd 100644
--- a/res/layout/preference_bluetooth_profile.xml
+++ b/res/layout/preference_bluetooth_profile.xml
@@ -24,7 +24,6 @@
         android:id="@+id/divider"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginRight="8dip"
         android:layout_gravity="center_vertical"
         android:src="@drawable/nav_divider"
          />
@@ -35,6 +34,8 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
+        android:padding="8dip"
+        android:background="?android:attr/selectableItemBackground"
         android:src="@drawable/icon" />
 
 </LinearLayout>
diff --git a/res/layout/user_dictionary_item.xml b/res/layout/user_dictionary_item.xml
index 926068f..3cdeb08 100644
--- a/res/layout/user_dictionary_item.xml
+++ b/res/layout/user_dictionary_item.xml
@@ -41,13 +41,10 @@
     <ImageView
             android:id="@+id/delete_button"
             android:layout_width="wrap_content"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
             android:layout_gravity="center"
-            android:paddingLeft="16dip"
-            android:paddingRight="16dip"
-            android:paddingTop="8dip"
-            android:paddingBottom="8dip"
+            android:padding="8dip"
             android:src="@drawable/ic_item_delete"
-            android:background="@android:drawable/list_selector_background"
+            android:background="?android:attr/selectableItemBackground"
         />
 </LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index df11d4f..eed510b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -583,11 +583,17 @@
     <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/values/styles.xml b/res/values/styles.xml
index a49cd0a..eb39aa2 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -50,7 +50,7 @@
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">wrap_content</item>
     </style>
-    
+
     <style name="form_value">
         <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_width">match_parent</item>
@@ -78,7 +78,7 @@
     <style name="TallTitleBarTheme" parent="android:Theme.NoTitleBar">
         <item name="android:windowContentOverlay">@null</item>
     </style>
-    
+
     <style name="Theme.CreateShortCut" parent="android:Theme.Holo.DialogWhenLarge">
     </style>
 
@@ -120,4 +120,30 @@
         <item name="android:windowNoTitle">true</item>
         <item name="android:windowIsFloating">true</item>
     </style>
+
+    <style name="CryptKeeperTheme" parent="@android:style/Theme.Holo.NoActionBar">
+        <item name="android:windowAnimationStyle">@style/CryptKeeperAnimation</item>
+    </style>
+
+    <style name="CryptKeeperBlankTheme" parent="@android:style/Theme.Holo.NoActionBar">
+        <item name="android:background">#ff000000</item>
+    </style>
+
+    <style name="CryptKeeperAnimation">
+        <item name="android:windowExitAnimation">@anim/crypt_keeper_exit</item>
+    </style>
+
+    <style name="SecurityPreferenceButtonContainer" parent="@android:style/Holo.SegmentedButton">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:dividerPadding">8dip</item>
+    </style>
+
+    <style name="SecurityPreferenceButton" parent="@android:style/Widget.Holo.Button.Borderless">
+        <item name="android:layout_width">140dip</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:ellipsize">marquee</item>
+        <item name="android:singleLine">true</item>
+    </style>
+
 </resources>
diff --git a/res/xml/bluetooth_device_advanced.xml b/res/xml/bluetooth_device_advanced.xml
index b4a0978..6610a69 100644
--- a/res/xml/bluetooth_device_advanced.xml
+++ b/res/xml/bluetooth_device_advanced.xml
@@ -28,12 +28,6 @@
             android:order="20"
             android:persistent="false" />
 
-    <CheckBoxPreference
-            android:key="allow_incoming"
-            android:title="@string/bluetooth_device_advanced_enable_opp_title"
-            android:order="30"
-            android:persistent="false" />
-
     <Preference
             android:key="unpair"
             android:title="@string/bluetooth_device_context_unpair"
diff --git a/res/xml/security_settings_encrypted.xml b/res/xml/security_settings_encrypted.xml
new file mode 100644
index 0000000..e82dc56
--- /dev/null
+++ b/res/xml/security_settings_encrypted.xml
@@ -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>
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index e67542b..68ee8c0 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -41,11 +41,8 @@
             android:persistent="false">
         <Preference android:title="@string/manage_device_admin"
                 android:summary="@string/manage_device_admin_summary"
-                android:persistent="false">
-            <intent android:action="android.intent.action.MAIN"
-                    android:targetPackage="com.android.settings"
-                    android:targetClass="com.android.settings.DeviceAdminSettings"/>
-        </Preference>
+                android:persistent="false"
+                android:fragment="com.android.settings.DeviceAdminSettings"/>
     </PreferenceCategory>
 
     <PreferenceCategory android:title="@string/credentials_title"
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/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 3917b76..5afc3f6 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -57,6 +57,9 @@
     private static final int COOL_DOWN_ATTEMPTS = 10;
     private static final int COOL_DOWN_INTERVAL = 30; // 30 seconds
 
+    // This activity is used to fade the screen to black after the password is entered.
+    public static class Blank extends Activity {
+    }
 
     private Handler mHandler = new Handler() {
         @Override
@@ -103,7 +106,6 @@
         }
     };
 
-    private int mFailedAttempts = 0;
     private int mCooldown;
 
     @Override
@@ -143,7 +145,7 @@
         // is encrypted.
 
         PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
-        PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
+        PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG);
 
         wakeLock.acquire();
 
@@ -192,15 +194,20 @@
 
             IMountService service = getMountService();
             try {
-                service.decryptStorage(password);
+                int failedAttempts = service.decryptStorage(password);
 
-                if (mFailedAttempts == 0) {
-                    // Success. Do something here within 2 seconds
-
-                } else if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
+                if (failedAttempts == 0) {
+                    // The password was entered successfully. Start the Blank activity
+                    // so this activity animates to black before the devices starts. Note
+                    // It has 1 second to complete the animation or it will be frozen
+                    // until the boot animation comes back up.
+                    Intent intent = new Intent(this, Blank.class);
+                    finish();
+                    startActivity(intent);
+                } else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
                     // Factory reset the device.
                     sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
-                } else if ((mFailedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
+                } else if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
                     mCooldown = COOL_DOWN_INTERVAL;
                     EditText passwordEntry = (EditText) findViewById(R.id.passwordEntry);
                     passwordEntry.setEnabled(false);
diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java
index 26bd88a..63998e5 100644
--- a/src/com/android/settings/DeviceAdminAdd.java
+++ b/src/com/android/settings/DeviceAdminAdd.java
@@ -64,11 +64,11 @@
     DeviceAdminInfo mDeviceAdmin;
     CharSequence mAddMsgText;
     
-    TextView mTitle;
     ImageView mAdminIcon;
     TextView mAdminName;
     TextView mAdminDescription;
     TextView mAddMsg;
+    ImageView mAddMsgExpander;
     boolean mAddMsgEllipsized = true;
     TextView mAdminWarning;
     ViewGroup mAdminPolicies;
@@ -149,15 +149,15 @@
             }
         }
         mAddMsgText = getIntent().getCharSequenceExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION);
-        
+
         setContentView(R.layout.device_admin_add);
         
-        mTitle = (TextView)findViewById(R.id.title);
         mAdminIcon = (ImageView)findViewById(R.id.admin_icon);
         mAdminName = (TextView)findViewById(R.id.admin_name);
         mAdminDescription = (TextView)findViewById(R.id.admin_description);
 
         mAddMsg = (TextView)findViewById(R.id.add_msg);
+        mAddMsgExpander = (ImageView) findViewById(R.id.add_msg_expander);
         mAddMsg.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 toggleMessageEllipsis(v);
@@ -167,15 +167,15 @@
         // toggleMessageEllipsis also handles initial layout:
         toggleMessageEllipsis(mAddMsg);
 
-        mAdminWarning = (TextView)findViewById(R.id.admin_warning);
-        mAdminPolicies = (ViewGroup)findViewById(R.id.admin_policies);
-        mCancelButton = (Button)findViewById(R.id.cancel_button);
+        mAdminWarning = (TextView) findViewById(R.id.admin_warning);
+        mAdminPolicies = (ViewGroup) findViewById(R.id.admin_policies);
+        mCancelButton = (Button) findViewById(R.id.cancel_button);
         mCancelButton.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 finish();
             }
         });
-        mActionButton = (Button)findViewById(R.id.action_button);
+        mActionButton = (Button) findViewById(R.id.action_button);
         mActionButton.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 if (mAdding) {
@@ -269,6 +269,7 @@
             mAddMsg.setVisibility(View.VISIBLE);
         } else {
             mAddMsg.setVisibility(View.GONE);
+            mAddMsgExpander.setVisibility(View.GONE);
         }
         if (!mRefreshing && mDPM.isAdminActive(mDeviceAdmin.getComponent())) {
             if (mActivePolicies.size() == 0) {
@@ -285,7 +286,7 @@
             setViewVisibility(mAddingPolicies, View.GONE);
             mAdminWarning.setText(getString(R.string.device_admin_status,
                     mDeviceAdmin.getActivityInfo().applicationInfo.loadLabel(getPackageManager())));
-            mTitle.setText(getText(R.string.active_device_admin_msg));
+            setTitle(getText(R.string.active_device_admin_msg));
             mActionButton.setText(getText(R.string.remove_device_admin));
             mAdding = false;
         } else {
@@ -303,7 +304,7 @@
             setViewVisibility(mActivePolicies, View.GONE);
             mAdminWarning.setText(getString(R.string.device_admin_warning,
                     mDeviceAdmin.getActivityInfo().applicationInfo.loadLabel(getPackageManager())));
-            mTitle.setText(getText(R.string.add_device_admin_msg));
+            setTitle(getText(R.string.add_device_admin_msg));
             mActionButton.setText(getText(R.string.add_device_admin));
             mAdding = true;
         }
@@ -317,8 +318,7 @@
         tv.setEllipsize(mAddMsgEllipsized ? TruncateAt.END : null);
         tv.setMaxLines(mAddMsgEllipsized ? getEllipsizedLines() : MAX_ADD_MSG_LINES);
 
-        ImageView iv = (ImageView) findViewById(R.id.add_msg_expander);
-        iv.setImageResource(mAddMsgEllipsized ?
+        mAddMsgExpander.setImageResource(mAddMsgEllipsized ?
             com.android.internal.R.drawable.expander_ic_minimized :
             com.android.internal.R.drawable.expander_ic_maximized);
     }
diff --git a/src/com/android/settings/DeviceAdminSettings.java b/src/com/android/settings/DeviceAdminSettings.java
index c3c74b6..310aae7 100644
--- a/src/com/android/settings/DeviceAdminSettings.java
+++ b/src/com/android/settings/DeviceAdminSettings.java
@@ -16,25 +16,21 @@
 
 package com.android.settings;
 
+import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
 import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ListActivity;
+import android.app.ListFragment;
 import android.app.admin.DeviceAdminInfo;
 import android.app.admin.DeviceAdminReceiver;
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Context;
-import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.res.Resources;
 import android.os.Bundle;
-import android.os.Handler;
-import android.os.RemoteCallback;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -50,7 +46,7 @@
 import java.util.HashSet;
 import java.util.List;
 
-public class DeviceAdminSettings extends ListActivity {
+public class DeviceAdminSettings extends ListFragment {
     static final String TAG = "DeviceAdminSettings";
     
     static final int DIALOG_WARNING = 1;
@@ -58,18 +54,21 @@
     DevicePolicyManager mDPM;
     final HashSet<ComponentName> mActiveAdmins = new HashSet<ComponentName>();
     final ArrayList<DeviceAdminInfo> mAvailableAdmins = new ArrayList<DeviceAdminInfo>();
-    
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
 
-        mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
-        
-        setContentView(R.layout.device_admin_settings);
-    }
-    
     @Override
-    protected void onResume() {
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        mDPM = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
+        return inflater.inflate(R.layout.device_admin_settings, container, false);
+    }
+
+    @Override
+    public void onResume() {
         super.onResume();
         updateList();
     }
@@ -82,16 +81,16 @@
                 mActiveAdmins.add(cur.get(i));
             }
         }
-        
+
         mAvailableAdmins.clear();
-        List<ResolveInfo> avail = getPackageManager().queryBroadcastReceivers(
+        List<ResolveInfo> avail = getActivity().getPackageManager().queryBroadcastReceivers(
                 new Intent(DeviceAdminReceiver.ACTION_DEVICE_ADMIN_ENABLED),
                 PackageManager.GET_META_DATA);
         int count = avail == null ? 0 : avail.size();
         for (int i=0; i<count; i++) {
             ResolveInfo ri = avail.get(i);
             try {
-                DeviceAdminInfo dpi = new DeviceAdminInfo(this, ri);
+                DeviceAdminInfo dpi = new DeviceAdminInfo(getActivity(), ri);
                 if (dpi.isVisible() || mActiveAdmins.contains(dpi.getComponent())) {
                     mAvailableAdmins.add(dpi);
                 }
@@ -104,16 +103,16 @@
         
         getListView().setAdapter(new PolicyListAdapter());
     }
-    
+
     @Override
-    protected void onListItemClick(ListView l, View v, int position, long id) {
+    public void onListItemClick(ListView l, View v, int position, long id) {
         DeviceAdminInfo dpi = (DeviceAdminInfo)l.getAdapter().getItem(position);
         Intent intent = new Intent();
-        intent.setClass(this, DeviceAdminAdd.class);
+        intent.setClass(getActivity(), DeviceAdminAdd.class);
         intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, dpi.getComponent());
         startActivity(intent);
     }
-    
+
     static class ViewHolder {
         ImageView icon;
         TextView name;
@@ -125,7 +124,8 @@
         final LayoutInflater mInflater;
         
         PolicyListAdapter() {
-            mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            mInflater = (LayoutInflater)
+                    getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         }
 
         public boolean hasStableIds() {
@@ -175,13 +175,14 @@
         }
         
         public void bindView(View view, int position) {
+            final Activity activity = getActivity();
             ViewHolder vh = (ViewHolder) view.getTag();
             DeviceAdminInfo item = mAvailableAdmins.get(position);
-            vh.icon.setImageDrawable(item.loadIcon(getPackageManager()));
-            vh.name.setText(item.loadLabel(getPackageManager()));
+            vh.icon.setImageDrawable(item.loadIcon(activity.getPackageManager()));
+            vh.name.setText(item.loadLabel(activity.getPackageManager()));
             vh.checkbox.setChecked(mActiveAdmins.contains(item.getComponent()));
             try {
-                vh.description.setText(item.loadDescription(getPackageManager()));
+                vh.description.setText(item.loadDescription(activity.getPackageManager()));
             } catch (Resources.NotFoundException e) {
             }
         }
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index aaaf265..e413915 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -29,6 +29,7 @@
 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 @@
  */
 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 @@
             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 @@
         }
         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) {
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 1e54504..2532747 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -333,4 +333,5 @@
     public static class AccountSyncSettingsActivity extends Settings { }
     public static class AccountSyncSettingsInAddAccountActivity extends Settings { }
     public static class CryptKeeperSettingsActivity extends Settings { }
+    public static class DeviceAdminSettingsActivity extends Settings { }
 }
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 47e31ee..5fbfe7b 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -21,6 +21,7 @@
 import android.app.DialogFragment;
 import android.app.Fragment;
 import android.content.ContentResolver;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
@@ -78,6 +79,17 @@
         return getActivity().getPackageManager();
     }
 
+    @Override
+    public void onDetach() {
+        if (isRemoving()) {
+            if (mDialogFragment != null) {
+                mDialogFragment.dismiss();
+                mDialogFragment = null;
+            }
+        }
+        super.onDetach();
+    }
+
     // Dialog management
 
     protected void showDialog(int dialogId) {
@@ -100,6 +112,28 @@
         mDialogFragment = null;
     }
 
+    /**
+     * Sets the OnCancelListener of the dialog shown. This method can only be
+     * called after showDialog(int) and before removeDialog(int). The method
+     * does nothing otherwise.
+     */
+    protected void setOnCancelListener(DialogInterface.OnCancelListener listener) {
+        if (mDialogFragment != null) {
+            mDialogFragment.mOnCancelListener = listener;
+        }
+    }
+
+    /**
+     * Sets the OnDismissListener of the dialog shown. This method can only be
+     * called after showDialog(int) and before removeDialog(int). The method
+     * does nothing otherwise.
+     */
+    protected void setOnDismissListener(DialogInterface.OnDismissListener listener) {
+        if (mDialogFragment != null) {
+            mDialogFragment.mOnDismissListener = listener;
+        }
+    }
+
     public static class SettingsDialogFragment extends DialogFragment {
         private static final String KEY_DIALOG_ID = "key_dialog_id";
         private static final String KEY_PARENT_FRAGMENT_ID = "key_parent_fragment_id";
@@ -108,6 +142,9 @@
 
         private Fragment mParentFragment;
 
+        private DialogInterface.OnCancelListener mOnCancelListener;
+        private DialogInterface.OnDismissListener mOnDismissListener;
+
         public SettingsDialogFragment() {
             /* do nothing */
         }
@@ -152,6 +189,21 @@
             return ((DialogCreatable) mParentFragment).onCreateDialog(mDialogId);
         }
 
+        @Override
+        public void onCancel(DialogInterface dialog) {
+            super.onCancel(dialog);
+            if (mOnCancelListener != null) {
+                mOnCancelListener.onCancel(dialog);
+            }
+        }
+
+        @Override
+        public void onDismiss(DialogInterface dialog) {
+            super.onDismiss(dialog);
+            if (mOnDismissListener != null) {
+                mOnDismissListener.onDismiss(dialog);
+            }
+        }
         public int getDialogId() {
             return mDialogId;
         }
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 37efefc..e0233be 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -184,6 +184,8 @@
     static final String TAB_SDCARD = "OnSdCard";
     private View mRootView;
 
+    private boolean mShowBackground = false;
+    
     // -------------- Copied from TabActivity --------------
 
     private TabHost mTabHost;
@@ -539,6 +541,7 @@
             mFilterApps = savedInstanceState.getInt("filterApps", mFilterApps);
             String tmp = savedInstanceState.getString("defaultTabTag");
             if (tmp != null) defaultTabTag = tmp;
+            mShowBackground = savedInstanceState.getBoolean("showBackground", false);
         }
         
         mDefaultTab = defaultTabTag;
@@ -631,6 +634,7 @@
         if (mDefaultTab != null) {
             outState.putString("defautTabTag", mDefaultTab);
         }
+        outState.putBoolean("showBackground", mShowBackground);
     }
 
     @Override
@@ -666,11 +670,13 @@
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         Log.i(TAG, "onCreateOptionsMenu in " + this + ": " + menu);
         mOptionsMenu = menu;
+        // note: icons removed for now because the cause the new action
+        // bar UI to be very confusing.
         menu.add(0, SORT_ORDER_ALPHA, 1, R.string.sort_order_alpha)
-                .setIcon(android.R.drawable.ic_menu_sort_alphabetically)
+                //.setIcon(android.R.drawable.ic_menu_sort_alphabetically)
                 .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
         menu.add(0, SORT_ORDER_SIZE, 2, R.string.sort_order_size)
-                .setIcon(android.R.drawable.ic_menu_sort_by_size)
+                //.setIcon(android.R.drawable.ic_menu_sort_by_size)
                 .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
         menu.add(0, SHOW_RUNNING_SERVICES, 3, R.string.show_running_services)
                 .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
@@ -722,8 +728,10 @@
                 mApplicationsAdapter.rebuild(mFilterApps, mSortOrder);
             }
         } else if (menuId == SHOW_RUNNING_SERVICES) {
+            mShowBackground = false;
             mRunningProcessesView.mAdapter.setShowBackground(false);
         } else if (menuId == SHOW_BACKGROUND_PROCESSES) {
+            mShowBackground = true;
             mRunningProcessesView.mAdapter.setShowBackground(true);
         }
         updateOptionsMenu();
@@ -838,6 +846,7 @@
         } else if (which == VIEW_RUNNING) {
             if (!mCreatedRunning) {
                 mRunningProcessesView.doCreate(null);
+                mRunningProcessesView.mAdapter.setShowBackground(mShowBackground);
                 mCreatedRunning = true;
             }
             boolean haveData = true;
diff --git a/src/com/android/settings/applications/RunningProcessesView.java b/src/com/android/settings/applications/RunningProcessesView.java
index ef5adac..1f91c33 100644
--- a/src/com/android/settings/applications/RunningProcessesView.java
+++ b/src/com/android/settings/applications/RunningProcessesView.java
@@ -431,15 +431,17 @@
 
     // utility method used to start sub activity
     private void startServiceDetailsActivity(RunningState.MergedItem mi) {
-        // start new fragment to display extended information
-        Bundle args = new Bundle();
-        args.putInt(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
-        args.putString(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
-        args.putBoolean(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);
-
-        PreferenceActivity pa = (PreferenceActivity)mOwner.getActivity();
-        pa.startPreferencePanel(RunningServiceDetails.class.getName(), args,
-                R.string.runningservicedetails_settings_title, null, null, 0);
+        if (mOwner != null) {
+            // start new fragment to display extended information
+            Bundle args = new Bundle();
+            args.putInt(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
+            args.putString(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
+            args.putBoolean(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);
+    
+            PreferenceActivity pa = (PreferenceActivity)mOwner.getActivity();
+            pa.startPreferencePanel(RunningServiceDetails.class.getName(), args,
+                    R.string.runningservicedetails_settings_title, null, null, 0);
+        }
     }
     
     public void onMovedToScrapHeap(View view) {
diff --git a/src/com/android/settings/bluetooth/BluetoothProfilePreference.java b/src/com/android/settings/bluetooth/BluetoothProfilePreference.java
index 6be1480..c74012a 100644
--- a/src/com/android/settings/bluetooth/BluetoothProfilePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothProfilePreference.java
@@ -80,9 +80,9 @@
         } else {
             mProfileExpandView.setOnClickListener(this);
             mProfileExpandView.setTag(mProfile);
-
-            mProfileExpandView.setImageResource(mExpanded ? R.drawable.ic_preferences_expanded
-                : R.drawable.ic_preferences_collapsed);
+            mProfileExpandView.setImageResource(mExpanded
+                    ? com.android.internal.R.drawable.expander_open_holo_dark
+                    : com.android.internal.R.drawable.expander_close_holo_dark);
         }
     }
 
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index 479cbe0..f39eabd 100644
--- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
+++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
@@ -58,7 +58,6 @@
     private CachedBluetoothDevice mCachedDevice;
 
     private PreferenceGroup mProfileContainer;
-    private CheckBoxPreference mAllowIncomingPref;
     private EditTextPreference mDeviceNamePref;
     private final HashMap<String,CheckBoxPreference> mAutoConnectPrefs
             = new HashMap<String,CheckBoxPreference>();
@@ -93,17 +92,6 @@
         getPreferenceScreen().setOrderingAsAdded(false);
 
         mProfileContainer = (PreferenceGroup) findPreference(KEY_PROFILE_CONTAINER);
-        mAllowIncomingPref = (CheckBoxPreference) findPreference(KEY_ALLOW_INCOMING);
-
-        // Configure incoming file transfer preference if device supports OPP
-        // or else remove the preference item
-        if (isObjectPushSupported(device)) {
-            mAllowIncomingPref.setChecked(isIncomingFileTransfersAllowed());
-            mAllowIncomingPref.setOnPreferenceChangeListener(this);
-        } else {
-            getPreferenceScreen().removePreference(mAllowIncomingPref);
-            mAllowIncomingPref = null;
-        }
 
         mDeviceNamePref = (EditTextPreference) findPreference(KEY_RENAME_DEVICE);
         mDeviceNamePref.setSummary(mCachedDevice.getName());
@@ -210,9 +198,7 @@
     }
 
     public boolean onPreferenceChange(Preference preference, Object newValue) {
-        if (preference == mAllowIncomingPref) {
-            setIncomingFileTransfersAllowed((Boolean) newValue);
-        } else if (preference == mDeviceNamePref) {
+        if (preference == mDeviceNamePref) {
             mCachedDevice.setName((String) newValue);
         } else if (preference instanceof CheckBoxPreference) {
             boolean autoConnect = (Boolean) newValue;
diff --git a/src/com/android/settings/deviceinfo/Memory.java b/src/com/android/settings/deviceinfo/Memory.java
index c3df2d5..3e0f0a2 100644
--- a/src/com/android/settings/deviceinfo/Memory.java
+++ b/src/com/android/settings/deviceinfo/Memory.java
@@ -311,19 +311,29 @@
                         }})
                     .setNegativeButton(R.string.cancel, null)
                     .setMessage(R.string.dlg_confirm_unmount_text)
-                    .setOnCancelListener(this)
                     .create();
         case DLG_ERROR_UNMOUNT:
                 return new AlertDialog.Builder(getActivity())
             .setTitle(R.string.dlg_error_unmount_title)
             .setNeutralButton(R.string.dlg_ok, null)
             .setMessage(R.string.dlg_error_unmount_text)
-            .setOnCancelListener(this)
             .create();
         }
         return null;
     }
 
+    @Override
+    protected void showDialog(int id) {
+        super.showDialog(id);
+
+        switch (id) {
+        case DLG_CONFIRM_UNMOUNT:
+        case DLG_ERROR_UNMOUNT:
+            setOnCancelListener(this);
+            break;
+        }
+    }
+
     private void doUnmount(boolean force) {
         // Present a toast here
         Toast.makeText(getActivity(), R.string.unmount_inform_text, Toast.LENGTH_SHORT).show();
diff --git a/src/com/android/settings/vpn/VpnSettings.java b/src/com/android/settings/vpn/VpnSettings.java
index 03687f2..1e02d50 100644
--- a/src/com/android/settings/vpn/VpnSettings.java
+++ b/src/com/android/settings/vpn/VpnSettings.java
@@ -239,6 +239,17 @@
     }
 
     @Override
+    protected void showDialog(int dialogId) {
+        super.showDialog(dialogId);
+
+        setOnCancelListener(new DialogInterface.OnCancelListener() {
+            public void onCancel(DialogInterface dialog) {
+                onIdle();
+            }
+        });
+    }
+
+    @Override
     public Dialog onCreateDialog (int id) {
         switch (id) {
             case DIALOG_CONNECT:
@@ -267,27 +278,17 @@
         }
     }
 
-    private class ConnectDialog extends AlertDialog {
-        public ConnectDialog(Context context) {
-            super(context);
-            setTitle(String.format(getString(R.string.vpn_connect_to),
-                    mConnectingActor.getProfile().getName()));
-            setButton(DialogInterface.BUTTON_POSITIVE,
-                    getString(R.string.vpn_connect_button),
-                    VpnSettings.this);
-            setButton(DialogInterface.BUTTON_NEGATIVE,
-                    getString(android.R.string.cancel),
-                    VpnSettings.this);
-            setView(mConnectingActor.createConnectView());
-        }
-        public void onBackPressed() {
-            changeState(mActiveProfile, VpnState.IDLE);
-            super.onBackPressed();
-        }
-    }
-
     private Dialog createConnectDialog() {
-        return new ConnectDialog(getActivity());
+        final Activity activity = getActivity();
+        return new AlertDialog.Builder(activity)
+                .setView(mConnectingActor.createConnectView())
+                .setTitle(String.format(activity.getString(R.string.vpn_connect_to),
+                        mConnectingActor.getProfile().getName()))
+                .setPositiveButton(activity.getString(R.string.vpn_connect_button),
+                        this)
+                .setNegativeButton(activity.getString(android.R.string.cancel),
+                        this)
+                .create();
     }
 
     private Dialog createReconnectDialog(int id) {
@@ -375,11 +376,6 @@
                             public void onClick(DialogInterface dialog, int w) {
                                 onIdle();
                             }
-                        })
-                .setOnCancelListener(new DialogInterface.OnCancelListener() {
-                            public void onCancel(DialogInterface dialog) {
-                                onIdle();
-                            }
                         });
     }
 
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index ccc40fb..2e26eba 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -265,7 +265,15 @@
                 }
                 return true;
             case MENU_ID_ADVANCED:
-                startFragment(this, AdvancedSettings.class.getCanonicalName(), -1, null);
+                if (getActivity() instanceof PreferenceActivity) {
+                    ((PreferenceActivity) getActivity()).startPreferencePanel(
+                            AdvancedSettings.class.getCanonicalName(),
+                            null,
+                            R.string.wifi_advanced_titlebar, null,
+                            this, 0);
+                } else {
+                    startFragment(this, AdvancedSettings.class.getCanonicalName(), -1, null);
+                }
                 return true;
         }
         return super.onOptionsItemSelected(item);