Cleanup of settings menu

- Removed obsolete items
- Rearranged similar items together
- Reduced the depth of menu

Change-Id: I693dbb2b3c8cb244329be965f49ab288b73efa1a
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 61c5d9e..10fa74f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -310,7 +310,7 @@
     <!-- Menu item to open the Settings screen -->
     <string name="menu_preferences">Settings</string>
     <!-- Settings screen, section title -->
-    <string name="pref_content_title">Page content</string>
+    <string name="pref_content_title">Content settings</string>
     <!-- Settings label [CHAR LIMIT=45]-->
     <string name="pref_allow_apptabs">Allow multiple tabs per app</string>
     <!-- Settings label -->
@@ -440,8 +440,16 @@
 
     <!-- Settings screen, section title [CHAR-LIMIT=50] -->
     <string name="pref_privacy_security_title">Privacy &amp; security</string>
+    <!-- Popup dialog -->
+    <string name="pref_select_items">Select items to be cleared</string>
     <!-- Settings label -->
-    <string name="pref_privacy_clear_cache">Clear cache</string>
+    <string name="pref_privacy_clear_selected">Clear selected items</string>
+    <!-- Settings summary -->
+    <string name="pref_privacy_clear_selected_summary">Clear selected items in the list</string>
+    <!-- Confirmation dialog message -->
+    <string name="pref_privacy_clear_selected_dlg">Clear following items?</string>
+    <!-- Settings label -->
+    <string name="pref_privacy_clear_cache">Cache</string>
     <!-- Settings summary -->
     <string name="pref_privacy_clear_cache_summary">Clear locally cached content and databases</string>
     <!-- Confirmation dialog message -->
@@ -449,13 +457,13 @@
     <!-- Cookie settings category [CHAR-LIMIT=50] -->
     <string name="pref_privacy_cookies_title">Cookies</string>
     <!-- Settings label -->
-    <string name="pref_privacy_clear_cookies">Clear all cookie data</string>
+    <string name="pref_privacy_clear_cookies">Cookies</string>
     <!-- Settings summary -->
     <string name="pref_privacy_clear_cookies_summary">Clear all browser cookies</string>
     <!-- Confirmation dialog message -->
     <string name="pref_privacy_clear_cookies_dlg">Delete all cookies?</string>
     <!-- Settings label -->
-    <string name="pref_privacy_clear_history">Clear history</string>
+    <string name="pref_privacy_clear_history">History</string>
     <!-- Settings summary -->
     <string name="pref_privacy_clear_history_summary">Clear the browser navigation history</string>
     <!-- Confirmation dialog message -->
@@ -463,13 +471,13 @@
     <!-- Formdata settings category [CHAR-LIMIT=50] -->
     <string name="pref_privacy_formdata_title">Form data</string>
     <!-- Settings label -->
-    <string name="pref_privacy_clear_form_data">Clear form data</string>
+    <string name="pref_privacy_clear_form_data">Form data</string>
     <!-- Settings summary -->
     <string name="pref_privacy_clear_form_data_summary">Clear all saved form data</string>
     <!-- Confirmation dialog message -->
     <string name="pref_privacy_clear_form_data_dlg">Delete all saved form data?</string>
     <!-- Settings label -->
-    <string name="pref_privacy_clear_passwords">Clear passwords</string>
+    <string name="pref_privacy_clear_passwords">Passwords</string>
     <!-- Settings summary -->
     <string name="pref_privacy_clear_passwords_summary">Clear all saved passwords</string>
     <!-- Confirmation dialog message -->
@@ -481,7 +489,7 @@
     <!-- Settings summary -->
     <string name="pref_privacy_enable_geolocation_summary">Allow sites to request access to your location</string>
     <!-- Settings label -->
-    <string name="pref_privacy_clear_geolocation_access">Clear location access</string>
+    <string name="pref_privacy_clear_geolocation_access">Location access</string>
     <!-- Settings summary -->
     <string name="pref_privacy_clear_geolocation_access_summary">Clear location access for all websites</string>
     <!-- Confirmation dialog message -->
diff --git a/res/xml-sw600dp/advanced_preferences.xml b/res/xml-sw600dp/advanced_preferences.xml
deleted file mode 100644
index c8c9300..0000000
--- a/res/xml-sw600dp/advanced_preferences.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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">
-
-    <!-- Entries and values in this list are set dynamically. -->
-    <com.android.browser.search.SearchEnginePreference
-            android:key="search_engine"
-            android:title="@string/pref_content_search_engine"
-            android:defaultValue="google"
-            android:summary="@string/pref_content_search_engine_summary"
-            android:dialogTitle="@string/pref_content_search_engine" />
-
-    <CheckBoxPreference
-            android:key="open_in_background"
-            android:defaultValue="false"
-            android:title="@string/pref_content_open_in_background"
-            android:summary="@string/pref_content_open_in_background_summary" />
-
-    <CheckBoxPreference
-            android:key="enable_javascript"
-            android:defaultValue="true"
-            android:title="@string/pref_content_javascript" />
-
-    <CheckBoxPreference
-            android:key="enable_memory_monitor"
-            android:defaultValue="true"
-            android:title="@string/pref_memory_monitor" />
-
-    <CheckBoxPreference
-            android:key="allow_media_downloads"
-            android:defaultValue="false"
-            android:title="@string/pref_allow_media_downloads" />
-
-    <PreferenceScreen
-            android:key="website_settings"
-            android:title="@string/pref_extras_website_settings"
-            android:summary="@string/pref_extras_website_settings_summary" />
-
-    <PreferenceCategory android:title="@string/pref_content_title">
-
-        <ListPreference
-                android:key="default_zoom"
-                android:title="@string/pref_default_zoom"
-                android:defaultValue="MEDIUM"
-                android:entries="@array/pref_default_zoom_choices"
-                android:entryValues="@array/pref_default_zoom_values"
-                android:dialogTitle="@string/pref_default_zoom_dialogtitle" />
-
-        <CheckBoxPreference
-                android:key="load_page"
-                android:defaultValue="true"
-                android:title="@string/pref_content_load_page"
-                android:summary="@string/pref_content_load_page_summary" />
-
-        <CheckBoxPreference
-                android:key="autofit_pages"
-                android:defaultValue="true"
-                android:title="@string/pref_content_autofit"
-                android:summary="@string/pref_content_autofit_summary" />
-
-        <CheckBoxPreference
-                android:key="block_popup_windows"
-                android:defaultValue="true"
-                android:title="@string/pref_content_block_popups" />
-
-        <ListPreference
-                android:key="default_text_encoding"
-                android:title="@string/pref_default_text_encoding"
-                android:defaultValue="@string/pref_default_text_encoding_default"
-                android:entries="@array/pref_default_text_encoding_choices"
-                android:entryValues="@array/pref_default_text_encoding_values"
-                android:dialogTitle="@string/pref_default_text_encoding_dialogtitle" />
-
-    </PreferenceCategory>
-
-    <PreferenceCategory android:title="@string/pref_extras_reset_default_title">
-        <com.android.browser.BrowserYesNoPreference
-                android:key="reset_default_preferences"
-                android:title="@string/pref_extras_reset_default"
-                android:summary="@string/pref_extras_reset_default_summary"
-                android:dialogMessage="@string/pref_extras_reset_default_dlg"
-                android:dialogIcon="@android:drawable/ic_dialog_alert" />
-    </PreferenceCategory>
-
-</PreferenceScreen>
diff --git a/res/xml-sw600dp/lab_preferences.xml b/res/xml-sw600dp/lab_preferences.xml
deleted file mode 100644
index 541f0cb..0000000
--- a/res/xml-sw600dp/lab_preferences.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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" >
-</PreferenceScreen>
diff --git a/res/xml/accessibility_preferences.xml b/res/xml/accessibility_preferences.xml
deleted file mode 100644
index 05403eb..0000000
--- a/res/xml/accessibility_preferences.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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">
-
-    <CheckBoxPreference android:key="force_userscalable"
-        android:title="@string/pref_force_userscalable"
-        android:summary="@string/pref_force_userscalable_summary"
-        android:defaultValue="false" />
-
-    <PreferenceCategory android:title="@string/pref_font_size_category">
-        <com.android.browser.preferences.FontSizePreview
-            android:title="@string/preview" />
-        <com.android.browser.preferences.SeekBarSummaryPreference
-            android:key="text_zoom"
-            android:title="@string/pref_text_zoom"
-            android:defaultValue="10"
-            android:max="30" />
-
-        <!-- SWE - remove double tap zoom from settings.
-        <com.android.browser.preferences.SeekBarSummaryPreference
-            android:key="double_tap_zoom"
-            android:title="@string/pref_zoom_on_double_tap"
-            android:defaultValue="5"
-            android:max="10" />
-        -->
-        <com.android.browser.preferences.SeekBarSummaryPreference
-            android:key="min_font_size"
-            android:title="@string/pref_min_font_size"
-            android:defaultValue="0"
-            android:max="20" />
-    </PreferenceCategory>
-
-    <!-- // SWE_TODO: Commenting out inverted rendering settings
-    <PreferenceCategory android:title="@string/pref_inverted_category">
-
-        <com.android.browser.preferences.InvertedContrastPreview
-            android:title="@string/preview" />
-
-        <CheckBoxPreference
-            android:key="inverted"
-            android:defaultValue="false"
-            android:title="@string/pref_inverted"
-            android:summary="@string/pref_inverted_summary" />
-
-        <com.android.browser.preferences.SeekBarSummaryPreference
-            android:key="inverted_contrast"
-            android:title="@string/pref_inverted_contrast"
-            android:dependency="inverted"
-            android:defaultValue="0"
-            android:max="20" />
-    </PreferenceCategory>
-    -->
-
-</PreferenceScreen>
diff --git a/res/xml/advanced_preferences.xml b/res/xml/advanced_preferences.xml
deleted file mode 100644
index 35168a6..0000000
--- a/res/xml/advanced_preferences.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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">
-
-    <!-- Entries and values in this list are set dynamically. -->
-    <com.android.browser.search.SearchEnginePreference
-            android:key="search_engine"
-            android:title="@string/pref_content_search_engine"
-            android:defaultValue="google"
-            android:summary="@string/pref_content_search_engine_summary"
-            android:dialogTitle="@string/pref_content_search_engine" />
-
-    <CheckBoxPreference
-            android:key="open_in_background"
-            android:defaultValue="false"
-            android:title="@string/pref_content_open_in_background"
-            android:summary="@string/pref_content_open_in_background_summary" />
-
-    <CheckBoxPreference
-            android:key="enable_javascript"
-            android:defaultValue="true"
-            android:title="@string/pref_content_javascript" />
-
-    <CheckBoxPreference
-            android:key="enable_memory_monitor"
-            android:defaultValue="true"
-            android:title="@string/pref_memory_monitor" />
-
-    <CheckBoxPreference
-            android:key="allow_media_downloads"
-            android:title="@string/pref_allow_media_downloads" />
-
-    <CheckBoxPreference
-            android:key="allow_apptabs"
-            android:defaultValue="false"
-            android:title="@string/pref_allow_apptabs" />
-
-    <PreferenceScreen
-            android:key="website_settings"
-            android:title="@string/pref_extras_website_settings"
-            android:summary="@string/pref_extras_website_settings_summary" />
-
-    <PreferenceCategory android:title="@string/pref_content_title">
-
-        <ListPreference
-                android:key="default_zoom"
-                android:title="@string/pref_default_zoom"
-                android:defaultValue="MEDIUM"
-                android:entries="@array/pref_default_zoom_choices"
-                android:entryValues="@array/pref_default_zoom_values"
-                android:dialogTitle="@string/pref_default_zoom_dialogtitle" />
-
-        <CheckBoxPreference
-                android:key="load_page"
-                android:defaultValue="true"
-                android:title="@string/pref_content_load_page"
-                android:summary="@string/pref_content_load_page_summary" />
-
-        <CheckBoxPreference
-                android:key="autofit_pages"
-                android:defaultValue="true"
-                android:title="@string/pref_content_autofit"
-                android:summary="@string/pref_content_autofit_summary" />
-
-        <CheckBoxPreference
-                android:key="block_popup_windows"
-                android:defaultValue="true"
-                android:title="@string/pref_content_block_popups" />
-
-        <ListPreference
-                android:key="default_text_encoding"
-                android:title="@string/pref_default_text_encoding"
-                android:defaultValue="@string/pref_default_text_encoding_default"
-                android:entries="@array/pref_default_text_encoding_choices"
-                android:entryValues="@array/pref_default_text_encoding_values"
-                android:dialogTitle="@string/pref_default_text_encoding_dialogtitle" />
-
-    </PreferenceCategory>
-
-    <PreferenceCategory android:title="@string/pref_extras_reset_default_title">
-        <com.android.browser.BrowserYesNoPreference
-                android:key="reset_default_preferences"
-                android:title="@string/pref_extras_reset_default"
-                android:summary="@string/pref_extras_reset_default_summary"
-                android:dialogMessage="@string/pref_extras_reset_default_dlg"
-                android:dialogIcon="@android:drawable/ic_dialog_alert" />
-    </PreferenceCategory>
-
-</PreferenceScreen>
diff --git a/res/xml/general_preferences.xml b/res/xml/general_preferences.xml
index 6f42d3d..b965ae6 100644
--- a/res/xml/general_preferences.xml
+++ b/res/xml/general_preferences.xml
@@ -16,24 +16,224 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <com.android.browser.preferences.NonformattingListPreference
-        android:key="homepage_picker"
-        android:entries="@array/pref_homepage_choices"
-        android:entryValues="@array/pref_homepage_values"
-        android:title="@string/pref_content_homepage" />
+    <PreferenceCategory android:title="@string/pref_general_title">
+        <com.android.browser.preferences.NonformattingListPreference
+            android:key="homepage_picker"
+            android:entries="@array/pref_homepage_choices"
+            android:entryValues="@array/pref_homepage_values"
+            android:title="@string/pref_content_homepage" />
 
-    <PreferenceCategory android:title="@string/pref_general_autofill_title">
-        <CheckBoxPreference android:key="autofill_enabled"
+        <com.android.browser.search.SearchEnginePreference
+            android:defaultValue="google"
+            android:dialogTitle="@string/pref_content_search_engine"
+            android:key="search_engine"
+            android:summary="@string/pref_content_search_engine_summary"
+            android:title="@string/pref_content_search_engine" />
+
+        <CheckBoxPreference
+            android:defaultValue="false"
+            android:key="fullscreen"
+            android:summary="@string/pref_lab_fullscreen_summary"
+            android:title="@string/pref_lab_fullscreen" />
+
+        <CheckBoxPreference
+            android:key="autofill_enabled"
             android:title="@string/pref_autofill_enabled"
             android:summary="@string/pref_autofill_enabled_summary"
-            android:defaultValue="true"
-        />
+            android:defaultValue="true" />
 
         <PreferenceScreen
-            android:fragment="com.android.browser.AutoFillSettingsFragment"
             android:key="autofill_profile"
             android:title="@string/pref_autofill_profile_editor"
             android:summary="@string/pref_autofill_profile_editor_summary" />
     </PreferenceCategory>
 
+    <PreferenceCategory android:title="@string/pref_extras_title"
+        android:key="advanced">
+
+        <PreferenceScreen android:title="@string/pref_privacy_security_title">
+            <PreferenceScreen android:title="@string/webstorage_clear_data_title">
+                <com.android.browser.BrowserYesNoPreference
+                    android:dialogIcon="@android:drawable/ic_dialog_alert"
+                    android:dialogMessage="@string/pref_privacy_clear_selected_dlg"
+                    android:key="privacy_clear_selected"
+                    android:summary="@string/pref_privacy_clear_selected_summary"
+                    android:title="@string/pref_privacy_clear_selected" />
+
+                <CheckBoxPreference
+                    android:defaultValue="true"
+                    android:key="privacy_clear_history"
+                    android:summary="@string/pref_privacy_clear_history_summary"
+                    android:title="@string/pref_privacy_clear_history" />
+
+                <CheckBoxPreference
+                    android:defaultValue="true"
+                    android:key="privacy_clear_cache"
+                    android:summary="@string/pref_privacy_clear_cache_summary"
+                    android:title="@string/pref_privacy_clear_cache" />
+
+                <CheckBoxPreference
+                    android:defaultValue="true"
+                    android:key="privacy_clear_cookies"
+                    android:summary="@string/pref_privacy_clear_cookies_summary"
+                    android:title="@string/pref_privacy_clear_cookies" />
+
+                <CheckBoxPreference
+                    android:defaultValue="true"
+                    android:key="privacy_clear_form_data"
+                    android:summary="@string/pref_privacy_clear_form_data_summary"
+                    android:title="@string/pref_privacy_clear_form_data" />
+
+                <CheckBoxPreference
+                    android:defaultValue="true"
+                    android:key="privacy_clear_passwords"
+                    android:summary="@string/pref_privacy_clear_passwords_summary"
+                    android:title="@string/pref_privacy_clear_passwords" />
+
+                <CheckBoxPreference
+                    android:defaultValue="true"
+                    android:dependency="enable_geolocation"
+                    android:key="privacy_clear_geolocation_access"
+                    android:summary="@string/pref_privacy_clear_geolocation_access_summary"
+                    android:title="@string/pref_privacy_clear_geolocation_access" />
+
+            </PreferenceScreen>
+
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="show_security_warnings"
+                android:summary="@string/pref_security_show_security_warning_summary"
+                android:title="@string/pref_security_show_security_warning" />
+
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="do_not_track"
+                android:summary="@string/pref_do_not_track_summary"
+                android:title="@string/pref_do_not_track" />
+
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="accept_cookies"
+                android:summary="@string/pref_security_accept_cookies_summary"
+                android:title="@string/pref_security_accept_cookies" />
+
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="save_formdata"
+                android:summary="@string/pref_security_save_form_data_summary"
+                android:title="@string/pref_security_save_form_data" />
+
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="enable_geolocation"
+                android:summary="@string/pref_privacy_enable_geolocation_summary"
+                android:title="@string/pref_privacy_enable_geolocation" />
+
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="remember_passwords"
+                android:summary="@string/pref_security_remember_passwords_summary"
+                android:title="@string/pref_security_remember_passwords" />
+
+        </PreferenceScreen>
+
+        <PreferenceScreen android:title="@string/pref_accessibility_title">
+
+            <PreferenceCategory android:title="@string/pref_font_size_category">
+                <com.android.browser.preferences.FontSizePreview android:title="@string/preview" />
+                <com.android.browser.preferences.SeekBarSummaryPreference
+                    android:defaultValue="10"
+                    android:key="text_zoom"
+                    android:max="30"
+                    android:title="@string/pref_text_zoom" />
+
+                <com.android.browser.preferences.SeekBarSummaryPreference
+                    android:defaultValue="0"
+                    android:key="min_font_size"
+                    android:max="20"
+                    android:title="@string/pref_min_font_size" />
+
+                <CheckBoxPreference
+                    android:defaultValue="false"
+                    android:key="force_userscalable"
+                    android:summary="@string/pref_force_userscalable_summary"
+                    android:title="@string/pref_force_userscalable" />
+
+                <ListPreference
+                    android:defaultValue="MEDIUM"
+                    android:dialogTitle="@string/pref_default_zoom_dialogtitle"
+                    android:entries="@array/pref_default_zoom_choices"
+                    android:entryValues="@array/pref_default_zoom_values"
+                    android:key="default_zoom"
+                    android:title="@string/pref_default_zoom" />
+
+            </PreferenceCategory>
+
+            <!-- // SWE_TODO: Commenting out inverted rendering settings
+            <PreferenceCategory android:title="@string/pref_inverted_category">
+
+                <com.android.browser.preferences.InvertedContrastPreview
+                    android:title="@string/preview" />
+
+                <CheckBoxPreference
+                    android:key="inverted"
+                    android:defaultValue="false"
+                    android:title="@string/pref_inverted"
+                    android:summary="@string/pref_inverted_summary" />
+
+                <com.android.browser.preferences.SeekBarSummaryPreference
+                    android:key="inverted_contrast"
+                    android:title="@string/pref_inverted_contrast"
+                    android:dependency="inverted"
+                    android:defaultValue="0"
+                    android:max="20" />
+            </PreferenceCategory>
+            -->
+
+        </PreferenceScreen>
+
+
+        <PreferenceScreen android:title="@string/pref_content_title">
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="block_popup_windows"
+                android:title="@string/pref_content_block_popups" />
+
+            <CheckBoxPreference
+                android:defaultValue="false"
+                android:key="open_in_background"
+                android:summary="@string/pref_content_open_in_background_summary"
+                android:title="@string/pref_content_open_in_background" />
+
+            <CheckBoxPreference
+                android:defaultValue="true"
+                android:key="enable_javascript"
+                android:title="@string/pref_content_javascript" />
+
+            <CheckBoxPreference
+                android:key="allow_media_downloads"
+                android:title="@string/pref_allow_media_downloads" />
+
+            <PreferenceScreen
+                android:key="download_path_setting_screen"
+                android:title="@string/pref_download_path_setting_screen_title"/>
+        </PreferenceScreen>
+
+
+        <PreferenceScreen
+            android:key="website_settings"
+            android:summary="@string/pref_extras_website_settings_summary"
+            android:title="@string/pref_extras_website_settings" />
+
+        <com.android.browser.BrowserYesNoPreference
+            android:key="reset_default_preferences"
+            android:title="@string/pref_extras_reset_default"
+            android:summary="@string/pref_extras_reset_default_summary"
+            android:dialogMessage="@string/pref_extras_reset_default_dlg"
+            android:dialogIcon="@android:drawable/ic_dialog_alert" />
+
+        <PreferenceScreen
+            android:key="debug_menu"
+            android:title="@string/pref_development_title" />
+    </PreferenceCategory>
 </PreferenceScreen>
diff --git a/res/xml/lab_preferences.xml b/res/xml/lab_preferences.xml
deleted file mode 100644
index 6912e7d..0000000
--- a/res/xml/lab_preferences.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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" >
-    <CheckBoxPreference
-        android:key="fullscreen"
-        android:defaultValue="false"
-        android:title="@string/pref_lab_fullscreen"
-        android:summary="@string/pref_lab_fullscreen_summary" />
-</PreferenceScreen>
diff --git a/res/xml/preference_headers.xml b/res/xml/preference_headers.xml
deleted file mode 100644
index 76483d1..0000000
--- a/res/xml/preference_headers.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <header android:fragment="com.android.browser.preferences.GeneralPreferencesFragment"
-        android:title="@string/pref_general_title"
-    />
-
-    <header android:fragment="com.android.browser.preferences.PrivacySecurityPreferencesFragment"
-        android:title="@string/pref_privacy_security_title"
-    />
-
-    <header android:fragment="com.android.browser.preferences.AccessibilityPreferencesFragment"
-        android:title="@string/pref_accessibility_title"
-    />
-
-    <header android:fragment="com.android.browser.preferences.AdvancedPreferencesFragment"
-        android:title="@string/pref_extras_title"
-    />
-
-    <header android:fragment="com.android.browser.preferences.BandwidthPreferencesFragment"
-        android:title="@string/pref_data_title"
-    />
-
-    <header android:fragment="com.android.browser.preferences.LabPreferencesFragment"
-        android:title="@string/pref_lab_title"
-    />
-
-    <header android:fragment="com.android.browser.preferences.AboutPreferencesFragment"
-        android:title="@string/version"
-    />
-
-</preference-headers>
diff --git a/res/xml/privacy_security_preferences.xml b/res/xml/privacy_security_preferences.xml
deleted file mode 100644
index 4c14c86..0000000
--- a/res/xml/privacy_security_preferences.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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">
-
-    <com.android.browser.BrowserYesNoPreference
-            android:key="privacy_clear_cache"
-            android:title="@string/pref_privacy_clear_cache"
-            android:summary="@string/pref_privacy_clear_cache_summary"
-            android:dialogMessage="@string/pref_privacy_clear_cache_dlg"
-            android:dialogIcon="@android:drawable/ic_dialog_alert" />
-
-    <com.android.browser.BrowserYesNoPreference
-            android:key="privacy_clear_history"
-            android:title="@string/pref_privacy_clear_history"
-            android:summary="@string/pref_privacy_clear_history_summary"
-            android:dialogMessage="@string/pref_privacy_clear_history_dlg"
-            android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-
-    <CheckBoxPreference
-            android:key="show_security_warnings"
-            android:defaultValue="true"
-            android:title="@string/pref_security_show_security_warning"
-            android:summary="@string/pref_security_show_security_warning_summary" />
-
-  <CheckBoxPreference
-            android:key="do_not_track"
-            android:defaultValue="true"
-            android:title="@string/pref_do_not_track"
-            android:summary="@string/pref_do_not_track_summary" />
-
-    <PreferenceCategory android:title="@string/pref_privacy_cookies_title">
-        <CheckBoxPreference
-                android:key="accept_cookies"
-                android:defaultValue="true"
-                android:title="@string/pref_security_accept_cookies"
-                android:summary="@string/pref_security_accept_cookies_summary" />
-
-        <com.android.browser.BrowserYesNoPreference
-                android:key="privacy_clear_cookies"
-                android:title="@string/pref_privacy_clear_cookies"
-                android:summary="@string/pref_privacy_clear_cookies_summary"
-                android:dialogMessage="@string/pref_privacy_clear_cookies_dlg"
-                android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-    </PreferenceCategory>
-
-    <PreferenceCategory android:title="@string/pref_privacy_formdata_title">
-        <CheckBoxPreference
-                android:key="save_formdata"
-                android:defaultValue="true"
-                android:title="@string/pref_security_save_form_data"
-                android:summary="@string/pref_security_save_form_data_summary" />
-
-        <com.android.browser.BrowserYesNoPreference
-                android:key="privacy_clear_form_data"
-                android:title="@string/pref_privacy_clear_form_data"
-                android:summary="@string/pref_privacy_clear_form_data_summary"
-                android:dialogMessage="@string/pref_privacy_clear_form_data_dlg"
-                android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-    </PreferenceCategory>
-
-    <PreferenceCategory android:title="@string/pref_privacy_location_title">
-        <CheckBoxPreference
-                android:key="enable_geolocation"
-                android:defaultValue="true"
-                android:title="@string/pref_privacy_enable_geolocation"
-                android:summary="@string/pref_privacy_enable_geolocation_summary" />
-
-        <com.android.browser.BrowserYesNoPreference
-                android:key="privacy_clear_geolocation_access"
-                android:dependency="enable_geolocation"
-                android:title="@string/pref_privacy_clear_geolocation_access"
-                android:summary="@string/pref_privacy_clear_geolocation_access_summary"
-                android:dialogMessage="@string/pref_privacy_clear_geolocation_access_dlg"
-                android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-    </PreferenceCategory>
-
-    <PreferenceCategory android:title="@string/pref_security_passwords_title">
-        <CheckBoxPreference
-                android:key="remember_passwords"
-                android:defaultValue="true"
-                android:title="@string/pref_security_remember_passwords"
-                android:summary="@string/pref_security_remember_passwords_summary" />
-
-        <com.android.browser.BrowserYesNoPreference
-                android:key="privacy_clear_passwords"
-                android:title="@string/pref_privacy_clear_passwords"
-                android:summary="@string/pref_privacy_clear_passwords_summary"
-                android:dialogMessage="@string/pref_privacy_clear_passwords_dlg"
-                android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-    </PreferenceCategory>
-
-</PreferenceScreen>
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index 353a472..3765452 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -16,108 +16,20 @@
 
 package com.android.browser;
 
-import android.app.ActionBar;
-import android.content.Intent;
+import android.app.Activity;
 import android.os.Bundle;
-import android.preference.PreferenceActivity;
-import android.view.MenuItem;
 
-import com.android.browser.R;
-import com.android.browser.preferences.BandwidthPreferencesFragment;
-import com.android.browser.preferences.DebugPreferencesFragment;
+import com.android.browser.preferences.GeneralPreferencesFragment;
 
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class BrowserPreferencesPage extends PreferenceActivity {
+public class BrowserPreferencesPage extends Activity {
 
     public static final String CURRENT_PAGE = "currentPage";
-    private List<Header> mHeaders;
 
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
-        ActionBar actionBar = getActionBar();
-        if (actionBar != null) {
-            actionBar.setDisplayOptions(
-                    ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
-        }
+        getFragmentManager().beginTransaction().replace(android.R.id.content,
+                new GeneralPreferencesFragment()).commit();
     }
-
-    /**
-     * Populate the activity with the top-level headers.
-     */
-    @Override
-    public void onBuildHeaders(List<Header> target) {
-        loadHeadersFromResource(R.xml.preference_headers, target);
-
-        if (BrowserSettings.getInstance().isDebugEnabled()) {
-            Header debug = new Header();
-            debug.title = getText(R.string.pref_development_title);
-            debug.fragment = DebugPreferencesFragment.class.getName();
-            target.add(debug);
-        }
-        mHeaders = target;
-    }
-
-    @Override
-    public Header onGetInitialHeader() {
-        String action = getIntent().getAction();
-        if (Intent.ACTION_MANAGE_NETWORK_USAGE.equals(action)) {
-            String fragName = BandwidthPreferencesFragment.class.getName();
-            for (Header h : mHeaders) {
-                if (fragName.equals(h.fragment)) {
-                    return h;
-                }
-            }
-        }
-        return super.onGetInitialHeader();
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case android.R.id.home:
-                if (getFragmentManager().getBackStackEntryCount() > 0) {
-                    getFragmentManager().popBackStack();
-                } else {
-                    finish();
-                }
-                return true;
-        }
-
-        return false;
-    }
-
-    @Override
-    public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args,
-            int titleRes, int shortTitleRes) {
-        Intent intent = super.onBuildStartFragmentIntent(fragmentName, args,
-                titleRes, shortTitleRes);
-        String url = getIntent().getStringExtra(CURRENT_PAGE);
-        intent.putExtra(CURRENT_PAGE, url);
-        return intent;
-    }
-
-    private static final Set<String> sKnownFragments = new HashSet<String>(Arrays.asList(
-        "com.android.browser.preferences.GeneralPreferencesFragment",
-        "com.android.browser.preferences.PrivacySecurityPreferencesFragment",
-        "com.android.browser.preferences.AccessibilityPreferencesFragment",
-        "com.android.browser.preferences.AdvancedPreferencesFragment",
-        "com.android.browser.preferences.BandwidthPreferencesFragment",
-        "com.android.browser.preferences.LabPreferencesFragment",
-        "com.android.browser.preferences.AboutPreferencesFragment",
-        "com.android.browser.AutoFillSettingsFragment",
-        "com.android.browser.preferences.DebugPreferencesFragment",
-        "com.android.browser.preferences.WebsiteSettingsFragment"));
-
-    @Override
-    protected boolean isValidFragment(String fragmentName) {
-        return sKnownFragments.contains(fragmentName);
-    }
-
-
 }
diff --git a/src/com/android/browser/BrowserYesNoPreference.java b/src/com/android/browser/BrowserYesNoPreference.java
index e8d6af9..966d968 100644
--- a/src/com/android/browser/BrowserYesNoPreference.java
+++ b/src/com/android/browser/BrowserYesNoPreference.java
@@ -16,16 +16,73 @@
 
 package com.android.browser;
 
+import android.app.Activity;
 import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
 import android.preference.DialogPreference;
+import android.preference.PreferenceManager;
 import android.util.AttributeSet;
 import android.util.Log;
+import android.view.View;
 
 class BrowserYesNoPreference extends DialogPreference {
+    private SharedPreferences mPrefs;
+    private Context mContext;
 
     // This is the constructor called by the inflater
     public BrowserYesNoPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
+        mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+        mContext = context;
+    }
+
+    @Override
+    protected View onCreateDialogView() {
+        if (PreferenceKeys.PREF_CLEAR_SELECTED_DATA.equals(getKey())) {
+            String dialogMessage = mContext.getString(R.string.pref_privacy_clear_selected_dlg);
+            boolean itemSelected = false;
+
+            if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_CACHE, false)) {
+                dialogMessage = dialogMessage.concat("\n\t" +
+                        mContext.getString(R.string.pref_privacy_clear_cache));
+                itemSelected = true;
+            }
+            if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_COOKIES, false)) {
+                dialogMessage = dialogMessage.concat("\n\t" +
+                        mContext.getString(R.string.pref_privacy_clear_cookies));
+                itemSelected = true;
+            }
+            if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY, false)) {
+                dialogMessage = dialogMessage.concat("\n\t" +
+                        mContext.getString(R.string.pref_privacy_clear_history));
+                itemSelected = true;
+            }
+            if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_FORM_DATA, false)) {
+                dialogMessage = dialogMessage.concat("\n\t" +
+                        mContext.getString(R.string.pref_privacy_clear_form_data));
+                itemSelected = true;
+            }
+            if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_PASSWORDS, false)) {
+                dialogMessage = dialogMessage.concat("\n\t" +
+                        mContext.getString(R.string.pref_privacy_clear_passwords));
+                itemSelected = true;
+            }
+            if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_GEOLOCATION_ACCESS,
+                    false)) {
+                dialogMessage = dialogMessage.concat("\n\t" +
+                        mContext.getString(R.string.pref_privacy_clear_geolocation_access));
+                itemSelected = true;
+            }
+
+            if (!itemSelected) {
+                setDialogMessage(R.string.pref_select_items);
+            } else {
+                setDialogMessage(dialogMessage);
+            }
+        }
+
+        return super.onCreateDialogView();
     }
 
     @Override
@@ -37,24 +94,33 @@
                 return;
             setEnabled(false);
             BrowserSettings settings = BrowserSettings.getInstance();
-            if (PreferenceKeys.PREF_PRIVACY_CLEAR_CACHE.equals(getKey())) {
-                settings.clearCache();
-                settings.clearDatabases();
-            } else if (PreferenceKeys.PREF_PRIVACY_CLEAR_COOKIES.equals(getKey())) {
-                settings.clearCookies();
-            } else if (PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY.equals(getKey())) {
-                settings.clearHistory();
-            } else if (PreferenceKeys.PREF_PRIVACY_CLEAR_FORM_DATA.equals(getKey())) {
-                settings.clearFormData();
-            } else if (PreferenceKeys.PREF_PRIVACY_CLEAR_PASSWORDS.equals(getKey())) {
-                settings.clearPasswords();
+            if (PreferenceKeys.PREF_CLEAR_SELECTED_DATA.equals(getKey())) {
+                if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_CACHE, false)) {
+                    settings.clearCache();
+                    settings.clearDatabases();
+                }
+                if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_COOKIES, false)) {
+                    settings.clearCookies();
+                }
+                if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY, false)) {
+                    settings.clearHistory();
+                }
+                if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_FORM_DATA, false)) {
+                    settings.clearFormData();
+                }
+                if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_PASSWORDS, false)) {
+                    settings.clearPasswords();
+                }
+                if (mPrefs.getBoolean(PreferenceKeys.PREF_PRIVACY_CLEAR_GEOLOCATION_ACCESS,
+                        false)) {
+                    settings.clearLocationAccess();
+                }
+
+                setEnabled(true);
             } else if (PreferenceKeys.PREF_RESET_DEFAULT_PREFERENCES.equals(
                     getKey())) {
                 settings.resetDefaultPreferences();
                 setEnabled(true);
-            } else if (PreferenceKeys.PREF_PRIVACY_CLEAR_GEOLOCATION_ACCESS.equals(
-                    getKey())) {
-                settings.clearLocationAccess();
             }
         }
     }
diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java
index 7dde8b2..f3e752f 100644
--- a/src/com/android/browser/PreferenceKeys.java
+++ b/src/com/android/browser/PreferenceKeys.java
@@ -87,6 +87,7 @@
     // ----------------------
     // Keys for privacy_security_preferences.xml
     // ----------------------
+    static final String PREF_CLEAR_SELECTED_DATA = "privacy_clear_selected";
     static final String PREF_ACCEPT_COOKIES = "accept_cookies";
     static final String PREF_ENABLE_GEOLOCATION = "enable_geolocation";
     static final String PREF_PRIVACY_CLEAR_CACHE = "privacy_clear_cache";
diff --git a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
index f2f03ed..a51c89e 100644
--- a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
+++ b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
@@ -27,22 +27,21 @@
 
 import java.text.NumberFormat;
 
-public class AccessibilityPreferencesFragment extends PreferenceFragment
+public class AccessibilityPreferencesFragment
         implements Preference.OnPreferenceChangeListener {
 
     NumberFormat mFormat;
+    PreferenceFragment mFragment;
 
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        addPreferencesFromResource(R.xml.accessibility_preferences);
+    AccessibilityPreferencesFragment(PreferenceFragment fragment) {
+        mFragment = fragment;
         BrowserSettings settings = BrowserSettings.getInstance();
         mFormat = NumberFormat.getPercentInstance();
 
-        Preference e = findPreference(PreferenceKeys.PREF_MIN_FONT_SIZE);
+        Preference e = mFragment.findPreference(PreferenceKeys.PREF_MIN_FONT_SIZE);
         e.setOnPreferenceChangeListener(this);
         updateMinFontSummary(e, settings.getMinimumFontSize());
-        e = findPreference(PreferenceKeys.PREF_TEXT_ZOOM);
+        e = mFragment.findPreference(PreferenceKeys.PREF_TEXT_ZOOM);
         e.setOnPreferenceChangeListener(this);
         updateTextZoomSummary(e, settings.getTextZoom());
         /* SWE: Comment out double tap zoom feature
@@ -60,7 +59,7 @@
     }
 
     void updateMinFontSummary(Preference pref, int minFontSize) {
-        Context c = getActivity();
+        Context c = mFragment.getActivity();
         pref.setSummary(c.getString(R.string.pref_min_font_size_value, minFontSize));
     }
 
@@ -80,7 +79,7 @@
 
     @Override
     public boolean onPreferenceChange(Preference pref, Object objValue) {
-        if (getActivity() == null) {
+        if (mFragment.getActivity() == null) {
             // We aren't attached, so don't accept preferences changes from the
             // invisible UI.
             return false;
diff --git a/src/com/android/browser/preferences/AdvancedPreferencesFragment.java b/src/com/android/browser/preferences/AdvancedPreferencesFragment.java
index e693297..465366b 100644
--- a/src/com/android/browser/preferences/AdvancedPreferencesFragment.java
+++ b/src/com/android/browser/preferences/AdvancedPreferencesFragment.java
@@ -17,13 +17,16 @@
 package com.android.browser.preferences;
 
 import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
 import android.content.Intent;
 import android.content.res.Resources;
 import android.content.SharedPreferences.Editor;
 import android.net.Uri;
-import android.os.Bundle;
 import android.preference.ListPreference;
 import android.preference.Preference;
+import android.preference.PreferenceCategory;
 import android.preference.PreferenceFragment;
 import android.preference.PreferenceScreen;
 import android.util.Log;
@@ -41,51 +44,56 @@
 import org.codeaurora.swe.GeolocationPermissions;
 import org.codeaurora.swe.WebStorage;
 
-public class AdvancedPreferencesFragment extends PreferenceFragment
-        implements Preference.OnPreferenceChangeListener {
+public class AdvancedPreferencesFragment
+        implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
 
     private static final int DOWNLOAD_PATH_RESULT_CODE = 1;
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
 
-        // Load the XML preferences file
-        addPreferencesFromResource(R.xml.advanced_preferences);
+    PreferenceFragment mFragment = null;
 
-        PreferenceScreen websiteSettings = (PreferenceScreen) findPreference(
+    AdvancedPreferencesFragment(PreferenceFragment fragment) {
+        mFragment = fragment;
+
+        PreferenceScreen websiteSettings = (PreferenceScreen) mFragment.findPreference(
                 PreferenceKeys.PREF_WEBSITE_SETTINGS);
         websiteSettings.setFragment(WebsiteSettingsFragment.class.getName());
+        websiteSettings.setOnPreferenceClickListener(this);
 
-        Preference e = findPreference(PreferenceKeys.PREF_DEFAULT_ZOOM);
+        Preference e = mFragment.findPreference(PreferenceKeys.PREF_DEFAULT_ZOOM);
         e.setOnPreferenceChangeListener(this);
         e.setSummary(getVisualDefaultZoomName(
-                getPreferenceScreen().getSharedPreferences()
-                .getString(PreferenceKeys.PREF_DEFAULT_ZOOM, null)) );
+                mFragment.getPreferenceScreen().getSharedPreferences()
+                        .getString(PreferenceKeys.PREF_DEFAULT_ZOOM, null)));
 
-        e = findPreference(PreferenceKeys.PREF_DEFAULT_TEXT_ENCODING);
+        e = mFragment.findPreference(PreferenceKeys.PREF_RESET_DEFAULT_PREFERENCES);
         e.setOnPreferenceChangeListener(this);
 
-        e = findPreference(PreferenceKeys.PREF_RESET_DEFAULT_PREFERENCES);
-        e.setOnPreferenceChangeListener(this);
-
-        e = findPreference(PreferenceKeys.PREF_SEARCH_ENGINE);
+        e = mFragment.findPreference(PreferenceKeys.PREF_SEARCH_ENGINE);
         e.setOnPreferenceChangeListener(this);
         updateListPreferenceSummary((ListPreference) e);
 
-        updateListPreferenceSummary((ListPreference) e);
+        e = mFragment.findPreference(PreferenceKeys.PREF_DEBUG_MENU);
+        if (!BrowserSettings.getInstance().isDebugEnabled()) {
+            PreferenceCategory category = (PreferenceCategory) mFragment.findPreference("advanced");
+            category.removePreference(e);
+        } else {
+            e.setOnPreferenceClickListener(this);
+        }
+
+
+
         onInitdownloadSettingsPreference();
     }
 
     private void onInitdownloadSettingsPreference() {
-        addPreferencesFromResource(R.xml.download_settings_preferences);
         PreferenceScreen downloadPathPreset =
-                (PreferenceScreen) findPreference(PreferenceKeys.PREF_DOWNLOAD_PATH);
+                (PreferenceScreen) mFragment.findPreference(PreferenceKeys.PREF_DOWNLOAD_PATH);
         downloadPathPreset.setOnPreferenceClickListener(onClickDownloadPathSettings());
 
         String downloadPath = downloadPathPreset.getSharedPreferences().
                 getString(PreferenceKeys.PREF_DOWNLOAD_PATH,
                         BrowserSettings.getInstance().getDownloadPath());
-        String downloadPathForUser = DownloadHandler.getDownloadPathForUser(this.getActivity(),
+        String downloadPathForUser = DownloadHandler.getDownloadPathForUser(mFragment.getActivity(),
                 downloadPath);
         downloadPathPreset.setSummary(downloadPathForUser);
     }
@@ -95,22 +103,19 @@
             public boolean onPreferenceClick(Preference preference) {
                 try {
                     Intent i = new Intent("com.android.fileexplorer.action.DIR_SEL");
-                    AdvancedPreferencesFragment.this.startActivityForResult(i,
+                    mFragment.startActivityForResult(i,
                             DOWNLOAD_PATH_RESULT_CODE);
                 } catch (Exception e) {
-                    String err_msg = getResources().getString(R.string.activity_not_found,
+                    String err_msg = mFragment.getResources().getString(R.string.activity_not_found,
                             "com.android.fileexplorer.action.DIR_SEL");
-                    Toast.makeText(getActivity(), err_msg, Toast.LENGTH_LONG).show();
+                    Toast.makeText(mFragment.getActivity(), err_msg, Toast.LENGTH_LONG).show();
                 }
                 return true;
             }
         };
     }
 
-    @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-
         if (requestCode == DOWNLOAD_PATH_RESULT_CODE) {
             if (resultCode == Activity.RESULT_OK && data != null) {
                 String downloadPath = data.getStringExtra("result_dir_sel");
@@ -122,12 +127,13 @@
                 }
                 if (downloadPath != null) {
                     PreferenceScreen downloadPathPreset =
-                            (PreferenceScreen) findPreference(PreferenceKeys.PREF_DOWNLOAD_PATH);
+                            (PreferenceScreen) mFragment.findPreference(
+                                    PreferenceKeys.PREF_DOWNLOAD_PATH);
                     Editor editor = downloadPathPreset.getEditor();
                     editor.putString(PreferenceKeys.PREF_DOWNLOAD_PATH, downloadPath);
                     editor.apply();
                     String downloadPathForUser = DownloadHandler.getDownloadPathForUser(
-                            this.getActivity(), downloadPath);
+                            mFragment.getActivity(), downloadPath);
                     downloadPathPreset.setSummary(downloadPathForUser);
                 }
 
@@ -146,10 +152,8 @@
      * origins with active features (WebStorage, Geolocation etc) could have
      * changed after calling the WebsiteSettingsActivity.
      */
-    @Override
     public void onResume() {
-        super.onResume();
-        final PreferenceScreen websiteSettings = (PreferenceScreen) findPreference(
+        final PreferenceScreen websiteSettings = (PreferenceScreen) mFragment.findPreference(
                 PreferenceKeys.PREF_WEBSITE_SETTINGS);
         websiteSettings.setEnabled(false);
         WebStorage.getInstance().getOrigins(new ValueCallback<Map>() {
@@ -172,7 +176,7 @@
 
     @Override
     public boolean onPreferenceChange(Preference pref, Object objValue) {
-        if (getActivity() == null) {
+        if (mFragment.getActivity() == null) {
             // We aren't attached, so don't accept preferences changes from the
             // invisible UI.
             Log.w("PageContentPreferencesFragment", "onPreferenceChange called from detached fragment!");
@@ -182,14 +186,11 @@
         if (pref.getKey().equals(PreferenceKeys.PREF_DEFAULT_ZOOM)) {
             pref.setSummary(getVisualDefaultZoomName((String) objValue));
             return true;
-        } else if (pref.getKey().equals(PreferenceKeys.PREF_DEFAULT_TEXT_ENCODING)) {
-            pref.setSummary((String) objValue);
-            return true;
         } else if (pref.getKey().equals(PreferenceKeys.PREF_RESET_DEFAULT_PREFERENCES)) {
             Boolean value = (Boolean) objValue;
             if (value.booleanValue() == true) {
-                startActivity(new Intent(BrowserActivity.ACTION_RESTART, null,
-                        getActivity(), BrowserActivity.class));
+                mFragment.startActivity(new Intent(BrowserActivity.ACTION_RESTART, null,
+                        mFragment.getActivity(), BrowserActivity.class));
                 return true;
             }
         } else if (pref.getKey().equals(PreferenceKeys.PREF_SEARCH_ENGINE)) {
@@ -202,7 +203,7 @@
     }
 
     private CharSequence getVisualDefaultZoomName(String enumName) {
-        Resources res = getActivity().getResources();
+        Resources res = mFragment.getActivity().getResources();
         CharSequence[] visualNames = res.getTextArray(R.array.pref_default_zoom_choices);
         CharSequence[] enumNames = res.getTextArray(R.array.pref_default_zoom_values);
 
@@ -220,4 +221,29 @@
 
         return "";
     }
+
+    @Override
+    public boolean onPreferenceClick(Preference preference) {
+        FragmentManager fragmentManager = mFragment.getFragmentManager();
+
+        if (preference.getKey().equals(PreferenceKeys.PREF_WEBSITE_SETTINGS)) {
+            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+
+            Fragment newFragment = new WebsiteSettingsFragment();
+            fragmentTransaction.replace(mFragment.getId(), newFragment);
+            fragmentTransaction.addToBackStack(null);
+            fragmentTransaction.commit();
+            return true;
+        } else if (preference.getKey().equals(PreferenceKeys.PREF_DEBUG_MENU)) {
+            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+
+            Fragment newFragment = new DebugPreferencesFragment();
+            fragmentTransaction.replace(mFragment.getId(), newFragment);
+            fragmentTransaction.addToBackStack(null);
+            fragmentTransaction.commit();
+            return true;
+        }
+
+        return false;
+    }
 }
diff --git a/src/com/android/browser/preferences/GeneralPreferencesFragment.java b/src/com/android/browser/preferences/GeneralPreferencesFragment.java
index 2453f46..1a2d5fe 100644
--- a/src/com/android/browser/preferences/GeneralPreferencesFragment.java
+++ b/src/com/android/browser/preferences/GeneralPreferencesFragment.java
@@ -20,8 +20,11 @@
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnClickListener;
+import android.content.Intent;
 import android.content.res.Resources;
 import android.os.Bundle;
 import android.preference.ListPreference;
@@ -38,6 +41,7 @@
 import android.widget.TextView;
 import android.widget.TextView.OnEditorActionListener;
 
+import com.android.browser.AutoFillSettingsFragment;
 import com.android.browser.BrowserPreferencesPage;
 import com.android.browser.BrowserSettings;
 import com.android.browser.PreferenceKeys;
@@ -46,7 +50,7 @@
 import com.android.browser.homepages.HomeProvider;
 
 public class GeneralPreferencesFragment extends PreferenceFragment
-        implements Preference.OnPreferenceChangeListener {
+        implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
 
     static final String TAG = "PersonalPreferencesFragment";
 
@@ -62,6 +66,10 @@
     String[] mChoices, mValues;
     String mCurrentPage;
 
+    AdvancedPreferencesFragment mAdvFrag = null;
+    AccessibilityPreferencesFragment mAccessFrag = null;
+    PrivacySecurityPreferencesFragment mPrivFrag = null;
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -79,6 +87,14 @@
         pref.setPersistent(false);
         pref.setValue(getHomepageValue());
         pref.setOnPreferenceChangeListener(this);
+
+        PreferenceScreen autofill = (PreferenceScreen) findPreference(
+                PreferenceKeys.PREF_AUTOFILL_PROFILE);
+        autofill.setOnPreferenceClickListener(this);
+
+        mAdvFrag = new AdvancedPreferencesFragment(this);
+        mAccessFrag = new AccessibilityPreferencesFragment(this);
+        mPrivFrag = new PrivacySecurityPreferencesFragment(this);
     }
 
     @Override
@@ -168,15 +184,37 @@
     public void onResume() {
         super.onResume();
 
+        mAdvFrag.onResume();
         refreshUi();
     }
 
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        mAdvFrag.onActivityResult(requestCode,resultCode, data);
+    }
+
     void refreshUi() {
         PreferenceScreen autoFillSettings =
                 (PreferenceScreen)findPreference(PreferenceKeys.PREF_AUTOFILL_PROFILE);
         autoFillSettings.setDependency(PreferenceKeys.PREF_AUTOFILL_ENABLED);
     }
 
+    @Override
+    public boolean onPreferenceClick(Preference preference) {
+        if (preference.getKey().equals(PreferenceKeys.PREF_AUTOFILL_PROFILE)) {
+            FragmentManager fragmentManager = getFragmentManager();
+            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+
+            Fragment newFragment = new AutoFillSettingsFragment();
+            fragmentTransaction.replace(getId(), newFragment);
+            fragmentTransaction.addToBackStack(null);
+            fragmentTransaction.commit();
+            return true;
+        }
+        return false;
+    }
+
     /*
       Add this class to manage AlertDialog lifecycle.
     */
diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java
deleted file mode 100644
index 222b5fa..0000000
--- a/src/com/android/browser/preferences/LabPreferencesFragment.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2010 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
- */
-
-package com.android.browser.preferences;
-
-import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceFragment;
-
-import com.android.browser.BrowserSettings;
-import com.android.browser.PreferenceKeys;
-import com.android.browser.R;
-import com.android.browser.search.SearchEngine;
-
-public class LabPreferencesFragment extends PreferenceFragment {
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        // Load the XML preferences file
-        addPreferencesFromResource(R.xml.lab_preferences);
-    }
-}
diff --git a/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java b/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java
index 35e6e43..dc32a14 100644
--- a/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java
+++ b/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java
@@ -20,39 +20,38 @@
 import com.android.browser.R;
 
 import android.app.Activity;
+import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.preference.Preference;
 import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
 
-public class PrivacySecurityPreferencesFragment extends PreferenceFragment
+public class PrivacySecurityPreferencesFragment
         implements Preference.OnPreferenceChangeListener {
 
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
+    PreferenceFragment mFragment;
 
-        // Load the preferences from an XML resource
-        addPreferencesFromResource(R.xml.privacy_security_preferences);
+    PrivacySecurityPreferencesFragment(PreferenceFragment fragment) {
+        mFragment = fragment;
 
-        Preference e = findPreference(PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY);
+        Preference e = mFragment.findPreference(PreferenceKeys.PREF_CLEAR_SELECTED_DATA);
         e.setOnPreferenceChangeListener(this);
     }
 
     @Override
-    public void onResume() {
-        super.onResume();
-    }
-
-    @Override
     public boolean onPreferenceChange(Preference pref, Object objValue) {
-        if (pref.getKey().equals(PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY)
-                && ((Boolean) objValue).booleanValue() == true) {
-            // Need to tell the browser to remove the parent/child relationship
-            // between tabs
-            getActivity().setResult(Activity.RESULT_OK, (new Intent()).putExtra(Intent.EXTRA_TEXT,
-                    pref.getKey()));
-            return true;
+        if (pref.getKey().equals(PreferenceKeys.PREF_CLEAR_SELECTED_DATA)) {
+            if (pref.getPreferenceManager().getDefaultSharedPreferences(
+                    (Context)mFragment.getActivity()).getBoolean(
+                    PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY, false)) {
+                // Need to tell the browser to remove the parent/child relationship
+                // between tabs
+                mFragment.getActivity().setResult(Activity.RESULT_OK,
+                        (new Intent()).putExtra(Intent.EXTRA_TEXT,
+                                pref.getKey()));
+                return true;
+            }
         }
 
         return false;
diff --git a/src/com/android/browser/preferences/WebsiteSettingsFragment.java b/src/com/android/browser/preferences/WebsiteSettingsFragment.java
index 020492c..49bd98e 100644
--- a/src/com/android/browser/preferences/WebsiteSettingsFragment.java
+++ b/src/com/android/browser/preferences/WebsiteSettingsFragment.java
@@ -16,7 +16,11 @@
 
 package com.android.browser.preferences;
 
+import android.app.Activity;
 import android.app.AlertDialog;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
 import android.app.ListFragment;
 import android.content.Context;
 import android.content.DialogInterface;
@@ -707,12 +711,19 @@
                 }
             } else {
                 Site site = (Site) view.getTag();
-                PreferenceActivity activity = (PreferenceActivity) getActivity();
+                Activity activity = getActivity();
                 if (activity != null) {
                     Bundle args = new Bundle();
                     args.putParcelable(EXTRA_SITE, site);
-                    activity.startPreferencePanel(WebsiteSettingsFragment.class.getName(), args, 0,
-                            site.getPrettyTitle(), null, 0);
+
+                    FragmentManager fragmentManager = activity.getFragmentManager();
+                    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+
+                    Fragment newFragment = new WebsiteSettingsFragment();
+                    newFragment.setArguments(args);
+                    fragmentTransaction.replace(getId(), newFragment);
+                    fragmentTransaction.addToBackStack(null);
+                    fragmentTransaction.commit();
                 }
             }
         }
@@ -759,9 +770,9 @@
     }
 
     private void finish() {
-        PreferenceActivity activity = (PreferenceActivity) getActivity();
+        Activity activity = getActivity();
         if (activity != null) {
-            activity.finishPreferencePanel(this, 0, null);
+            getActivity().getFragmentManager().popBackStack();
         }
     }