Merge "Show time to go while encrypting drive"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index cda4f1a..c8362f0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -130,8 +130,7 @@
         <activity android:name="Settings$WifiSettingsActivity"
                 android:taskAffinity=""
                 android:label="@string/wifi_settings"
-                android:configChanges="orientation|keyboardHidden|screenSize"
-                android:excludeFromRecents="true">
+                android:configChanges="orientation|keyboardHidden|screenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.WIFI_SETTINGS" />
@@ -182,7 +181,7 @@
         </activity>
 
         <activity android:name=".wifi.WifiSettingsForSetupWizardXL"
-                android:theme="@android:style/Theme.Quantum.Light.NoActionBar"
+                android:theme="@android:style/Theme.Material.Light.NoActionBar"
                 android:screenOrientation="behind"
                 android:clearTaskOnLaunch="true"
                 android:windowSoftInputMode="adjustResize"
@@ -270,8 +269,7 @@
 
         <activity android:name="Settings$BluetoothSettingsActivity"
                 android:label="@string/bluetooth_settings_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.BLUETOOTH_SETTINGS" />
@@ -309,8 +307,7 @@
 
         <activity android:name="Settings$TetherSettingsActivity"
                 android:label="@string/tether_settings_title_all"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -352,8 +349,7 @@
 
         <activity android:name="Settings$VpnSettingsActivity"
                 android:label="@string/vpn_settings_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.net.vpn.SETTINGS" />
@@ -369,8 +365,7 @@
 
         <activity android:name="Settings$DateTimeSettingsActivity"
                 android:label="@string/date_and_time"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.DATE_SETTINGS" />
@@ -386,7 +381,7 @@
 
         <activity android:name="DateTimeSettingsSetupWizard"
                   android:label="@string/date_and_time"
-                  android:theme="@android:style/Theme.Quantum.Light.NoActionBar"
+                  android:theme="@android:style/Theme.Material.Light.NoActionBar"
                   android:screenOrientation="behind">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -501,7 +496,7 @@
 
         <activity android:name=".inputmethod.UserDictionaryAddWordActivity"
                   android:label="@string/user_dict_settings_title"
-                  android:theme="@android:style/Theme.Quantum.Light.Dialog.NoActionBar"
+                  android:theme="@android:style/Theme.Material.Light.Dialog.NoActionBar"
                   android:windowSoftInputMode="stateVisible"
                   android:noHistory="true"
                   android:excludeFromRecents="true">
@@ -527,8 +522,7 @@
         <activity android:name="Settings$ZenModeSettingsActivity"
                 android:label="@string/zen_mode_settings_title"
                 android:exported="true"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.ZEN_MODE_SETTINGS" />
@@ -543,8 +537,7 @@
 
         <activity android:name="Settings$DisplaySettingsActivity"
                 android:label="@string/display_settings"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="com.android.settings.DISPLAY_SETTINGS" />
@@ -589,7 +582,7 @@
 
         <activity android:name="SettingsLicenseActivity"
                 android:label="@string/settings_license_activity_title"
-                android:theme="@android:style/Theme.Quantum.Light.Panel"
+                android:theme="@android:style/Theme.Material.Light.Panel"
                 android:configChanges="orientation|screenSize">
             <intent-filter>
                 <action android:name="android.settings.LICENSE" />
@@ -599,7 +592,7 @@
 
         <activity android:name="SettingsSafetyLegalActivity"
                 android:label="@string/settings_safetylegal_activity_title"
-                android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.settings.SAFETY" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -608,8 +601,7 @@
 
         <activity android:name="Settings$ManageApplicationsActivity"
                 android:label="@string/applications_settings"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.APPLICATION_SETTINGS" />
@@ -735,9 +727,9 @@
         </activity>
 
         <activity android:name="Settings$NotificationStationActivity"
-                android:label="@string/sound_category_notification_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:theme="@android:style/Theme.DeviceDefault"
+                android:label="@string/notification_log_title"
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -751,7 +743,6 @@
         <activity android:name="Settings$AppOpsSummaryActivity"
                 android:label="@string/app_ops_settings"
                 android:taskAffinity=""
-                android:excludeFromRecents="true"
                 android:enabled="false">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -770,8 +761,7 @@
         <activity android:name="Settings$LocationSettingsActivity"
                 android:label="@string/location_settings_title"
                 android:configChanges="orientation|keyboardHidden|screenSize"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.LOCATION_SOURCE_SETTINGS" />
@@ -806,8 +796,7 @@
         <activity android:name="MonitoringCertInfoActivity"
                 android:label="@string/ssl_ca_cert_dialog_title"
                 android:theme="@style/Transparent"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="com.android.settings.MONITORING_CERT_INFO" />
@@ -817,8 +806,7 @@
 
         <activity android:name="Settings$TrustedCredentialsSettingsActivity"
                 android:label="@string/trusted_credentials"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="com.android.settings.TRUSTED_CREDENTIALS" />
@@ -929,8 +917,7 @@
         <activity android:name="Settings$AccessibilitySettingsActivity"
                 android:label="@string/accessibility_settings"
                 android:configChanges="orientation|keyboardHidden|screenSize"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.ACCESSIBILITY_SETTINGS" />
@@ -1162,7 +1149,7 @@
         </activity-alias>
 
         <activity android:name=".AppPicker" android:label="@string/select_application"
-                android:theme="@android:style/Theme.Quantum.Light.Dialog" />
+                android:theme="@android:style/Theme.Material.Light.Dialog" />
 
         <activity android:name="Settings$UsbSettingsActivity"
                 android:label="@string/storage_title_usb"
@@ -1196,7 +1183,7 @@
         <activity android:name=".bluetooth.BluetoothPairingDialog"
                   android:label="@string/bluetooth_pairing_request"
                   android:excludeFromRecents="true"
-                  android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -1229,7 +1216,7 @@
                   android:label="@string/bluetooth_permission_request"
                   android:excludeFromRecents="true"
                   android:permission="android.permission.BLUETOOTH"
-                  android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.bluetooth.adapter.action.REQUEST_DISCOVERABLE" />
                 <action android:name="android.bluetooth.adapter.action.REQUEST_ENABLE" />
@@ -1250,7 +1237,7 @@
                   android:label="@string/bluetooth_pairing_request"
                   android:excludeFromRecents="true"
                   android:permission="android.permission.BLUETOOTH"
-                  android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
         </activity>
 
         <receiver android:name=".bluetooth.BluetoothPairingRequest">
@@ -1273,7 +1260,7 @@
                   android:label="@string/bluetooth_connection_permission_request"
                   android:excludeFromRecents="true"
                   android:permission="android.permission.BLUETOOTH_ADMIN"
-                  android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST" />
                 <action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL" />
@@ -1283,7 +1270,7 @@
 
         <activity android:name="ActivityPicker"
                 android:label="@string/activity_picker_label"
-                android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert"
+                android:theme="@*android:style/Theme.Material.Light.Dialog.Alert"
                 android:finishOnCloseSystemDialogs="true">
             <intent-filter>
                 <action android:name="android.intent.action.PICK_ACTIVITY" />
@@ -1307,8 +1294,7 @@
 
         <activity android:name="Settings$WifiDisplaySettingsActivity"
                 android:label="@string/wifi_display_settings_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.WIFI_DISPLAY_SETTINGS" />
@@ -1395,7 +1381,7 @@
         <!-- Standard picker for widgets -->
         <activity android:name="AppWidgetPickActivity"
                 android:label="@string/widget_picker_title"
-                android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert"
+                android:theme="@*android:style/Theme.Material.Light.Dialog.Alert"
                 android:finishOnCloseSystemDialogs="true">
             <intent-filter>
                 <action android:name="android.appwidget.action.APPWIDGET_PICK" />
@@ -1404,7 +1390,7 @@
         </activity>
 
         <activity android:name="AllowBindAppWidgetActivity"
-                android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert"
+                android:theme="@*android:style/Theme.Material.Light.Dialog.Alert"
                 android:finishOnCloseSystemDialogs="true"
                 android:excludeFromRecents="true">
             <intent-filter>
@@ -1416,7 +1402,7 @@
         <!-- Special picker for keyguard widgets -->
         <activity android:name="KeyguardAppWidgetPickActivity"
                 android:label="@string/widget_picker_title"
-                android:theme="@android:style/Theme.Quantum.Wallpaper.NoTitleBar"
+                android:theme="@android:style/Theme.Material.Wallpaper.NoTitleBar"
                 android:permission="android.permission.BIND_KEYGUARD_APPWIDGET"
                 android:finishOnCloseSystemDialogs="true">
             <intent-filter>
@@ -1436,8 +1422,7 @@
 
         <activity android:name="Settings$PowerUsageSummaryActivity"
                 android:label="@string/power_usage_summary_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.intent.action.POWER_USAGE_SUMMARY" />
@@ -1461,6 +1446,21 @@
                 android:resource="@id/battery_settings" />
         </activity-alias>
 
+        <activity android:name="Settings$BatterySaverSettingsActivity"
+                android:label="@string/battery_saver"
+                android:taskAffinity="">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <action android:name="android.settings.BATTERY_SAVER_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="com.android.settings.SHORTCUT" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                android:value="com.android.settings.fuelgauge.BatterySaverSettings" />
+            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+                android:resource="@id/battery_settings" />
+        </activity>
+
         <activity android:name="Settings$AccountSyncSettingsActivity"
             android:label="@string/account_sync_settings_title"
             android:taskAffinity=""
@@ -1511,7 +1511,7 @@
                   android:immersive="true"
                   android:launchMode="singleTop"
                   android:excludeFromRecents="true"
-                  android:theme="@android:style/Theme.Quantum.Light.NoActionBar"
+                  android:theme="@style/Theme.CryptKeeper"
                   android:configChanges="keyboard|keyboardHidden|uiMode"
                   android:windowSoftInputMode="adjustResize"
                   android:screenOrientation="nosensor">
@@ -1550,8 +1550,7 @@
 
         <activity android:name="Settings$DataUsageSummaryActivity"
                 android:label="@string/data_usage_summary_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -1565,8 +1564,7 @@
 
         <activity android:name="Settings$DreamSettingsActivity"
                 android:label="@string/screensaver_settings_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.DREAM_SETTINGS" />
@@ -1581,8 +1579,7 @@
 
         <activity android:name="Settings$UserSettingsActivity"
                 android:label="@string/user_settings_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.USER_SETTINGS" />
@@ -1596,8 +1593,7 @@
 
         <activity android:name="Settings$PaymentSettingsActivity"
                 android:label="@string/nfc_payment_settings_title"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.NFC_PAYMENT_SETTINGS" />
@@ -1611,7 +1607,7 @@
         <activity android:name=".nfc.PaymentDefaultDialog"
                   android:label="@string/nfc_payment_set_default_label"
                   android:excludeFromRecents="true"
-                  android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -1621,7 +1617,7 @@
         <activity android:name=".SmsDefaultDialog"
                   android:label="@string/sms_application_title"
                   android:excludeFromRecents="true"
-                  android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.provider.Telephony.ACTION_CHANGE_DEFAULT" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -1631,7 +1627,7 @@
         <activity android:name=".ActiveNetworkScorerDialog"
                   android:label="@string/network_scorer_application"
                   android:excludeFromRecents="true"
-                  android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.net.scoring.CHANGE_ACTIVE" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -1640,8 +1636,7 @@
 
         <activity android:name="Settings$NotificationAccessSettingsActivity"
                   android:label="@string/manage_notification_access"
-                  android:taskAffinity=""
-                  android:excludeFromRecents="true">
+                  android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS" />
@@ -1655,8 +1650,7 @@
 
         <activity android:name="Settings$ConditionProviderSettingsActivity"
                   android:label="@string/manage_condition_providers"
-                  android:taskAffinity=""
-                  android:excludeFromRecents="true">
+                  android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS" />
@@ -1671,8 +1665,7 @@
         <activity android:name="Settings$NotificationSettingsActivity"
                 android:label="@string/notification_settings"
                 android:exported="true"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.NOTIFICATION_SETTINGS" />
@@ -1689,7 +1682,6 @@
         <activity-alias android:name="Settings$SoundSettingsActivity"
                 android:label="@string/notification_settings"
                 android:taskAffinity=""
-                android:excludeFromRecents="true"
                 android:targetActivity="Settings$NotificationSettingsActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -1718,8 +1710,7 @@
         <activity android:name="Settings$NotificationDisplaySettingsActivity"
                 android:label="@string/notification_display_settings"
                 android:exported="true"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.ACTION_NOTIFICATION_DISPLAY_SETTINGS" />
@@ -1734,8 +1725,7 @@
         <activity android:name="Settings$OtherSoundSettingsActivity"
                 android:label="@string/other_sound_settings"
                 android:exported="true"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.ACTION_OTHER_SOUND_SETTINGS" />
@@ -1750,8 +1740,7 @@
         <activity android:name="Settings$AppNotificationSettingsActivity"
                 android:label="@string/app_notifications_title"
                 android:exported="true"
-                android:taskAffinity=""
-                android:excludeFromRecents="true">
+                android:taskAffinity="">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.ACTION_APP_NOTIFICATION_SETTINGS" />
@@ -1767,7 +1756,6 @@
         <activity android:name="RegulatoryInfoDisplayActivity"
                   android:label="@string/regulatory_information"
                   android:taskAffinity=""
-                  android:excludeFromRecents="true"
                   android:enabled="@bool/config_show_regulatory_info">
             <intent-filter>
                 <action android:name="android.settings.SHOW_REGULATORY_INFO" />
diff --git a/res/drawable-hdpi/ic_power_system.png b/res/drawable-hdpi/ic_power_system.png
index 5e7cf99..3592466 100644
--- a/res/drawable-hdpi/ic_power_system.png
+++ b/res/drawable-hdpi/ic_power_system.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_search_history.png b/res/drawable-hdpi/ic_search_history.png
new file mode 100644
index 0000000..eaef70c
--- /dev/null
+++ b/res/drawable-hdpi/ic_search_history.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_cell_standby.png b/res/drawable-hdpi/ic_settings_cell_standby.png
index 262a860..7d51c80 100644
--- a/res/drawable-hdpi/ic_settings_cell_standby.png
+++ b/res/drawable-hdpi/ic_settings_cell_standby.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_language.png b/res/drawable-hdpi/ic_settings_language.png
index bf641aa..e27035a 100644
--- a/res/drawable-hdpi/ic_settings_language.png
+++ b/res/drawable-hdpi/ic_settings_language.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_more.png b/res/drawable-hdpi/ic_settings_more.png
index e9b6309..61bb00c 100644
--- a/res/drawable-hdpi/ic_settings_more.png
+++ b/res/drawable-hdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_phone_idle.png b/res/drawable-hdpi/ic_settings_phone_idle.png
index fd66f84..6ae7f5e 100644
--- a/res/drawable-hdpi/ic_settings_phone_idle.png
+++ b/res/drawable-hdpi/ic_settings_phone_idle.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_voice_calls.png b/res/drawable-hdpi/ic_settings_voice_calls.png
index 3cb7e49..b3cefda 100644
--- a/res/drawable-hdpi/ic_settings_voice_calls.png
+++ b/res/drawable-hdpi/ic_settings_voice_calls.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_sync_anim_holo.png b/res/drawable-hdpi/ic_sync_anim_holo.png
index bc8dc58..4a0ddfa 100644
--- a/res/drawable-hdpi/ic_sync_anim_holo.png
+++ b/res/drawable-hdpi/ic_sync_anim_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_sync_error_holo.png b/res/drawable-hdpi/ic_sync_error_holo.png
index 3e34bd0..ab3c34f 100644
--- a/res/drawable-hdpi/ic_sync_error_holo.png
+++ b/res/drawable-hdpi/ic_sync_error_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_sync_green_holo.png b/res/drawable-hdpi/ic_sync_green_holo.png
index 2588f3d..692289a 100644
--- a/res/drawable-hdpi/ic_sync_green_holo.png
+++ b/res/drawable-hdpi/ic_sync_green_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_sync_grey_holo.png b/res/drawable-hdpi/ic_sync_grey_holo.png
index 4c7060d..6f86d13 100644
--- a/res/drawable-hdpi/ic_sync_grey_holo.png
+++ b/res/drawable-hdpi/ic_sync_grey_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_sync_red_holo.png b/res/drawable-hdpi/ic_sync_red_holo.png
index b65520d..7b21b14 100644
--- a/res/drawable-hdpi/ic_sync_red_holo.png
+++ b/res/drawable-hdpi/ic_sync_red_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_power_system.png b/res/drawable-mdpi/ic_power_system.png
old mode 100755
new mode 100644
index cce5187..f9813d9
--- a/res/drawable-mdpi/ic_power_system.png
+++ b/res/drawable-mdpi/ic_power_system.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_search_history.png b/res/drawable-mdpi/ic_search_history.png
new file mode 100644
index 0000000..fd6755f
--- /dev/null
+++ b/res/drawable-mdpi/ic_search_history.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_cell_standby.png b/res/drawable-mdpi/ic_settings_cell_standby.png
index 0ac7b5d..c922222 100644
--- a/res/drawable-mdpi/ic_settings_cell_standby.png
+++ b/res/drawable-mdpi/ic_settings_cell_standby.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_language.png b/res/drawable-mdpi/ic_settings_language.png
index a6dba3c..604a710 100644
--- a/res/drawable-mdpi/ic_settings_language.png
+++ b/res/drawable-mdpi/ic_settings_language.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_more.png b/res/drawable-mdpi/ic_settings_more.png
index 048e3ed..bad02c8 100644
--- a/res/drawable-mdpi/ic_settings_more.png
+++ b/res/drawable-mdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_phone_idle.png b/res/drawable-mdpi/ic_settings_phone_idle.png
index 7734b09..92b4b0a 100644
--- a/res/drawable-mdpi/ic_settings_phone_idle.png
+++ b/res/drawable-mdpi/ic_settings_phone_idle.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_voice_calls.png b/res/drawable-mdpi/ic_settings_voice_calls.png
index 89d04d7..9277295 100644
--- a/res/drawable-mdpi/ic_settings_voice_calls.png
+++ b/res/drawable-mdpi/ic_settings_voice_calls.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_sync_anim_holo.png b/res/drawable-mdpi/ic_sync_anim_holo.png
index 66db062..f9affbd 100644
--- a/res/drawable-mdpi/ic_sync_anim_holo.png
+++ b/res/drawable-mdpi/ic_sync_anim_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_sync_error_holo.png b/res/drawable-mdpi/ic_sync_error_holo.png
index dd3958e..06f638a 100644
--- a/res/drawable-mdpi/ic_sync_error_holo.png
+++ b/res/drawable-mdpi/ic_sync_error_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_sync_green_holo.png b/res/drawable-mdpi/ic_sync_green_holo.png
index 1c981b66..dd15bf9 100644
--- a/res/drawable-mdpi/ic_sync_green_holo.png
+++ b/res/drawable-mdpi/ic_sync_green_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_sync_grey_holo.png b/res/drawable-mdpi/ic_sync_grey_holo.png
index bb4267f..b6afc12 100644
--- a/res/drawable-mdpi/ic_sync_grey_holo.png
+++ b/res/drawable-mdpi/ic_sync_grey_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_sync_red_holo.png b/res/drawable-mdpi/ic_sync_red_holo.png
index 36fe6b8..3bb9980 100644
--- a/res/drawable-mdpi/ic_sync_red_holo.png
+++ b/res/drawable-mdpi/ic_sync_red_holo.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_power_system.png b/res/drawable-xhdpi/ic_power_system.png
index 9a360f7..8671616 100644
--- a/res/drawable-xhdpi/ic_power_system.png
+++ b/res/drawable-xhdpi/ic_power_system.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_search_history.png b/res/drawable-xhdpi/ic_search_history.png
new file mode 100644
index 0000000..7183fc2
--- /dev/null
+++ b/res/drawable-xhdpi/ic_search_history.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_cell_standby.png b/res/drawable-xhdpi/ic_settings_cell_standby.png
index cf783dc..a02b5a2 100644
--- a/res/drawable-xhdpi/ic_settings_cell_standby.png
+++ b/res/drawable-xhdpi/ic_settings_cell_standby.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_language.png b/res/drawable-xhdpi/ic_settings_language.png
index 24a1d3c..4e44c01 100644
--- a/res/drawable-xhdpi/ic_settings_language.png
+++ b/res/drawable-xhdpi/ic_settings_language.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_more.png b/res/drawable-xhdpi/ic_settings_more.png
index d1b5c37..8b9fe07 100644
--- a/res/drawable-xhdpi/ic_settings_more.png
+++ b/res/drawable-xhdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_phone_idle.png b/res/drawable-xhdpi/ic_settings_phone_idle.png
index 09c322f..1f8bd65 100644
--- a/res/drawable-xhdpi/ic_settings_phone_idle.png
+++ b/res/drawable-xhdpi/ic_settings_phone_idle.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_voice_calls.png b/res/drawable-xhdpi/ic_settings_voice_calls.png
index 07b9074..fac4916 100644
--- a/res/drawable-xhdpi/ic_settings_voice_calls.png
+++ b/res/drawable-xhdpi/ic_settings_voice_calls.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sync_anim_holo.png b/res/drawable-xhdpi/ic_sync_anim_holo.png
index d315e95..34071fe 100644
--- a/res/drawable-xhdpi/ic_sync_anim_holo.png
+++ b/res/drawable-xhdpi/ic_sync_anim_holo.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sync_error_holo.png b/res/drawable-xhdpi/ic_sync_error_holo.png
index 85f19bf..1e8c170 100644
--- a/res/drawable-xhdpi/ic_sync_error_holo.png
+++ b/res/drawable-xhdpi/ic_sync_error_holo.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sync_green_holo.png b/res/drawable-xhdpi/ic_sync_green_holo.png
index 95e2d7d..b66eb3f 100644
--- a/res/drawable-xhdpi/ic_sync_green_holo.png
+++ b/res/drawable-xhdpi/ic_sync_green_holo.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sync_grey_holo.png b/res/drawable-xhdpi/ic_sync_grey_holo.png
index 10cc48a..a05bdae 100644
--- a/res/drawable-xhdpi/ic_sync_grey_holo.png
+++ b/res/drawable-xhdpi/ic_sync_grey_holo.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sync_red_holo.png b/res/drawable-xhdpi/ic_sync_red_holo.png
index c4b9136..63898c4 100644
--- a/res/drawable-xhdpi/ic_sync_red_holo.png
+++ b/res/drawable-xhdpi/ic_sync_red_holo.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_power_system.png b/res/drawable-xxhdpi/ic_power_system.png
new file mode 100644
index 0000000..8d4979f
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_power_system.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_search_history.png b/res/drawable-xxhdpi/ic_search_history.png
new file mode 100644
index 0000000..174409b
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_search_history.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_settings_cell_standby.png b/res/drawable-xxhdpi/ic_settings_cell_standby.png
new file mode 100644
index 0000000..07d5c85
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_settings_cell_standby.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_settings_language.png b/res/drawable-xxhdpi/ic_settings_language.png
index 2303abe..3d6559d 100644
--- a/res/drawable-xxhdpi/ic_settings_language.png
+++ b/res/drawable-xxhdpi/ic_settings_language.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_settings_more.png b/res/drawable-xxhdpi/ic_settings_more.png
index 610e340..0e0ba13 100644
--- a/res/drawable-xxhdpi/ic_settings_more.png
+++ b/res/drawable-xxhdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_settings_phone_idle.png b/res/drawable-xxhdpi/ic_settings_phone_idle.png
new file mode 100644
index 0000000..a6fe868
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_settings_phone_idle.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_settings_voice_calls.png b/res/drawable-xxhdpi/ic_settings_voice_calls.png
new file mode 100644
index 0000000..78e4483
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_settings_voice_calls.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sync_anim_holo.png b/res/drawable-xxhdpi/ic_sync_anim_holo.png
new file mode 100644
index 0000000..98be2be
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_sync_anim_holo.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sync_error_holo.png b/res/drawable-xxhdpi/ic_sync_error_holo.png
new file mode 100644
index 0000000..8b7fee5
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_sync_error_holo.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sync_green_holo.png b/res/drawable-xxhdpi/ic_sync_green_holo.png
new file mode 100644
index 0000000..696ca25
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_sync_green_holo.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sync_grey_holo.png b/res/drawable-xxhdpi/ic_sync_grey_holo.png
new file mode 100644
index 0000000..b8d7685
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_sync_grey_holo.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sync_red_holo.png b/res/drawable-xxhdpi/ic_sync_red_holo.png
new file mode 100644
index 0000000..c0cd4533
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_sync_red_holo.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_power_system.png b/res/drawable-xxxhdpi/ic_power_system.png
new file mode 100644
index 0000000..bc92e90
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_power_system.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_search_history.png b/res/drawable-xxxhdpi/ic_search_history.png
new file mode 100644
index 0000000..ffce51e
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_search_history.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_settings_cell_standby.png b/res/drawable-xxxhdpi/ic_settings_cell_standby.png
new file mode 100644
index 0000000..3c864ce
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_settings_cell_standby.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_settings_language.png b/res/drawable-xxxhdpi/ic_settings_language.png
index 04f0f8d..c9447bd 100644
--- a/res/drawable-xxxhdpi/ic_settings_language.png
+++ b/res/drawable-xxxhdpi/ic_settings_language.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_settings_more.png b/res/drawable-xxxhdpi/ic_settings_more.png
index def6b0e..b2083ba 100644
--- a/res/drawable-xxxhdpi/ic_settings_more.png
+++ b/res/drawable-xxxhdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_settings_phone_idle.png b/res/drawable-xxxhdpi/ic_settings_phone_idle.png
new file mode 100644
index 0000000..4851676
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_settings_phone_idle.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_settings_voice_calls.png b/res/drawable-xxxhdpi/ic_settings_voice_calls.png
new file mode 100644
index 0000000..633cfc1
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_settings_voice_calls.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_sync_anim_holo.png b/res/drawable-xxxhdpi/ic_sync_anim_holo.png
new file mode 100644
index 0000000..b48c4db
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_sync_anim_holo.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_sync_error_holo.png b/res/drawable-xxxhdpi/ic_sync_error_holo.png
new file mode 100644
index 0000000..56ae11e
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_sync_error_holo.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_sync_green_holo.png b/res/drawable-xxxhdpi/ic_sync_green_holo.png
new file mode 100644
index 0000000..5227542
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_sync_green_holo.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_sync_grey_holo.png b/res/drawable-xxxhdpi/ic_sync_grey_holo.png
new file mode 100644
index 0000000..a0ae3f3
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_sync_grey_holo.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_sync_red_holo.png b/res/drawable-xxxhdpi/ic_sync_red_holo.png
new file mode 100644
index 0000000..3ac5f63
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_sync_red_holo.png
Binary files differ
diff --git a/res/drawable/dashboard_tile_background.xml b/res/drawable/dashboard_tile_background.xml
index f66ff23..2629cda 100644
--- a/res/drawable/dashboard_tile_background.xml
+++ b/res/drawable/dashboard_tile_background.xml
@@ -15,9 +15,7 @@
 -->
 
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
-                android:tint="?android:attr/colorControlHighlight">
-    <item>
-        <color android:color="@android:color/white" />
-    </item>
+    android:color="?android:attr/colorControlHighlight">
+    <item android:drawable="@android:color/white" />
 </ripple>
 
diff --git a/res/drawable/data_usage_bar.xml b/res/drawable/data_usage_bar.xml
index b98dfb6..2e69710 100644
--- a/res/drawable/data_usage_bar.xml
+++ b/res/drawable/data_usage_bar.xml
@@ -16,18 +16,18 @@
 
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:id="@android:id/background">
-        <nine-patch android:src="@*android:drawable/progress_qntm_alpha"
-            android:tint="@color/quantum_empty_color_light" />
+        <nine-patch android:src="@*android:drawable/progress_mtrl_alpha"
+            android:tint="@color/material_empty_color_light" />
     </item>
     <item android:id="@android:id/secondaryProgress">
         <scale android:scaleWidth="100%">
-            <nine-patch android:src="@*android:drawable/progress_qntm_alpha"
+            <nine-patch android:src="@*android:drawable/progress_mtrl_alpha"
                 android:tint="?android:attr/colorControlActivated" />
         </scale>
     </item>
     <item android:id="@android:id/progress">
         <scale android:scaleWidth="100%">
-            <nine-patch android:src="@*android:drawable/progress_primary_qntm_alpha"
+            <nine-patch android:src="@*android:drawable/progress_primary_mtrl_alpha"
                 android:tint="?android:attr/colorControlActivated" />
         </scale>
     </item>
diff --git a/res/drawable/preference_highlight.xml b/res/drawable/preference_highlight.xml
index bbffe62..20c1a0f 100644
--- a/res/drawable/preference_highlight.xml
+++ b/res/drawable/preference_highlight.xml
@@ -15,8 +15,7 @@
 -->
 
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
-                android:tint="?android:attr/colorControlHighlight"
-                android:pinned="true">
+    android:color="?android:attr/colorControlHighlight">
     <item android:id="@android:id/mask"
           android:drawable="@android:color/white" />
 </ripple>
diff --git a/res/drawable/switch_inner.xml b/res/drawable/switch_inner.xml
index 2822915..c6d39ef 100644
--- a/res/drawable/switch_inner.xml
+++ b/res/drawable/switch_inner.xml
@@ -16,21 +16,21 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_enabled="false" android:state_checked="true">
-        <bitmap android:src="@*android:drawable/btn_switch_to_off_qntm_000"
+        <bitmap android:src="@*android:drawable/btn_switch_to_off_mtrl_000"
                     android:tint="?android:attr/colorControlNormal"
                     android:alpha="?android:attr/disabledAlpha" />
     </item>
     <item android:state_enabled="false">
-        <bitmap android:src="@*android:drawable/btn_switch_to_on_qntm_000"
+        <bitmap android:src="@*android:drawable/btn_switch_to_on_mtrl_000"
                     android:tint="?android:attr/colorControlNormal"
                     android:alpha="?android:attr/disabledAlpha" />
     </item>
     <item android:state_checked="true">
-        <bitmap android:src="@*android:drawable/btn_switch_to_off_qntm_000"
+        <bitmap android:src="@*android:drawable/btn_switch_to_off_mtrl_000"
                     android:tint="@color/switch_accent_color" />
     </item>
     <item>
-        <bitmap android:src="@*android:drawable/btn_switch_to_on_qntm_000"
+        <bitmap android:src="@*android:drawable/btn_switch_to_on_mtrl_000"
                     android:tint="?android:attr/colorControlNormal" />
     </item>
 </selector>
diff --git a/res/drawable/switch_track.xml b/res/drawable/switch_track.xml
index 466cc2c..2655da0 100644
--- a/res/drawable/switch_track.xml
+++ b/res/drawable/switch_track.xml
@@ -16,11 +16,11 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_checked="true">
-        <nine-patch android:src="@*android:drawable/switch_track_qntm_alpha"
+        <nine-patch android:src="@*android:drawable/switch_track_mtrl_alpha"
                     android:tint="@color/switch_accent_color" />
     </item>
     <item>
-        <nine-patch android:src="@*android:drawable/switch_track_qntm_alpha"
+        <nine-patch android:src="@*android:drawable/switch_track_mtrl_alpha"
                     android:tint="?android:attr/colorControlNormal" />
     </item>
 </selector>
diff --git a/res/drawable/switchbar_background.xml b/res/drawable/switchbar_background.xml
index d329b6b..ac340be 100644
--- a/res/drawable/switchbar_background.xml
+++ b/res/drawable/switchbar_background.xml
@@ -15,9 +15,7 @@
 -->
 
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
-                android:tint="?android:attr/colorControlHighlight">
-    <item>
-        <color android:color="@color/switchbar_background_color" />
-    </item>
+    android:color="?android:attr/colorControlHighlight">
+    <item android:drawable="@color/switchbar_background_color" />
 </ripple>
 
diff --git a/res/layout/apn_disallowed_preference_screen.xml b/res/layout/apn_disallowed_preference_screen.xml
new file mode 100644
index 0000000..6ac8137
--- /dev/null
+++ b/res/layout/apn_disallowed_preference_screen.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2014 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.
+ */
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+             android:id="@+id/listContainer"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent">
+
+        <ListView android:id="@android:id/list"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:drawSelectorOnTop="false"
+                android:scrollbarStyle="insideOverlay"
+                android:background="@android:color/white"
+                android:cacheColorHint="@android:color/white"
+                android:fadingEdgeLength="16dip" />
+
+        <TextView android:id="@android:id/empty"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:gravity="center"
+                android:text="@string/apn_settings_not_available"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/battery_history_chart.xml b/res/layout/battery_history_chart.xml
index 4d87a70..48eb7ed 100644
--- a/res/layout/battery_history_chart.xml
+++ b/res/layout/battery_history_chart.xml
@@ -14,22 +14,29 @@
      limitations under the License.
 -->
 
-<com.android.settings.fuelgauge.BatteryHistoryChart
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:app="http://schemas.android.com/apk/res/com.android.settings"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="center_vertical"
-    android:id="@+android:id/battery_history_chart"
-    android:paddingEnd="?android:attr/scrollbarSize"
-    android:textAppearance="?android:attr/textAppearanceSmall"
-    android:textColor="#ff000000"
-    app:headerAppearance="?android:attr/textAppearanceMedium"
-    android:shadowRadius="4"
-    android:shadowColor="?android:attr/colorBackground"
-    android:shadowDx="2"
-    android:shadowDy="2"
-    app:barPrimaryColor="?android:attr/colorControlActivated"
-    app:barPredictionColor="@color/quantum_empty_color_light"
-    app:chartMinHeight="@dimen/battery_history_chart_height">
-</com.android.settings.fuelgauge.BatteryHistoryChart>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+
+    <com.android.settings.fuelgauge.BatteryHistoryChart
+            xmlns:android="http://schemas.android.com/apk/res/android"
+            xmlns:app="http://schemas.android.com/apk/res/com.android.settings"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="center_vertical"
+        android:id="@+android:id/battery_history_chart"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="#ff000000"
+        app:headerAppearance="?android:attr/textAppearanceMedium"
+        android:shadowRadius="4"
+        android:shadowColor="?android:attr/colorBackground"
+        android:shadowDx="2"
+        android:shadowDy="2"
+        app:barPrimaryColor="?android:attr/colorControlActivated"
+        app:barPredictionColor="@color/material_empty_color_light"
+        app:chartMinHeight="@dimen/battery_history_chart_height">
+    </com.android.settings.fuelgauge.BatteryHistoryChart>
+
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/captioning_preview.xml b/res/layout/captioning_preview.xml
index 0963ee9..b90c3a5 100644
--- a/res/layout/captioning_preview.xml
+++ b/res/layout/captioning_preview.xml
@@ -21,6 +21,7 @@
     android:orientation="vertical" >
 
     <FrameLayout
+        android:id="@+id/preview_viewport"
         android:layout_width="match_parent"
         android:layout_height="@dimen/captioning_preview_height" >
 
diff --git a/res/layout/credentials_disallowed_preference_screen.xml b/res/layout/credentials_disallowed_preference_screen.xml
new file mode 100644
index 0000000..c4e8934
--- /dev/null
+++ b/res/layout/credentials_disallowed_preference_screen.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2014 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.
+ */
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+             android:id="@+id/listContainer"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent">
+
+        <ListView android:id="@android:id/list"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:drawSelectorOnTop="false"
+                android:scrollbarStyle="insideOverlay"
+                android:background="@android:color/white"
+                android:cacheColorHint="@android:color/white"
+                android:fadingEdgeLength="16dip" />
+
+        <TextView android:id="@android:id/empty"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:gravity="center"
+                android:text="@string/credentials_settings_not_available"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/dashboard.xml b/res/layout/dashboard.xml
index 3c6e096..7917c96 100644
--- a/res/layout/dashboard.xml
+++ b/res/layout/dashboard.xml
@@ -20,6 +20,7 @@
     android:layout_height="match_parent"
     android:paddingStart="@dimen/dashboard_padding_start"
     android:paddingEnd="@dimen/dashboard_padding_end"
+    android:paddingBottom="@dimen/dashboard_padding_bottom"
     android:scrollbarStyle="outsideOverlay"
     android:background="@color/dashboard_background_color">
 
@@ -27,7 +28,6 @@
                 android:id="@+id/dashboard_container"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:paddingBottom="12dp"
                 android:layout_gravity="center_horizontal"
                 android:orientation="vertical"
                 />
diff --git a/res/layout/dashboard_category.xml b/res/layout/dashboard_category.xml
index 6e90fa9..afa038b 100644
--- a/res/layout/dashboard_category.xml
+++ b/res/layout/dashboard_category.xml
@@ -23,7 +23,7 @@
     <TextView android:id="@+id/category_title"
             android:layout_width="match_parent"
             android:layout_height="@dimen/dashboard_category_title_height"
-            android:paddingStart="@dimen/dashboard_category_title_padding_start"
+            android:layout_marginStart="@dimen/dashboard_category_title_margin_start"
             android:singleLine="true"
             android:ellipsize="marquee"
             android:gravity="center_vertical"
diff --git a/res/layout/dashboard_tile.xml b/res/layout/dashboard_tile.xml
index 5553050..a0049be 100644
--- a/res/layout/dashboard_tile.xml
+++ b/res/layout/dashboard_tile.xml
@@ -19,15 +19,15 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:gravity="center_vertical"
-        android:minHeight="72dp" >
+        android:minHeight="@dimen/dashboard_tile_minimum_height">
 
     <ImageView
             android:id="@+id/icon"
-            android:layout_width="40dp"
-            android:layout_height="40dp"
+            android:layout_width="@dimen/dashboard_tile_image_size"
+            android:layout_height="@dimen/dashboard_tile_image_size"
             android:scaleType="centerInside"
-            android:layout_marginStart="12dp"
-            android:layout_marginEnd="16dp"
+            android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+            android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"
             />
 
     <RelativeLayout
diff --git a/res/layout/dream_info_row.xml b/res/layout/dream_info_row.xml
index e8dd824..7ed26cb 100644
--- a/res/layout/dream_info_row.xml
+++ b/res/layout/dream_info_row.xml
@@ -15,7 +15,9 @@
 -->
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content" >
+    android:layout_height="wrap_content"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
 
     <!-- Dream selectable row (icon, caption, radio button) -->
 
diff --git a/res/layout/notification_log_row.xml b/res/layout/notification_log_row.xml
index 702e6b8..57f5a79 100644
--- a/res/layout/notification_log_row.xml
+++ b/res/layout/notification_log_row.xml
@@ -51,6 +51,7 @@
             android:layout_toEndOf="@android:id/icon"
             android:ellipsize="end"
             android:singleLine="true"
+            android:textColor="?android:attr/textColorPrimary"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="bold"
             android:textAlignment="viewStart"
@@ -66,6 +67,7 @@
             android:layout_centerVertical="true"
             android:ellipsize="end"
             android:singleLine="true"
+            android:textColor="?android:attr/textColorPrimary"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textAlignment="viewEnd"
             />
@@ -79,6 +81,7 @@
         android:layout_marginStart="30dp"
         android:ellipsize="end"
         android:singleLine="true"
+        android:textColor="?android:attr/textColorPrimary"
         android:textAppearance="?android:attr/textAppearanceSmall"
         android:textAlignment="viewStart"
         />
@@ -109,6 +112,7 @@
             android:layout_gravity="left|center_vertical"
             android:ellipsize="end"
             android:singleLine="true"
+            android:textColor="?android:attr/textColorPrimary"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textAlignment="viewStart"
             />
diff --git a/res/layout/preference_batteryhistory.xml b/res/layout/preference_batteryhistory.xml
index 766ec51..723b0e1 100644
--- a/res/layout/preference_batteryhistory.xml
+++ b/res/layout/preference_batteryhistory.xml
@@ -18,11 +18,11 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:minHeight="@dimen/battery_history_chart_height"
-        android:paddingEnd="?android:attr/scrollbarSize">
+        android:minHeight="@dimen/battery_history_chart_height">
     <include layout="@layout/battery_history_chart" />
     <TextView android:id="@+id/labelsHeader"
-              android:layout_width="match_parent" android:layout_height="48dp"
+              android:layout_width="match_parent"
+              android:layout_height="48dp"
               android:textAppearance="?android:attr/textAppearanceMedium"
               android:textSize="14sp"
               android:textColor="?android:attr/colorControlActivated"
diff --git a/res/layout/preference_progress_category.xml b/res/layout/preference_progress_category.xml
index 17d87d7..d0cf60c 100644
--- a/res/layout/preference_progress_category.xml
+++ b/res/layout/preference_progress_category.xml
@@ -22,7 +22,8 @@
 
     <!-- This text view has the style of the list separator text view without the background and padding. -->
     <TextView
-        style="?android:attr/listSeparatorTextViewStyle"
+        android:textAppearance="@android:style/TextAppearance.Material.Body2"
+        android:textColor="?android:attr/colorAccent"
         android:background="@null"
         android:id="@+android:id/title"
         android:paddingStart="0dp"
diff --git a/res/layout/search_panel.xml b/res/layout/search_panel.xml
index 1242c73..c892ff9 100644
--- a/res/layout/search_panel.xml
+++ b/res/layout/search_panel.xml
@@ -33,17 +33,6 @@
                 android:layout_gravity="center"
                 android:orientation="vertical">
 
-            <TextView android:layout_width="wrap_content"
-                      android:layout_height="@dimen/dashboard_category_title_height"
-                      android:paddingStart="@dimen/search_title_padding_start"
-                      android:singleLine="true"
-                      android:ellipsize="marquee"
-                      android:gravity="center_vertical"
-                      android:textAppearance="@style/TextAppearance.RecentsTitle"
-                      android:textAlignment="viewStart"
-                      android:text="@string/search_recents_queries_label"
-                    />
-
             <ListView android:id="@+id/list_suggestions"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
@@ -58,17 +47,6 @@
                 android:orientation="vertical"
                 android:layout_weight="1">
 
-            <TextView android:layout_width="wrap_content"
-                      android:layout_height="@dimen/dashboard_category_title_height"
-                      android:paddingStart="@dimen/search_title_padding_start"
-                      android:singleLine="true"
-                      android:ellipsize="marquee"
-                      android:gravity="center_vertical"
-                      android:textAppearance="@style/TextAppearance.ResultTitle"
-                      android:textAlignment="viewStart"
-                      android:text="@string/search_results_label"
-                    />
-
             <ListView android:id="@+id/list_results"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
diff --git a/res/layout/search_panel_results_header.xml b/res/layout/search_panel_results_header.xml
new file mode 100644
index 0000000..07f77a7
--- /dev/null
+++ b/res/layout/search_panel_results_header.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+          android:layout_width="wrap_content"
+          android:layout_height="@dimen/dashboard_category_title_height"
+          android:paddingStart="@dimen/search_title_padding_start"
+          android:singleLine="true"
+          android:ellipsize="marquee"
+          android:gravity="center_vertical"
+          android:textAppearance="@style/TextAppearance.ResultTitle"
+          android:textAlignment="viewStart"
+          android:text="@string/search_results_label"
+        />
diff --git a/res/layout/search_panel_suggestions_header.xml b/res/layout/search_panel_suggestions_header.xml
new file mode 100644
index 0000000..21500bc
--- /dev/null
+++ b/res/layout/search_panel_suggestions_header.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+          android:layout_width="wrap_content"
+          android:layout_height="@dimen/dashboard_category_title_height"
+          android:paddingStart="@dimen/search_title_padding_start"
+          android:singleLine="true"
+          android:ellipsize="marquee"
+          android:gravity="center_vertical"
+          android:textAppearance="@style/TextAppearance.RecentsTitle"
+          android:textAlignment="viewStart"
+          android:text="@string/search_recents_queries_label"
+        />
diff --git a/res/layout/search_result_item.xml b/res/layout/search_result_item.xml
index 30d6fc0..b659387 100644
--- a/res/layout/search_result_item.xml
+++ b/res/layout/search_result_item.xml
@@ -19,7 +19,6 @@
               android:layout_height="wrap_content"
               android:minHeight="?android:attr/listPreferredItemHeight"
               android:gravity="center_vertical"
-              android:paddingStart="@*android:dimen/preference_item_padding_side"
               android:paddingEnd="?android:attr/scrollbarSize">
 
     <LinearLayout
@@ -31,12 +30,11 @@
 
         <ImageView
                 android:id="@+id/icon"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:layout_gravity="center"
-                android:minWidth="48dp"
+                android:layout_width="@dimen/search_result_item_image_size"
+                android:layout_height="@dimen/search_result_item_image_size"
                 android:scaleType="centerInside"
-                android:layout_marginEnd="@*android:dimen/preference_item_padding_inner"
+                android:layout_marginStart="@dimen/search_result_item_image_margin_start"
+                android:layout_marginEnd="@dimen/search_result_item_image_margin_end"
                 />
 
     </LinearLayout>
@@ -44,10 +42,7 @@
     <RelativeLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:paddingEnd="@*android:dimen/preference_item_padding_inner"
-            android:paddingTop="6dip"
-            android:paddingBottom="6dip">
+            android:layout_weight="1">
 
         <TextView android:id="@+id/title"
                   android:layout_width="wrap_content"
@@ -57,15 +52,6 @@
                   android:ellipsize="marquee"
                   android:fadingEdge="horizontal" />
 
-        <TextView android:id="@+id/summary"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/title"
-                  android:layout_alignStart="@id/title"
-                  android:textAppearance="?android:attr/textAppearanceSmall"
-                  android:textColor="?android:attr/textColorSecondary"
-                  android:maxLines="10" />
-
     </RelativeLayout>
 
 </LinearLayout>
diff --git a/res/layout/search_suggestion_item.xml b/res/layout/search_suggestion_item.xml
index 49df3ca..245b684 100644
--- a/res/layout/search_suggestion_item.xml
+++ b/res/layout/search_suggestion_item.xml
@@ -18,18 +18,41 @@
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:minHeight="?android:attr/listPreferredItemHeight"
-              android:gravity="center_vertical"
-              android:paddingStart="@*android:dimen/preference_item_padding_side"
-              android:paddingEnd="?android:attr/scrollbarSize">
+              android:gravity="center_vertical">
 
-    <TextView android:id="@+id/title"
-              android:layout_width="wrap_content"
-              android:layout_height="wrap_content"
-              android:paddingStart="@*android:dimen/preference_item_padding_inner"
-              android:paddingEnd="@*android:dimen/preference_item_padding_inner"
-              android:singleLine="true"
-              android:textAppearance="?android:attr/textAppearanceMedium"
-              android:ellipsize="marquee"
-              android:fadingEdge="horizontal" />
+    <RelativeLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1">
+
+        <TextView android:id="@+id/title"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:paddingStart="@dimen/search_title_padding_start"
+                  android:singleLine="true"
+                  android:textAppearance="?android:attr/textAppearanceMedium"
+                  android:ellipsize="marquee"
+                  android:fadingEdge="horizontal" />
+
+    </RelativeLayout>
+
+    <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:gravity="center"
+            android:minWidth="@*android:dimen/preference_icon_minWidth"
+            android:orientation="horizontal">
+
+        <ImageView
+                android:id="@+id/icon"
+                android:layout_width="@dimen/search_suggestion_item_image_size"
+                android:layout_height="@dimen/search_suggestion_item_image_size"
+                android:scaleType="centerInside"
+                android:src="@drawable/ic_search_history"
+                android:layout_marginStart="@dimen/search_suggestion_item_image_margin_start"
+                android:layout_marginEnd="@dimen/search_suggestion_item_image_margin_end"
+                />
+
+    </LinearLayout>
 
 </LinearLayout>
diff --git a/res/layout/settings_main.xml b/res/layout/settings_main.xml
index 46ead18..ddbf2af 100644
--- a/res/layout/settings_main.xml
+++ b/res/layout/settings_main.xml
@@ -32,7 +32,7 @@
                   android:layout_height="?android:attr/actionBarSize"
                   android:layout_width="match_parent"
                   android:background="@drawable/switchbar_background"
-                  android:theme="@android:style/Theme.Quantum" />
+                  android:theme="@android:style/Theme.Material" />
 
         <FrameLayout
                 android:id="@+id/prefs"
diff --git a/res/layout/switch_bar.xml b/res/layout/switch_bar.xml
index 51914c9..cdf14d7 100644
--- a/res/layout/switch_bar.xml
+++ b/res/layout/switch_bar.xml
@@ -23,7 +23,7 @@
               android:layout_height="wrap_content"
               android:layout_width="0dp"
               android:layout_weight="1"
-              android:paddingStart="@dimen/switchbar_padding_start"
+              android:layout_marginStart="?attr/switchBarMarginStart"
               android:layout_gravity="center_vertical"
               android:textAppearance="@style/TextAppearance.Switch"
               android:textAlignment="viewStart" />
@@ -32,6 +32,6 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
-            android:paddingEnd="@dimen/switchbar_padding_end" />
+            android:layout_marginEnd="?attr/switchBarMarginEnd" />
 </merge>
 
diff --git a/res/menu/options_menu.xml b/res/menu/options_menu.xml
index 1f35c5d..f73ce90 100644
--- a/res/menu/options_menu.xml
+++ b/res/menu/options_menu.xml
@@ -18,7 +18,7 @@
     <item
         android:id="@+id/search"
         android:title="@string/search_menu"
-        android:icon="@*android:drawable/ic_search_api_quantum"
+        android:icon="@*android:drawable/ic_search_api_material"
         android:showAsAction="collapseActionView|ifRoom"
         android:actionViewClass="android.widget.SearchView" />
 </menu>
\ No newline at end of file
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 288d4e3..63550d7 100755
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -24,4 +24,8 @@
     <integer name="keyguard_appwidget_picker_cols">2</integer>
 
     <dimen name="captioning_preview_height">100dp</dimen>
+
+    <!-- Dashboard tile minimum height -->
+    <dimen name="dashboard_tile_minimum_height">64dp</dimen>
+
 </resources>
diff --git a/res/values-sw600dp-land/config.xml b/res/values-sw600dp-land/config.xml
index eb1a7c3..543dfee 100644
--- a/res/values-sw600dp-land/config.xml
+++ b/res/values-sw600dp-land/config.xml
@@ -17,6 +17,6 @@
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
 
     <!-- Dashboard number of columns -->
-    <integer name="dashboard_num_columns">3</integer>
+    <integer name="dashboard_num_columns">2</integer>
 
 </resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 76ce998..dcf75e7 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -39,15 +39,30 @@
     <dimen name="keyguard_appwidget_picker_margin_right">2dip</dimen>
     <integer name="keyguard_appwidget_picker_cols">2</integer>
 
-    <!-- Dashboard padding between each tiles within the layout -->
-    <dimen name="dashboard_cell_gap">8dp</dimen>
-
-    <!-- SwitchBar padding start -->
-    <dimen name="switchbar_padding_start">80dp</dimen>
-    <!-- SwitchBar padding end -->
-    <dimen name="switchbar_padding_end">80dp</dimen>
-
     <!-- ActionBar contentInsetStart -->
-    <dimen name="actionbar_contentInsetStart">80dp</dimen>
+    <dimen name="actionbar_contentInsetStart">24dp</dimen>
+    <dimen name="actionbar_subsettings_contentInsetStart">80dp</dimen>
+
+    <!-- Dashboard category title margin start -->
+    <dimen name="dashboard_category_title_margin_start">23dp</dimen>
+
+    <!-- Dashboard tile image padding start / end -->
+    <dimen name="dashboard_tile_image_margin_start">24dp</dimen>
+    <dimen name="dashboard_tile_image_margin_end">32dp</dimen>
+
+    <!-- SwitchBar margin start / end -->
+    <dimen name="switchbar_margin_start">24dp</dimen>
+    <dimen name="switchbar_margin_end">24dp</dimen>
+
+    <!-- SwitchBar sub settings margin start / end -->
+    <dimen name="switchbar_subsettings_margin_start">80dp</dimen>
+    <dimen name="switchbar_subsettings_margin_end">24dp</dimen>
+
+    <!-- Search title (recent / results) padding start -->
+    <dimen name="search_title_padding_start">24dp</dimen>
+
+    <!-- Result item image margin start / end -->
+    <dimen name="search_result_item_image_margin_start">24dp</dimen>
+    <dimen name="search_result_item_image_margin_end">32dp</dimen>
 
 </resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 3695d3a..0708163 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -738,6 +738,7 @@
 
     <!-- Titles for captioning character edge type preference. [CHAR LIMIT=35] -->
     <string-array name="captioning_edge_type_selector_titles">
+        <item>Default</item>
         <item>None</item>
         <item>Outline</item>
         <item>Drop shadow</item>
@@ -747,6 +748,7 @@
 
     <!-- Values for captioning character edge type preference. -->
     <integer-array name="captioning_edge_type_selector_values" translatable="false" >
+        <item>-1</item>
         <item>0</item>
         <item>1</item>
         <item>2</item>
@@ -756,6 +758,7 @@
 
     <!-- Titles for captioning color preference. -->
     <string-array name="captioning_color_selector_titles" translatable="false" >
+        <item>@string/color_unspecified</item>
         <item>@string/color_white</item>
         <item>@string/color_black</item>
         <item>@string/color_red</item>
@@ -768,6 +771,7 @@
 
     <!-- Values for captioning color preference. -->
     <integer-array name="captioning_color_selector_values" translatable="false" >
+        <item>0x00000100</item>
         <item>0xFFFFFFFF</item>
         <item>0xFF000000</item>
         <item>0xFFFF0000</item>
@@ -852,6 +856,7 @@
 
     <!-- Titles for captioning text style preset preference. [CHAR LIMIT=35] -->
     <string-array name="captioning_preset_selector_titles" >
+        <item>Use app defaults</item>
         <item>White on black</item>
         <item>Black on white</item>
         <item>Yellow on black</item>
@@ -861,6 +866,7 @@
 
     <!-- Values for captioning text style preset preference. -->
     <integer-array name="captioning_preset_selector_values" translatable="false" >
+        <item>4</item>
         <item>0</item>
         <item>1</item>
         <item>2</item>
@@ -889,6 +895,33 @@
         <item>Use ART debug build</item>
     </string-array>
 
+    <!-- Titles for logd limit size selection preference. [CHAR LIMIT=14] -->
+    <string-array name="select_logd_size_titles">
+        <item>64K</item>
+        <item>256K</item>
+        <item>1M</item>
+        <item>4M</item>
+        <item>16M</item>
+    </string-array>
+
+    <!-- Values for logd limit size selection preference. -->
+    <string-array name="select_logd_size_values" translatable="false" >
+        <item>65536</item>
+        <item>262144</item>
+        <item>1048576</item>
+        <item>4194304</item>
+        <item>16777216</item>
+    </string-array>
+
+    <!-- Summaries for logd limit size selection preference. [CHAR LIMIT=19]-->
+    <string-array name="select_logd_size_summaries" >
+        <item>64K per log buffer</item>
+        <item>256K per log buffer</item>
+        <item>1M per log buffer</item>
+        <item>4M per log buffer</item>
+        <item>16M per log buffer</item>
+    </string-array>
+
     <!-- Titles for HDCP checking preference. [CHAR LIMIT=35] -->
     <string-array name="hdcp_checking_titles">
         <item>Never check</item>
@@ -1214,4 +1247,13 @@
         <item>1</item>
         <item>2</item>
     </string-array>
+
+    <!-- Battery saver mode: allowable trigger threshold levels. -->
+    <integer-array name="battery_saver_trigger_values" translatable="false" >
+        <item>0</item>
+        <item>5</item>
+        <item>10</item>
+        <item>15</item>
+        <item>20</item>
+    </integer-array>
 </resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index c1cb5ae..86cffa9 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -96,4 +96,8 @@
     <declare-styleable name="Preference">
         <attr name="keywords" format="string" />
     </declare-styleable>
+
+    <attr name="switchBarMarginStart" format="dimension" />
+    <attr name="switchBarMarginEnd" format="dimension" />
+
 </resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 02e08c6..b835add 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -42,26 +42,18 @@
     <color name="circle_avatar_frame_shadow_color">#80000000</color>
     <color name="circle_avatar_frame_pressed_color">#ffffffff</color>
 
-    <color name="lock_pattern_background">#8000</color>
+    <color name="lock_pattern_background">#00000000</color>
+    <color name="lock_pattern_view_regular_color">#ff37474f</color>
+    <color name="lock_pattern_view_success_color">#ff009688</color>
+    <color name="lock_pattern_view_error_color">#fff4511e</color>
 
-    <color name="quantum_blue_grey_50">#ffeceff1</color>
-    <color name="quantum_blue_grey_100">#ffcfd8dc</color>
-    <color name="quantum_blue_grey_300">#ff90a4ae</color>
-    <color name="quantum_blue_grey_500">#ff607d8b</color>
-    <color name="quantum_blue_grey_700">#ff455a64</color>
+    <color name="material_empty_color_light">#FFCED7DB</color>
 
-    <color name="quantum_orange_100">#ffffe0b2</color>
-    <color name="quantum_orange_300">#ffffb74d</color>
-    <color name="quantum_orange_500">#ffff9800</color>
-    <color name="quantum_orange_700">#fff57c00</color>
-    <color name="quantum_orange_A200">#ffffab40</color>
-    <color name="quantum_orange_A400">#ffff9100</color>
+    <!-- Palette colors referenced by top-level themes. -->
+    <color name="theme_primary">#ff263238</color>
+    <color name="theme_primary_dark">#ff21272b</color>
+    <color name="theme_accent">#ff009688</color>
 
-    <color name="quantum_accent_color_light">#FF009688</color>
-    <color name="quantum_accent_color_dark">#FF80CBC4</color>
-    <color name="quantum_empty_color_light">#FFCED7DB</color>
-
-    <color name="actionbar_background_color">#ff263238</color>
     <color name="dashboard_background_color">#ffe1e1e0</color>
     <color name="switchbar_background_color">#ff384248</color>
     <color name="switch_accent_color">#ff7fcac3</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 4e4fa8e..eef43a7 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -74,7 +74,7 @@
 
     <dimen name="captioning_preview_height">200dp</dimen>
 
-    <dimen name="settings_side_margin">@*android:dimen/preference_fragment_padding_side</dimen>
+    <dimen name="settings_side_margin">0dip</dimen>
 
     <!-- Weight of the left pane in a multi-pane preference layout. -->
     <integer name="preferences_left_pane_weight">4</integer>
@@ -87,32 +87,64 @@
     <dimen name="notification_app_settings_divider_height">48dp</dimen>
     <dimen name="zen_mode_dropdown_width">160dp</dimen>
 
+    <!-- Default text size for caption preview samples. Uses dp rather than sp because captions are not scaled. -->
+    <dimen name="caption_preview_text_size">48dp</dimen>
+
+    <!-- ActionBar contentInsetStart -->
+    <dimen name="actionbar_contentInsetStart">16dp</dimen>
+    <dimen name="actionbar_subsettings_contentInsetStart">72dp</dimen>
+
     <!-- Dashboard padding between each tiles within the layout -->
     <dimen name="dashboard_cell_gap">1dp</dimen>
 
     <!-- Dashboard padding in its container -->
     <dimen name="dashboard_padding_start">1dp</dimen>
     <dimen name="dashboard_padding_end">1dp</dimen>
+    <dimen name="dashboard_padding_bottom">1dp</dimen>
 
     <!-- Dashboard category title layout height -->
     <dimen name="dashboard_category_title_height">48dp</dimen>
 
-    <!-- Dashboard category title padding start -->
-    <dimen name="dashboard_category_title_padding_start">12dp</dimen>
+    <!-- Dashboard category title margin start -->
+    <dimen name="dashboard_category_title_margin_start">15dp</dimen>
 
-    <!-- SwitchBar padding start -->
-    <dimen name="switchbar_padding_start">68dp</dimen>
-    <!-- SwitchBar padding end. Should be 2 x @*android:dimen/preference_fragment_padding_side -->
-    <dimen name="switchbar_padding_end">32dp</dimen>
+    <!-- Dashboard tile minimum height -->
+    <dimen name="dashboard_tile_minimum_height">72dp</dimen>
 
-    <!-- ActionBar contentInsetStart -->
-    <dimen name="actionbar_contentInsetStart">68dp</dimen>
+    <!-- Dashboard image tile size -->
+    <dimen name="dashboard_tile_image_size">24dp</dimen>
+
+    <!-- Dashboard tile image margin start / end -->
+    <dimen name="dashboard_tile_image_margin_start">16dp</dimen>
+    <dimen name="dashboard_tile_image_margin_end">32dp</dimen>
+
+    <!-- SwitchBar margin start / end -->
+    <dimen name="switchbar_margin_start">16dp</dimen>
+    <dimen name="switchbar_margin_end">16dp</dimen>
+
+    <!-- SwitchBar sub settings margin start / end -->
+    <dimen name="switchbar_subsettings_margin_start">72dp</dimen>
+    <dimen name="switchbar_subsettings_margin_end">16dp</dimen>
 
     <!-- Search Results padding in its container -->
     <dimen name="search_results_padding_start">1dp</dimen>
     <dimen name="search_results_padding_end">1dp</dimen>
 
     <!-- Search title (recent / results) padding start -->
-    <dimen name="search_title_padding_start">12dp</dimen>
+    <dimen name="search_title_padding_start">16dp</dimen>
+
+    <!-- Result item image size -->
+    <dimen name="search_result_item_image_size">24dp</dimen>
+
+    <!-- Result item image margin start / end -->
+    <dimen name="search_result_item_image_margin_start">16dp</dimen>
+    <dimen name="search_result_item_image_margin_end">32dp</dimen>
+
+    <!-- Suggestion item image size -->
+    <dimen name="search_suggestion_item_image_size">24dp</dimen>
+
+    <!-- Suggestion item image margin start / end -->
+    <dimen name="search_suggestion_item_image_margin_start">32dp</dimen>
+    <dimen name="search_suggestion_item_image_margin_end">16dp</dimen>
 
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ee37715..a49e118 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3136,6 +3136,12 @@
     <!-- Setting checkbox title for Whether to enable USB debugging support on the phone. -->
     <!-- Error message for users that aren't allowed to modify developer options [CHAR LIMIT=none] -->
     <string name="development_settings_not_available">Developer options are not available for this user</string>
+    <!-- Error message for users that aren't allowed to modify VPN settings [CHAR LIMIT=none] -->
+    <string name="vpn_settings_not_available">VPN settings are not available for this user</string>
+    <!-- Error message for users that aren't allowed to modify Tethering settings [CHAR LIMIT=none] -->
+    <string name="tethering_settings_not_available">Tethering settings are not available for this user</string>
+    <!-- Error message for users that aren't allowed to modify Access Point Names settings [CHAR LIMIT=none] -->
+    <string name="apn_settings_not_available">Access Point Name settings are not available for this user</string>
     <string name="enable_adb">USB debugging</string>
     <!-- Setting checkbox summary for Whether to enable USB debugging support on the phone -->
     <string name="enable_adb_summary">Debug mode when USB is connected</string>
@@ -3169,6 +3175,10 @@
     <string name="wifi_display_certification_summary">Show options for wireless display certification</string>
     <!-- Setting Checkbox title whether to enable Wifi verbose Logging [CHAR LIMIT=80] -->
     <string name="wifi_verbose_logging_summary">Increase Wifi logging level, show per SSID RSSI in WiFi Picker</string>
+    <!-- UI debug setting: limit size of Android logger buffers -->
+    <string name="select_logd_size_title">Logger buffer sizes</string>
+    <!-- UI debug setting: limit size of Android logger buffers [CHAR LIMIT=34] -->
+    <string name="select_logd_size_dialog_title">Select Logger sizes per log buffer</string>
     <!-- Setting Checkbox title whether to allow mock locations -->
     <string name="allow_mock_location">Allow mock locations</string>
     <!-- setting Checkbox summary whether to allow mock locations  -->
@@ -3383,7 +3393,9 @@
     <!-- Label for the default device locale. [CHAR LIMIT=35] -->
     <string name="locale_default">Default</string>
 
-    <!-- Label for no color. [CHAR LIMIT=35] -->
+    <!-- Label for default color. This lets the app pick the color. [CHAR LIMIT=35] -->
+    <string name="color_unspecified">Default</string>
+    <!-- Label for no color (transparent). [CHAR LIMIT=35] -->
     <string name="color_none">None</string>
     <!-- Label for the color white. [CHAR LIMIT=35] -->
     <string name="color_white">White</string>
@@ -3577,16 +3589,6 @@
     <string name="battery_stats_phone_signal_label">Mobile network signal</string>
     <!-- Battery usage during last unplugged period -->
     <string name="battery_stats_last_duration">@string/menu_stats_last_unplugged</string>
-    <!-- [CHAR_LIMIT=5] Label for an hour time when using 24 hour mode -->
-    <string name="battery_stats_hour_24_label"><xliff:g id="time">%1$d</xliff:g>:00</string>
-    <!-- [CHAR_LIMIT=5] Label for an hour time when using 12 hour mode in the AM -->
-    <string name="battery_stats_hour_am_label"><xliff:g id="time">%1$d</xliff:g> AM</string>
-    <!-- [CHAR_LIMIT=5] Label for an hour time when using 12 hour mode in the PM -->
-    <string name="battery_stats_hour_pm_label"><xliff:g id="time">%1$d</xliff:g> PM</string>
-    <!-- [CHAR_LIMIT=3] Label for date of day and month (not year) when the day is shown first -->
-    <string name="battery_stats_date_day_first_label"><xliff:g id="day">%1$d</xliff:g>/<xliff:g id="month">%2$d</xliff:g></string>
-    <!-- [CHAR_LIMIT=3] Label for date of day and month (not year) when the month is shown first -->
-    <string name="battery_stats_date_month_first_label"><xliff:g id="month">%2$d</xliff:g>/<xliff:g id="day">%1$d</xliff:g></string>
     <!-- CPU awake time title -->
     <string name="awake">Device awake time</string>
     <!-- Wifi on time -->
@@ -3744,6 +3746,24 @@
     <!-- Label for mediaserver process -->
     <string name="process_mediaserver_label">Mediaserver</string>
 
+    <!-- [CHAR_LIMIT=40] Battery saver: Label for feature, title + menu item -->
+    <string name="battery_saver">Battery saver</string>
+
+    <!-- [CHAR_LIMIT=40] Battery saver: Title for always on option -->
+    <string name="battery_saver_always_on_title">Always on</string>
+
+    <!-- [CHAR_LIMIT=40] Battery saver: Title for automatic entry option -->
+    <string name="battery_saver_turn_on_automatically_title">Turn on automatically</string>
+
+    <!-- [CHAR_LIMIT=40] Battery saver: Value for automatic entry option: Never -->
+    <string name="battery_saver_turn_on_automatically_never">Never</string>
+
+    <!-- [CHAR_LIMIT=40] Battery saver: Value for automatic entry option: pct% battery -->
+    <string name="battery_saver_turn_on_automatically_pct">at %1$d%% battery</string>
+
+    <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description -->
+    <string name="battery_saver_description">To help improve battery life, Battery saver will reduce your device’s performance.\n\nBattery saver will be disabled when your device is plugged in.</string>
+
     <!-- Process Stats strings -->
     <skip />
 
@@ -4007,6 +4027,8 @@
     <string name="credential_storage_type_hardware">Hardware-backed</string>
     <!-- Summary text for preference showing what type of credential storage this device has when it is stored in software only (as opposed to "hardware-backed") [CHAR LIMIT=NONE] -->
     <string name="credential_storage_type_software">Software only</string>
+    <!-- Error message for users that aren't allowed to see or modify credentials [CHAR LIMIT=none] -->
+    <string name="credentials_settings_not_available">Credentials are not available for this user</string>
 
     <!-- Message to draw an unlock pattern when installing credentials -->
     <string name="credentials_install_gesture_prompt">Draw your unlock pattern</string>
@@ -4117,7 +4139,7 @@
     <string name="untitled_apn">Untitled</string>
 
     <string name="sound_category_sound_title">General</string>
-    <string name="sound_category_notification_title">Notifications</string>
+    <string name="notification_log_title">Notification log</string>
 
     <!-- Category title for phone call's ringtone and vibration settings in the Sound Setting.
          [CHAR LIMIT=40] -->
@@ -5085,120 +5107,120 @@
 
     <!-- Sounds and Notifications -->
 
-    <!-- Sounds & notifications: Settings header. [CHAR LIMIT=20] -->
-    <string name="notification_settings">Sounds &amp; Notifications</string>
+    <!-- Sound & notifications: Settings header. [CHAR LIMIT=20] -->
+    <string name="notification_settings">Sound &amp; Notifications</string>
 
-    <!-- Sounds & notifications: Title for the option managing media volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the option managing media volume. [CHAR LIMIT=30] -->
     <string name="media_volume_option_title">Media volume</string>
 
-    <!-- Sounds & notifications: Title for the option managing alarm volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the option managing alarm volume. [CHAR LIMIT=30] -->
     <string name="alarm_volume_option_title">Alarm volume</string>
 
-    <!-- Sounds & notifications: Title for the option managing ringer volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the option managing ringer volume. [CHAR LIMIT=30] -->
     <string name="ring_volume_option_title">Ring volume</string>
 
-    <!-- Sounds & notifications: Title for the option managing notification volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the option managing notification volume. [CHAR LIMIT=30] -->
     <string name="notification_volume_option_title">Notification volume</string>
 
-    <!-- Sounds & notifications: Title for the Do not disturb option and associated settings page. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the Do not disturb option and associated settings page. [CHAR LIMIT=30] -->
     <string name="zen_mode_settings_title">Do not disturb</string>
 
-    <!-- Sounds & notifications: Title for the ringer mode option. [CHAR LIMIT=60] -->
+    <!-- Sound & notifications: Title for the ringer mode option. [CHAR LIMIT=60] -->
     <string name="ringer_mode_title">When calls and notifications arrive</string>
 
-    <!-- Sounds & notifications: Title for the ringer mode option on devices without voice. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the ringer mode option on devices without voice. [CHAR LIMIT=30] -->
     <string name="ringer_mode_title_novoice">When notifications arrive</string>
 
-    <!-- Sounds & notifications: Value for the ringer mode option when audible. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Value for the ringer mode option when audible. [CHAR LIMIT=30] -->
     <string name="ringer_mode_audible">Ring</string>
 
-    <!-- Sounds & notifications: Value for the ringer mode option when vibrate. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Value for the ringer mode option when vibrate. [CHAR LIMIT=30] -->
     <string name="ringer_mode_vibrate">Vibrate instead of ringing</string>
 
-    <!-- Sounds & notifications: Value for the ringer mode option when silent. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Value for the ringer mode option when silent. [CHAR LIMIT=30] -->
     <string name="ringer_mode_silent">Don\'t ring or vibrate</string>
 
-    <!-- Sounds & notifications: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
     <string name="ringtone_title">Phone ringtone</string>
 
-    <!-- Sounds & notifications: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
     <string name="notification_ringtone_title">Default notification ringtone</string>
 
-    <!-- Sounds & notifications: Title for the option managing whether or not to vibrate when ringing. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the option managing whether or not to vibrate when ringing. [CHAR LIMIT=30] -->
     <string name="vibrate_when_ringing_title">Vibrate when ringing</string>
 
-    <!-- Sounds & notifications: Title for the showing notifications option and associated settings page. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the showing notifications option and associated settings page. [CHAR LIMIT=30] -->
     <string name="notification_display_settings">Showing notifications</string>
 
-    <!-- Sounds & notifications > Showing notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Showing notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
     <string name="notification_pulse_title">Pulse notification light</string>
 
-    <!-- Sounds & notifications > Showing notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Showing notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
     <string name="lock_screen_notifications_title">When device is locked</string>
 
-    <!-- Sounds & notifications > Showing notifications: Value for lockscreen notifications:  all information will be
+    <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications:  all information will be
          shown in notifications shown on a secure lock screen
          [CHAR LIMIT=50] -->
     <string name="lock_screen_notifications_summary_show">Show all notification content</string>
 
-    <!-- Sounds & notifications > Showing notifications: Value for lockscreen notifications: sensitive information will be
+    <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications: sensitive information will be
          hidden or redacted from notifications shown on a secure lock screen
          [CHAR LIMIT=50] -->
     <string name="lock_screen_notifications_summary_hide">Hide sensitive notification content</string>
 
-    <!-- Sounds & notifications > Showing notifications: Value for lockscreen notifications: notifications will not appear on a secure lock screen
+    <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications: notifications will not appear on a secure lock screen
          [CHAR LIMIT=50] -->
     <string name="lock_screen_notifications_summary_disable">Don\'t show notifications at all</string>
 
-    <!-- Sounds & notifications > Showing notifications: Title for the option managing notification display in zen mode. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Showing notifications: Title for the option managing notification display in zen mode. [CHAR LIMIT=30] -->
     <string name="zen_mode_notifications_title">When do not disturb is on</string>
 
-    <!-- Sounds & notifications > Showing notifications: Value for zen mode notifications: notifications will be suppressed in zen mode [CHAR LIMIT=50] -->
+    <!-- Sound & notifications > Showing notifications: Value for zen mode notifications: notifications will be suppressed in zen mode [CHAR LIMIT=50] -->
     <string name="zen_mode_notifications_summary_hide">Hide new notifications from the list</string>
 
-    <!-- Sounds & notifications > Showing notifications: Value for zen mode notifications: notifications will be displayed in zen mode [CHAR LIMIT=50] -->
+    <!-- Sound & notifications > Showing notifications: Value for zen mode notifications: notifications will be displayed in zen mode [CHAR LIMIT=50] -->
     <string name="zen_mode_notifications_summary_show">Show all notifications in the list</string>
 
-    <!-- Sounds & notifications > Showing notifications: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Showing notifications: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
     <string name="app_notifications_title">App notifications</string>
 
-    <!-- Sounds & notifications: Title for the other sounds option and associated settings page. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for the other sounds option and associated settings page. [CHAR LIMIT=30] -->
     <string name="other_sound_settings">Other sounds</string>
 
-    <!-- Sounds & notifications > Other sounds: Title for the option enabling touch sounds for dial pad tones. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds for dial pad tones. [CHAR LIMIT=30] -->
     <string name="dial_pad_tones_title">Dial pad tones</string>
 
-    <!-- Sounds & notifications > Other sounds: Title for the option enabling touch sounds for screen locking sounds. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds for screen locking sounds. [CHAR LIMIT=30] -->
     <string name="screen_locking_sounds_title">Screen locking sounds</string>
 
-    <!-- Sounds & notifications > Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
     <string name="docking_sounds_title">Docking sounds</string>
 
-    <!-- Sounds & notifications > Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
     <string name="touch_sounds_title">Touch sounds</string>
 
-    <!-- Sounds & notifications > Other sounds: Title for the option enabling haptic feedback on touch. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Title for the option enabling haptic feedback on touch. [CHAR LIMIT=30] -->
     <string name="vibrate_on_touch_title">Vibrate on touch</string>
 
-    <!-- Sounds & notifications > Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=30] -->
     <string name="dock_audio_media_title">Dock speaker plays</string>
 
-    <!-- Sounds & notifications > Other sounds: Value for the dock audio media with value 0: disabled. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Value for the dock audio media with value 0: disabled. [CHAR LIMIT=30] -->
     <string name="dock_audio_media_disabled">All audio</string>
 
-    <!-- Sounds & notifications > Other sounds: Value for the dock audio media with value 1: enabled. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Value for the dock audio media with value 1: enabled. [CHAR LIMIT=30] -->
     <string name="dock_audio_media_enabled">Media audio only</string>
 
-    <!-- Sounds & notifications > Other sounds: Value for the emergency tone option with value 0: silent. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 0: silent. [CHAR LIMIT=30] -->
     <string name="emergency_tone_silent">Silent</string>
 
-    <!-- Sounds & notifications > Other sounds: Value for the emergency tone option with value 1: alert. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 1: alert. [CHAR LIMIT=30] -->
     <string name="emergency_tone_alert">Alert</string>
 
-    <!-- Sounds & notifications > Other sounds: Value for the emergency tone option with value 2: vibrate. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 2: vibrate. [CHAR LIMIT=30] -->
     <string name="emergency_tone_vibrate">Vibrate</string>
 
-    <!-- Sounds & notifications: Title for managing notification listeners option. [CHAR LIMIT=30] -->
+    <!-- Sound & notifications: Title for managing notification listeners option. [CHAR LIMIT=30] -->
     <string name="manage_notification_access_title">Notification access</string>
 
     <!-- Summary of preference to manage notification listeners, when none are enabled -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 79ed972..26b0ef3 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -57,7 +57,7 @@
     </style>
 
 
-    <style name="TextAppearance" parent="android:TextAppearance.Quantum">
+    <style name="TextAppearance" parent="android:TextAppearance.Material">
     </style>
 
     <style name="TextAppearance.info_label">
@@ -75,7 +75,7 @@
         <item name="android:textStyle">normal</item>
     </style>
 
-    <style name="TextAppearance.PasswordEntry" parent="android:TextAppearance.Quantum">
+    <style name="TextAppearance.PasswordEntry" parent="android:TextAppearance.Material">
         <item name="android:gravity">center</item>
         <item name="android:singleLine">true</item>
         <item name="android:textStyle">bold</item>
@@ -202,18 +202,18 @@
         <item name="android:windowIsFloating">true</item>
     </style>
 
-    <style name="CryptKeeperBlankTheme" parent="@android:style/Theme.Quantum.Light.NoActionBar">
+    <style name="CryptKeeperBlankTheme" parent="@android:style/Theme.Material.Light.NoActionBar">
         <item name="android:background">#ff000000</item>
     </style>
 
-    <style name="SecurityPreferenceButtonContainer" parent="@android:style/Widget.Quantum.Light.SegmentedButton">
+    <style name="SecurityPreferenceButtonContainer" parent="@android:style/Widget.Material.Light.SegmentedButton">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:weightSum">2</item>
         <item name="android:dividerPadding">8dip</item>
     </style>
 
-    <style name="SecurityPreferenceButton" parent="@android:style/Widget.Quantum.Light.Button.Borderless">
+    <style name="SecurityPreferenceButton" parent="@android:style/Widget.Material.Light.Button.Borderless">
         <item name="android:layout_width">0dip</item>
         <item name="android:layout_weight">1</item>
         <item name="android:layout_height">wrap_content</item>
@@ -239,7 +239,7 @@
         <item name="android:widgetLayout">@layout/preference_inputmethod_widget</item>
     </style>
 
-    <style name="TextAppearance.PagerTabs" parent="@android:style/TextAppearance.Quantum.Small">
+    <style name="TextAppearance.PagerTabs" parent="@android:style/TextAppearance.Material.Small">
         <item name="android:textAllCaps">true</item>
         <item name="android:textStyle">bold</item>
     </style>
@@ -255,23 +255,23 @@
         <item name="android:layout">@layout/apn_preference_layout</item>
     </style>
 
-    <style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Quantum.Medium">
+    <style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Material.Medium">
     </style>
 
-    <style name="TextAppearance.Small" parent="@android:style/TextAppearance.Quantum.Small">
+    <style name="TextAppearance.Small" parent="@android:style/TextAppearance.Material.Small">
     </style>
 
     <style name="TextAppearance.Switch" parent="TextAppearance.Medium">
     </style>
 
-    <style name="TextAppearance.CategoryTitle" parent="@android:style/TextAppearance.Quantum.Small">
+    <style name="TextAppearance.CategoryTitle" parent="@android:style/TextAppearance.Material.Small">
         <item name="android:textColor">#FF009688</item>
     </style>
 
-    <style name="TextAppearance.TileTitle" parent="@android:style/TextAppearance.Quantum.Medium">
+    <style name="TextAppearance.TileTitle" parent="@android:style/TextAppearance.Material.Medium">
     </style>
 
-    <style name="TextAppearance.TileSubTitle" parent="@android:style/TextAppearance.Quantum.Small">
+    <style name="TextAppearance.TileSubTitle" parent="@android:style/TextAppearance.Material.Small">
     </style>
 
     <style name="TextAppearance.RecentsTitle" parent="TextAppearance.CategoryTitle">
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 402f6dd..e23b300 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -21,46 +21,53 @@
     <attr name="setup_divider_color" format="reference" />
     <attr name="wifi_signal" format="reference" />
 
-    <style name="SetupWizardWifiTheme" parent="android:Theme.Quantum.NoActionBar">
+    <style name="SetupWizardWifiTheme" parent="android:Theme.Material.NoActionBar">
         <item name="android:windowSoftInputMode">adjustPan</item>
         <item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
         <item name="android:alertDialogTheme">@style/Theme.WifiDialog</item>
         <item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
-        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
         <item name="ic_wps">@drawable/ic_wps_dark</item>
         <item name="setup_divider_color">@color/setup_divider_color_dark</item>
         <item name="wifi_signal">@drawable/wifi_signal_dark</item>
+        <item name="switchBarMarginStart">0dip</item>
+        <item name="switchBarMarginEnd">0dip</item>
     </style>
 
-    <style name="SetupWizardWifiTheme.Light" parent="android:Theme.Quantum.Light.NoActionBar">
+    <style name="SetupWizardWifiTheme.Light" parent="android:Theme.Material.Light.NoActionBar">
         <item name="android:windowSoftInputMode">adjustPan</item>
         <item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
         <item name="android:alertDialogTheme">@style/Theme.Light.WifiDialog</item>
         <item name="ic_menu_add">@drawable/ic_menu_add_light</item>
-        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
         <item name="ic_wps">@drawable/ic_wps_light</item>
         <item name="setup_divider_color">@color/setup_divider_color_light</item>
         <item name="wifi_signal">@drawable/wifi_signal_light</item>
+        <item name="switchBarMarginStart">0dip</item>
+        <item name="switchBarMarginEnd">0dip</item>
     </style>
 
-    <style name="Theme.WifiDialog" parent="@*android:style/Theme.Quantum.Dialog.Alert">
+    <style name="Theme.WifiDialog" parent="@*android:style/Theme.Material.Dialog.Alert">
         <item name="android:windowSoftInputMode">adjustResize</item>
         <item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
-        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
         <item name="ic_wps">@drawable/ic_wps_dark</item>
         <item name="wifi_signal">@drawable/wifi_signal_dark</item>
     </style>
 
-    <style name="Theme.Light.WifiDialog" parent="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+    <style name="Theme.Light.WifiDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert">
         <item name="android:windowSoftInputMode">adjustResize</item>
         <item name="ic_menu_add">@drawable/ic_menu_add_light</item>
-        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+        <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
         <item name="ic_wps">@drawable/ic_wps_light</item>
         <item name="wifi_signal">@drawable/wifi_signal_light</item>
     </style>
 
-    <!-- Theme with no local references, used by AccountPreferenceBase. -->
-    <style name="Theme.SettingsBase" parent="@android:style/Theme.Quantum.Light.DarkActionBar" />
+    <!-- Theme with no local references, used by AccountPreferenceBase where we have to inflate
+         layouts against a remote context using our local theme colors. Due to the implementation
+         details of Theme, we can't reference any local resources and MUST instead use the values
+         directly. So use #ff263238 instead of @color/theme_primary and so on. -->
+    <style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Settings" />
 
     <style name="Theme.Settings" parent="Theme.SettingsBase">
         <item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item>
@@ -74,44 +81,71 @@
         <item name="ic_wps">@drawable/ic_wps_dark</item>
         <item name="wifi_signal">@drawable/wifi_signal_dark</item>
 
-        <item name="android:colorPrimary">@color/actionbar_background_color</item>
-        <!-- Used by the StatusBar and NavBar -->
-        <item name="android:colorPrimaryDark">@color/actionbar_background_color</item>
-        <!-- Redefine control activited color for progress bars and the like -->
-        <item name="android:colorAccent">@color/quantum_accent_color_light</item>
+        <item name="switchBarMarginStart">@dimen/switchbar_margin_start</item>
+        <item name="switchBarMarginEnd">@dimen/switchbar_margin_end</item>
+
         <!-- Redefine the ActionBar style for contentInsetStart -->
         <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
 
         <item name="android:alertDialogTheme">@style/Theme.AlertDialog</item>
+
+        <!-- LockPatternView colors -->
+        <item name="@*android:regularColor">@color/lock_pattern_view_regular_color</item>
+        <item name="@*android:successColor">@color/lock_pattern_view_success_color</item>
+        <item name="@*android:errorColor">@color/lock_pattern_view_error_color</item>
+
     </style>
 
-    <style name="Theme.ActionBar" parent="@android:style/Widget.Quantum.Light.ActionBar.Solid">
+    <style name="Theme.ActionBar" parent="@android:style/Widget.Material.Light.ActionBar.Solid">
         <item name="android:contentInsetStart">@dimen/actionbar_contentInsetStart</item>
     </style>
 
-    <style name="Theme.DialogWhenLarge" parent="android:style/Theme.Quantum.Light.DialogWhenLarge">
-        <item name="android:colorPrimary">@color/actionbar_background_color</item>
-        <!-- Used by the StatusBar and NavBar -->
-        <item name="android:colorPrimaryDark">@color/actionbar_background_color</item>
-        <!-- Redefine control activited color for progress bars and the like -->
-        <item name="android:colorAccent">@color/quantum_accent_color_light</item>
+    <style name="Theme.SubSettings" parent="Theme.Settings">
+        <!-- Redefine the ActionBar style for contentInsetStart -->
+        <item name="android:actionBarStyle">@style/Theme.SubSettingsActionBar</item>
+
+        <item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
+        <item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
+    </style>
+
+    <style name="Theme.SubSettingsActionBar" parent="Theme.ActionBar">
+        <item name="android:contentInsetStart">@dimen/actionbar_subsettings_contentInsetStart</item>
+    </style>
+
+    <style name="Theme.DialogWhenLarge" parent="@android:style/Theme.Material.Light.DialogWhenLarge">
+        <!-- Used by the ActionBar -->
+        <item name="android:colorPrimary">@color/theme_primary</item>
+        <!-- Used by the StatusBar -->
+        <item name="android:colorPrimaryDark">@color/theme_primary_dark</item>
+        <!-- Used by controls, e.g. CheckBox, ProgressBar, etc. -->
+        <item name="android:colorAccent">@color/theme_accent</item>
+
         <!-- Redefine the ActionBar style for contentInsetStart -->
         <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
     </style>
 
-    <style name="Theme.SubSettingsDialogWhenLarge" parent="Theme.DialogWhenLarge">
-        <item name="android:actionBarWidgetTheme">@null</item>
-        <item name="android:actionBarTheme">@android:style/ThemeOverlay.Quantum.Dark.ActionBar</item>
+    <style name="Theme.CryptKeeper" parent="@android:style/Theme.Material.Light.NoActionBar">
+        <!-- LockPatternView colors -->
+        <item name="@*android:regularColor">@color/lock_pattern_view_regular_color</item>
+        <item name="@*android:successColor">@color/lock_pattern_view_success_color</item>
+        <item name="@*android:errorColor">@color/lock_pattern_view_error_color</item>
     </style>
 
-    <style name="Theme.AlertDialog" parent="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+    <style name="Theme.SubSettingsDialogWhenLarge" parent="Theme.DialogWhenLarge">
+        <item name="android:actionBarWidgetTheme">@null</item>
+        <item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item>
+    </style>
+
+    <style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert">
         <item name="android:windowSoftInputMode">adjustResize</item>
 
-        <item name="android:colorPrimary">@color/actionbar_background_color</item>
-        <!-- Used by the StatusBar and NavBar -->
-        <item name="android:colorPrimaryDark">@color/actionbar_background_color</item>
-        <!-- Redefine control activited color for progress bars and the like -->
-        <item name="android:colorAccent">@color/quantum_accent_color_light</item>
+        <!-- Used by the ActionBar -->
+        <item name="android:colorPrimary">@color/theme_primary</item>
+        <!-- Used by the StatusBar -->
+        <item name="android:colorPrimaryDark">@color/theme_primary_dark</item>
+        <!-- Used by controls, e.g. CheckBox, ProgressBar, etc. -->
+        <item name="android:colorAccent">@color/theme_accent</item>
+
         <!-- Redefine the ActionBar style for contentInsetStart -->
         <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
     </style>
diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml
new file mode 100644
index 0000000..472586a
--- /dev/null
+++ b/res/xml/battery_saver_settings.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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"
+        android:title="@string/battery_saver"
+        android:key="battery_saver">
+
+    <!-- Always on -->
+    <SwitchPreference
+            android:key="always_on"
+            android:title="@string/battery_saver_always_on_title"
+            android:switchTextOff=""
+            android:switchTextOn=""
+            android:persistent="false" />
+
+    <!-- Turn on automatically -->
+    <com.android.settings.notification.DropDownPreference
+            android:key="turn_on_automatically"
+            android:title="@string/battery_saver_turn_on_automatically_title"
+            android:persistent="false" />
+
+    <!-- Feature description text -->
+    <Preference
+            android:key="description"
+            android:summary="@string/battery_saver_description"
+            android:persistent="false"
+            android:selectable="false" />
+
+</PreferenceScreen>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index d435371..f0b17f9 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -111,6 +111,13 @@
             android:title="@string/wifi_verbose_logging" />
             android:summary="@string/wifi_verbose_logging_summary"/>
 
+        <ListPreference
+            android:key="select_logd_size"
+            android:title="@string/select_logd_size_title"
+            android:dialogTitle="@string/select_logd_size_dialog_title"
+            android:entries="@array/select_logd_size_titles"
+            android:entryValues="@array/select_logd_size_values" />
+
     </PreferenceCategory>
 
     <PreferenceCategory android:key="debug_input_category"
diff --git a/res/xml/security_settings_nfc_unlock.xml b/res/xml/security_settings_nfc_unlock.xml
deleted file mode 100644
index 63e5a74..0000000
--- a/res/xml/security_settings_nfc_unlock.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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/lock_settings_nfc_title">
-
-    <CheckBoxPreference
-            android:key="nfc_unlock_enabled"
-            android:title="@string/nfc_unlock_enabled"
-            android:persistent="false" />
-
-    <Preference
-            android:key="nfc_pairing"
-            android:title="@string/start_nfc_pairing"
-            android:persistent="false"
-            android:dependency="nfc_unlock_enabled" >
-            <intent android:action="android.settings.PAIR_NFC_DEVICE"/>
-    </Preference>
-
-    </PreferenceCategory>
-
-        <PreferenceCategory
-            android:key="nfc_unlock_tags_category"
-            android:title="@string/nfc_unlock_paired_tags_title">
-        </PreferenceCategory>
-
-</PreferenceScreen>
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index 3fbb5e3..ef79f2b 100644
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -32,6 +32,7 @@
 import android.os.HandlerThread;
 import android.os.Looper;
 import android.os.Message;
+import android.os.UserManager;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceGroup;
@@ -83,10 +84,14 @@
     private RestoreApnProcessHandler mRestoreApnProcessHandler;
     private HandlerThread mRestoreDefaultApnThread;
 
+    private UserManager mUm;
+
     private String mSelectedKey;
 
     private IntentFilter mMobileStateFilter;
 
+    private boolean mUnavailable;
+
     private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
@@ -119,6 +124,14 @@
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
+        mUm = (UserManager) getSystemService(Context.USER_SERVICE);
+
+        if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
+            mUnavailable = true;
+            setContentView(R.layout.apn_disallowed_preference_screen);
+            return;
+        }
+
         addPreferencesFromResource(R.xml.apn_settings);
         getListView().setItemsCanFocus(true);
 
@@ -130,6 +143,10 @@
     protected void onResume() {
         super.onResume();
 
+        if (mUnavailable) {
+            return;
+        }
+
         registerReceiver(mMobileStateReceiver, mMobileStateFilter);
 
         if (!mRestoreDefaultApnMode) {
@@ -143,6 +160,10 @@
     protected void onPause() {
         super.onPause();
 
+        if (mUnavailable) {
+            return;
+        }
+
         unregisterReceiver(mMobileStateReceiver);
     }
 
diff --git a/src/com/android/settings/CredentialStorage.java b/src/com/android/settings/CredentialStorage.java
index fcf208a..f515b36 100644
--- a/src/com/android/settings/CredentialStorage.java
+++ b/src/com/android/settings/CredentialStorage.java
@@ -19,6 +19,7 @@
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.admin.DevicePolicyManager;
+import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.res.Resources;
@@ -26,6 +27,7 @@
 import android.os.Bundle;
 import android.os.RemoteException;
 import android.os.Process;
+import android.os.UserManager;
 import android.security.Credentials;
 import android.security.KeyChain.KeyChainConnection;
 import android.security.KeyChain;
@@ -38,8 +40,8 @@
 import android.widget.Button;
 import android.widget.TextView;
 import android.widget.Toast;
-import com.android.internal.widget.LockPatternUtils;
 
+import com.android.internal.widget.LockPatternUtils;
 import com.android.org.bouncycastle.asn1.ASN1InputStream;
 import com.android.org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
 
@@ -119,16 +121,20 @@
 
         Intent intent = getIntent();
         String action = intent.getAction();
-
-        if (ACTION_RESET.equals(action)) {
-            new ResetDialog();
-        } else {
-            if (ACTION_INSTALL.equals(action)
-                    && "com.android.certinstaller".equals(getCallingPackage())) {
-                mInstallBundle = intent.getExtras();
+        UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
+        if (!userManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) {
+            if (ACTION_RESET.equals(action)) {
+                new ResetDialog();
+            } else {
+                if (ACTION_INSTALL.equals(action)
+                        && "com.android.certinstaller".equals(getCallingPackage())) {
+                    mInstallBundle = intent.getExtras();
+                }
+                // ACTION_UNLOCK also handled here in addition to ACTION_INSTALL
+                handleUnlockOrInstall();
             }
-            // ACTION_UNLOCK also handled here in addition to ACTION_INSTALL
-            handleUnlockOrInstall();
+        } else {
+            finish();
         }
     }
 
@@ -270,7 +276,6 @@
         private ResetDialog() {
             AlertDialog dialog = new AlertDialog.Builder(CredentialStorage.this)
                     .setTitle(android.R.string.dialog_alert_title)
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(R.string.credentials_reset_hint)
                     .setPositiveButton(android.R.string.ok, this)
                     .setNegativeButton(android.R.string.cancel, this)
@@ -340,7 +345,6 @@
         private ConfigureKeyGuardDialog() {
             AlertDialog dialog = new AlertDialog.Builder(CredentialStorage.this)
                     .setTitle(android.R.string.dialog_alert_title)
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(R.string.credentials_configure_lock_screen_hint)
                     .setPositiveButton(android.R.string.ok, this)
                     .setNegativeButton(android.R.string.cancel, this)
diff --git a/src/com/android/settings/CryptKeeperSettings.java b/src/com/android/settings/CryptKeeperSettings.java
index 1846580..7f7a675 100644
--- a/src/com/android/settings/CryptKeeperSettings.java
+++ b/src/com/android/settings/CryptKeeperSettings.java
@@ -87,7 +87,6 @@
                 // TODO replace (or follow) this dialog with an explicit launch into password UI
                 new AlertDialog.Builder(getActivity())
                     .setTitle(R.string.crypt_keeper_dialog_need_password_title)
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(R.string.crypt_keeper_dialog_need_password_message)
                     .setPositiveButton(android.R.string.ok, null)
                     .create()
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index fe7a217..02045ab 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -122,7 +122,6 @@
     private static final String USE_NUPLAYER_KEY = "use_nuplayer";
     private static final String USE_NUPLAYER_PROPERTY = "persist.sys.media.use-nuplayer";
     private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
-    private static final String LOW_POWER_MODE_KEY = "low_power_mode";
     private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
     private static final String FORCE_MSAA_KEY = "force_msaa";
     private static final String TRACK_FRAME_TIME_KEY = "track_frame_time";
@@ -140,6 +139,9 @@
     private static final String DEBUG_APPLICATIONS_CATEGORY_KEY = "debug_applications_category";
     private static final String WIFI_DISPLAY_CERTIFICATION_KEY = "wifi_display_certification";
     private static final String WIFI_VERBOSE_LOGGING_KEY = "wifi_verbose_logging";
+    private static final String SELECT_LOGD_SIZE_KEY = "select_logd_size";
+    private static final String SELECT_LOGD_SIZE_PROPERTY = "persist.logd.size";
+    private static final String SELECT_LOGD_DEFAULT_SIZE_PROPERTY = "ro.logd.size";
 
     private static final String OPENGL_TRACES_KEY = "enable_opengl_traces";
 
@@ -168,7 +170,6 @@
     private WifiManager mWifiManager;
 
     private SwitchBar mSwitchBar;
-    private Switch mEnabledSwitch;
     private boolean mLastEnabledState;
     private boolean mHaveDebugSettings;
     private boolean mDontPokeProperties;
@@ -196,7 +197,6 @@
     private CheckBoxPreference mShowScreenUpdates;
     private CheckBoxPreference mDisableOverlays;
     private CheckBoxPreference mShowCpuUsage;
-    private CheckBoxPreference mLowPowerMode;
     private CheckBoxPreference mForceHardwareUi;
     private CheckBoxPreference mForceMsaa;
     private CheckBoxPreference mShowHwScreenUpdates;
@@ -204,6 +204,7 @@
     private CheckBoxPreference mDebugLayout;
     private CheckBoxPreference mForceRtlLayout;
     private ListPreference mDebugHwOverdraw;
+    private ListPreference mLogdSize;
     private ListPreference mTrackFrameTime;
     private ListPreference mShowNonRectClip;
     private ListPreference mWindowAnimationScale;
@@ -308,7 +309,6 @@
         mShowScreenUpdates = findAndInitCheckboxPref(SHOW_SCREEN_UPDATES_KEY);
         mDisableOverlays = findAndInitCheckboxPref(DISABLE_OVERLAYS_KEY);
         mShowCpuUsage = findAndInitCheckboxPref(SHOW_CPU_USAGE_KEY);
-        mLowPowerMode = findAndInitCheckboxPref(LOW_POWER_MODE_KEY);
         mForceHardwareUi = findAndInitCheckboxPref(FORCE_HARDWARE_UI_KEY);
         mForceMsaa = findAndInitCheckboxPref(FORCE_MSAA_KEY);
         mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
@@ -320,6 +320,8 @@
         mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
         mWifiDisplayCertification = findAndInitCheckboxPref(WIFI_DISPLAY_CERTIFICATION_KEY);
         mWifiVerboseLogging = findAndInitCheckboxPref(WIFI_VERBOSE_LOGGING_KEY);
+        mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
+
         mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
         mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
         mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
@@ -389,11 +391,12 @@
         final SettingsActivity activity = (SettingsActivity) getActivity();
 
         mSwitchBar = activity.getSwitchBar();
-        mEnabledSwitch = mSwitchBar.getSwitch();
-        if (mUnavailable) {
-            mEnabledSwitch.setEnabled(false);
+       if (mUnavailable) {
+            mSwitchBar.setEnabled(false);
             return;
         }
+
+        mSwitchBar.addOnSwitchChangeListener(this);
     }
 
     private boolean removePreferenceForProduction(Preference preference) {
@@ -444,7 +447,7 @@
         final ContentResolver cr = getActivity().getContentResolver();
         mLastEnabledState = Settings.Global.getInt(cr,
                 Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
-        mEnabledSwitch.setChecked(mLastEnabledState);
+        mSwitchBar.setChecked(mLastEnabledState);
         setPrefsEnabledState(mLastEnabledState);
 
         if (mHaveDebugSettings && !mLastEnabledState) {
@@ -455,18 +458,19 @@
             Settings.Global.putInt(getActivity().getContentResolver(),
                     Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
             mLastEnabledState = true;
-            mEnabledSwitch.setChecked(mLastEnabledState);
+            mSwitchBar.setChecked(mLastEnabledState);
             setPrefsEnabledState(mLastEnabledState);
         }
-
-        mSwitchBar.addOnSwitchChangeListener(this);
         mSwitchBar.show();
     }
 
     @Override
-    public void onPause() {
-        super.onPause();
+    public void onDestroyView() {
+        super.onDestroyView();
 
+        if (mUnavailable) {
+            return;
+        }
         mSwitchBar.removeOnSwitchChangeListener(this);
         mSwitchBar.hide();
     }
@@ -504,7 +508,6 @@
         updateShowTouchesOptions();
         updateFlingerOptions();
         updateCpuUsageOptions();
-        updateLowPowerModeOptions();
         updateHardwareUiOptions();
         updateMsaaOptions();
         updateTrackFrameTimeOptions();
@@ -523,6 +526,7 @@
         updateVerifyAppsOverUsbOptions();
         updateBugreportOptions();
         updateForceRtlOptions();
+        updateLogdSizeValues();
         updateWifiDisplayCertificationOptions();
         updateWifiVerboseLoggingOptions();
         updateSimulateColorSpace();
@@ -539,6 +543,7 @@
             }
         }
         resetDebuggerOptions();
+        writeLogdSizeOption(null);
         writeAnimationScaleOption(0, mWindowAnimationScale, null);
         writeAnimationScaleOption(1, mTransitionAnimationScale, null);
         writeAnimationScaleOption(2, mAnimatorDurationScale, null);
@@ -1040,9 +1045,41 @@
         mWifiManager.enableVerboseLogging(mWifiVerboseLogging.isChecked() ? 1 : 0);
     }
 
-    private void updateLowPowerModeOptions() {
-        updateCheckBox(mLowPowerMode, Settings.Global.getInt(getActivity().getContentResolver(),
-                Settings.Global.LOW_POWER_MODE, 0) != 0);
+    private void updateLogdSizeValues() {
+        if (mLogdSize != null) {
+            String currentValue = SystemProperties.get(SELECT_LOGD_SIZE_PROPERTY);
+            if (currentValue == null) {
+                currentValue = SystemProperties.get(SELECT_LOGD_DEFAULT_SIZE_PROPERTY);
+                if (currentValue == null) {
+                    currentValue = "256K";
+                }
+            }
+            String[] values = getResources().getStringArray(R.array.select_logd_size_values);
+            String[] titles = getResources().getStringArray(R.array.select_logd_size_titles);
+            String[] summaries = getResources().getStringArray(R.array.select_logd_size_summaries);
+            int index = 1; // punt to second entry if not found
+            for (int i = 0; i < values.length; i++) {
+                if (currentValue.equals(values[i])
+                        || currentValue.equals(titles[i])) {
+                    index = i;
+                    break;
+                }
+            }
+            mLogdSize.setValue(values[index]);
+            mLogdSize.setSummary(summaries[index]);
+            mLogdSize.setOnPreferenceChangeListener(this);
+        }
+    }
+
+    private void writeLogdSizeOption(Object newValue) {
+        SystemProperties.set(SELECT_LOGD_SIZE_PROPERTY, newValue.toString());
+        pokeSystemProperties();
+        try {
+            Process p = Runtime.getRuntime().exec("logcat -b all -G " + newValue.toString());
+            int status = p.waitFor();
+        } catch (Exception e) {
+        }
+        updateLogdSizeValues();
     }
 
     private void updateCpuUsageOptions() {
@@ -1050,12 +1087,6 @@
                 Settings.Global.SHOW_PROCESSES, 0) != 0);
     }
 
-    private void writeLowPowerModeOptions() {
-        boolean value = mLowPowerMode.isChecked();
-        Settings.Global.putInt(getActivity().getContentResolver(),
-                Settings.Global.LOW_POWER_MODE, value ? 1 : 0);
-    }
-
     private void writeCpuUsageOptions() {
         boolean value = mShowCpuUsage.isChecked();
         Settings.Global.putInt(getActivity().getContentResolver(),
@@ -1225,7 +1256,7 @@
 
     @Override
     public void onSwitchChanged(Switch switchView, boolean isChecked) {
-        if (switchView != mEnabledSwitch) {
+        if (switchView != mSwitchBar.getSwitch()) {
             return;
         }
         if (isChecked != mLastEnabledState) {
@@ -1236,7 +1267,6 @@
                         getActivity().getResources().getString(
                                 R.string.dev_settings_warning_message))
                         .setTitle(R.string.dev_settings_warning_title)
-                        .setIconAttribute(android.R.attr.alertDialogIcon)
                         .setPositiveButton(android.R.string.yes, this)
                         .setNegativeButton(android.R.string.no, this)
                         .show();
@@ -1277,7 +1307,6 @@
                 mAdbDialog = new AlertDialog.Builder(getActivity()).setMessage(
                         getActivity().getResources().getString(R.string.adb_warning_message))
                         .setTitle(R.string.adb_warning_title)
-                        .setIconAttribute(android.R.attr.alertDialogIcon)
                         .setPositiveButton(android.R.string.yes, this)
                         .setNegativeButton(android.R.string.no, this)
                         .show();
@@ -1332,8 +1361,6 @@
             writeShowUpdatesOption();
         } else if (preference == mDisableOverlays) {
             writeDisableOverlaysOption();
-        } else if (preference == mLowPowerMode) {
-            writeLowPowerModeOptions();
         } else if (preference == mShowCpuUsage) {
             writeCpuUsageOptions();
         } else if (preference == mImmediatelyDestroyActivities) {
@@ -1401,6 +1428,9 @@
             updateHdcpValues();
             pokeSystemProperties();
             return true;
+        } else if (preference == mLogdSize) {
+            writeLogdSizeOption(newValue);
+            return true;
         } else if (preference == mWindowAnimationScale) {
             writeAnimationScaleOption(0, mWindowAnimationScale, newValue);
             return true;
@@ -1482,7 +1512,7 @@
                 setPrefsEnabledState(mLastEnabledState);
             } else {
                 // Reset the toggle
-                mEnabledSwitch.setChecked(false);
+                mSwitchBar.setChecked(false);
             }
         }
     }
@@ -1496,7 +1526,7 @@
             mAdbDialog = null;
         } else if (dialog == mEnableDialog) {
             if (!mDialogClicked) {
-                mEnabledSwitch.setChecked(false);
+                mSwitchBar.setChecked(false);
             }
             mEnableDialog = null;
         }
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 75236de..ae1d8d1 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -299,7 +299,8 @@
                 @Override
                 public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
                         boolean enabled) {
-                    ArrayList<SearchIndexableResource> result = new ArrayList<>(1);
+                    ArrayList<SearchIndexableResource> result =
+                            new ArrayList<SearchIndexableResource>();
 
                     SearchIndexableResource sir = new SearchIndexableResource(context);
                     sir.xmlResId = R.xml.display_settings;
@@ -310,11 +311,15 @@
 
                 @Override
                 public List<String> getNonIndexableKeys(Context context) {
-                    ArrayList<String> nonIndexableKeys = new ArrayList<>(1);
-                    if (!isAutomaticBrightnessAvailable(context.getResources())) {
-                        nonIndexableKeys.add(KEY_AUTO_BRIGHTNESS);
+                    ArrayList<String> result = new ArrayList<String>();
+                    if (!context.getResources().getBoolean(
+                            com.android.internal.R.bool.config_dreamsSupported)) {
+                        result.add(KEY_SCREEN_SAVER);
                     }
-                    return nonIndexableKeys;
+                    if (!isAutomaticBrightnessAvailable(context.getResources())) {
+                        result.add(KEY_AUTO_BRIGHTNESS);
+                    }
+                    return result;
                 }
             };
 }
diff --git a/src/com/android/settings/DreamSettings.java b/src/com/android/settings/DreamSettings.java
index 1175639..38cba7a 100644
--- a/src/com/android/settings/DreamSettings.java
+++ b/src/com/android/settings/DreamSettings.java
@@ -61,7 +61,6 @@
     private DreamBackend mBackend;
     private DreamInfoAdapter mAdapter;
     private SwitchBar mSwitchBar;
-    private Switch mSwitch;
     private MenuItem[] mMenuItemsWhenEnabled;
     private boolean mRefreshing;
 
@@ -105,6 +104,9 @@
     public void onDestroyView() {
         logd("onDestroyView()");
         super.onDestroyView();
+
+        mSwitchBar.removeOnSwitchChangeListener(this);
+        mSwitchBar.hide();
     }
 
     @Override
@@ -124,7 +126,8 @@
 
         final SettingsActivity sa = (SettingsActivity) getActivity();
         mSwitchBar = sa.getSwitchBar();
-        mSwitch = mSwitchBar.getSwitch();
+        mSwitchBar.addOnSwitchChangeListener(this);
+        mSwitchBar.show();
     }
 
     @Override
@@ -212,9 +215,6 @@
         super.onPause();
 
         mContext.unregisterReceiver(mPackageReceiver);
-
-        mSwitchBar.removeOnSwitchChangeListener(this);
-        mSwitchBar.hide();
     }
 
     @Override
@@ -231,9 +231,6 @@
         filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
         filter.addDataScheme(PACKAGE_SCHEME);
         mContext.registerReceiver(mPackageReceiver , filter);
-
-        mSwitchBar.addOnSwitchChangeListener(this);
-        mSwitchBar.show();
     }
 
     public static int getSummaryResource(Context context) {
@@ -263,8 +260,8 @@
         logd("refreshFromBackend()");
         mRefreshing = true;
         boolean dreamsEnabled = mBackend.isEnabled();
-        if (mSwitch.isChecked() != dreamsEnabled)
-            mSwitch.setChecked(dreamsEnabled);
+        if (mSwitchBar.isChecked() != dreamsEnabled)
+            mSwitchBar.setChecked(dreamsEnabled);
 
         mAdapter.clear();
         if (dreamsEnabled) {
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index d936f46..7f699c5 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -119,7 +119,6 @@
         // TODO: DialogFragment?
         mConfirmDialog = new AlertDialog.Builder(getActivity()).setMessage(msg)
                 .setTitle(R.string.backup_erase_dialog_title)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
                 .setPositiveButton(android.R.string.ok, this)
                 .setNegativeButton(android.R.string.cancel, this)
                 .show();
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index b35a362..60a086a 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -22,6 +22,7 @@
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.admin.DevicePolicyManager;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
@@ -43,6 +44,7 @@
 import android.security.KeyStore;
 import android.service.trust.TrustAgentService;
 import android.telephony.TelephonyManager;
+import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.internal.widget.LockPatternUtils;
@@ -56,7 +58,7 @@
 /**
  * Gesture lock pattern settings.
  */
-public class SecuritySettings extends RestrictedSettingsFragment
+public class SecuritySettings extends SettingsPreferenceFragment
         implements OnPreferenceChangeListener, DialogInterface.OnClickListener, Indexable {
     static final String TAG = "SecuritySettings";
     private static final Intent TRUST_AGENT_INTENT =
@@ -113,10 +115,6 @@
 
     private boolean mIsPrimary;
 
-    public SecuritySettings() {
-        super(null /* Don't ask for restrictions pin on creation. */);
-    }
-
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -272,6 +270,7 @@
 
         } else {
             removePreference(KEY_CREDENTIALS_MANAGER);
+            removePreference(KEY_CREDENTIALS_INSTALL);
         }
 
         // Application install
@@ -280,9 +279,12 @@
         mToggleAppInstallation = (CheckBoxPreference) findPreference(
                 KEY_TOGGLE_INSTALL_APPLICATIONS);
         mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
-
         // Side loading of apps.
         mToggleAppInstallation.setEnabled(mIsPrimary);
+        if (um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES)
+                || um.hasUserRestriction(UserManager.DISALLOW_INSTALL_APPS)) {
+            mToggleAppInstallation.setEnabled(false);
+        }
 
         // Package verification, only visible to primary user and if enabled
         mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS);
@@ -300,12 +302,8 @@
                 mToggleVerifyApps.setEnabled(false);
             }
         }
-
-        if (shouldBePinProtected(RESTRICTIONS_PIN_SET)) {
-            protectByRestrictions(mToggleAppInstallation);
-            protectByRestrictions(mToggleVerifyApps);
-            protectByRestrictions(mResetCredentials);
-            protectByRestrictions(root.findPreference(KEY_CREDENTIALS_INSTALL));
+        if (um.hasUserRestriction(UserManager.ENSURE_VERIFY_APPS)) {
+            mToggleVerifyApps.setEnabled(false);
         }
 
         // Trust Agent preferences
@@ -315,27 +313,30 @@
             PackageManager pm = getPackageManager();
             List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
                     PackageManager.GET_META_DATA);
-            for (ResolveInfo resolveInfo : resolveInfos) {
-                if (resolveInfo.serviceInfo == null) continue;
-                if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
-                TrustAgentUtils.TrustAgentComponentInfo trustAgentComponentInfo =
-                        TrustAgentUtils.getSettingsComponent(pm, resolveInfo);
-                if (trustAgentComponentInfo.componentName == null ||
-                        trustAgentComponentInfo.title == null ||
-                        trustAgentComponentInfo.title == "") continue;
-                Preference trustAgentPreference =
-                        new Preference(securityCategory.getContext());
-                trustAgentPreference.setKey(KEY_TRUST_AGENT);
-                trustAgentPreference.setTitle(trustAgentComponentInfo.title);
-                trustAgentPreference.setSummary(trustAgentComponentInfo.summary);
-                // Create intent for this preference.
-                Intent intent = new Intent();
-                intent.setComponent(trustAgentComponentInfo.componentName);
-                intent.setAction(Intent.ACTION_MAIN);
-                trustAgentPreference.setIntent(intent);
-                // Add preference to the settings menu.
-                securityCategory.addPreference(trustAgentPreference);
-                break; // Only render the first one.
+            List<ComponentName> enabledTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
+            if (enabledTrustAgents != null && !enabledTrustAgents.isEmpty()) {
+                for (ResolveInfo resolveInfo : resolveInfos) {
+                    if (resolveInfo.serviceInfo == null) continue;
+                    if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
+                    TrustAgentUtils.TrustAgentComponentInfo trustAgentComponentInfo =
+                            TrustAgentUtils.getSettingsComponent(pm, resolveInfo);
+                    if (trustAgentComponentInfo.componentName == null ||
+                            !enabledTrustAgents.contains(trustAgentComponentInfo.componentName) ||
+                            TextUtils.isEmpty(trustAgentComponentInfo.title)) continue;
+                    Preference trustAgentPreference =
+                            new Preference(securityCategory.getContext());
+                    trustAgentPreference.setKey(KEY_TRUST_AGENT);
+                    trustAgentPreference.setTitle(trustAgentComponentInfo.title);
+                    trustAgentPreference.setSummary(trustAgentComponentInfo.summary);
+                    // Create intent for this preference.
+                    Intent intent = new Intent();
+                    intent.setComponent(trustAgentComponentInfo.componentName);
+                    intent.setAction(Intent.ACTION_MAIN);
+                    trustAgentPreference.setIntent(intent);
+                    // Add preference to the settings menu.
+                    securityCategory.addPreference(trustAgentPreference);
+                    break; // Only render the first one.
+                }
             }
         }
 
@@ -499,9 +500,6 @@
 
     @Override
     public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
-        if (ensurePinRestrictedPreference(preference)) {
-            return true;
-        }
         final String key = preference.getKey();
 
         final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 22ae719..7ef33ae 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -66,6 +66,7 @@
     public static class RunningServicesActivity extends SettingsActivity { /* empty */ }
     public static class ManageAccountsSettingsActivity extends SettingsActivity { /* empty */ }
     public static class PowerUsageSummaryActivity extends SettingsActivity { /* empty */ }
+    public static class BatterySaverSettingsActivity extends SettingsActivity { /* empty */ }
     public static class AccountSyncSettingsActivity extends SettingsActivity { /* empty */ }
     public static class AccountSyncSettingsInAddAccountActivity extends SettingsActivity { /* empty */ }
     public static class CryptKeeperSettingsActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index e602fa6..9cce9a1 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -63,8 +63,8 @@
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.widget.Button;
-
 import android.widget.SearchView;
+
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.XmlUtils;
 import com.android.settings.accessibility.AccessibilitySettings;
@@ -83,6 +83,7 @@
 import com.android.settings.dashboard.SearchResultsSummary;
 import com.android.settings.deviceinfo.Memory;
 import com.android.settings.deviceinfo.UsbSettings;
+import com.android.settings.fuelgauge.BatterySaverSettings;
 import com.android.settings.fuelgauge.PowerUsageSummary;
 import com.android.settings.search.DynamicIndexableContentMonitor;
 import com.android.settings.search.Index;
@@ -108,6 +109,7 @@
 import com.android.settings.wifi.AdvancedWifiSettings;
 import com.android.settings.wifi.WifiSettings;
 import com.android.settings.wifi.p2p.WifiP2pSettings;
+
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
@@ -133,6 +135,7 @@
     private static final String SAVE_KEY_SEARCH_MENU_EXPANDED = ":settings:search_menu_expanded";
     private static final String SAVE_KEY_SEARCH_QUERY = ":settings:search_query";
     private static final String SAVE_KEY_SHOW_HOME_AS_UP = ":settings:show_home_as_up";
+    private static final String SAVE_KEY_SHOW_SEARCH = ":settings:show_search";
 
     /**
      * When starting this activity, the invoking Intent can contain this extra
@@ -174,10 +177,11 @@
 
     /**
      * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT},
-     * this extra can also be specify to supply the title to be shown for
+     * those extra can also be specify to supply the title or title res id to be shown for
      * that fragment.
      */
     public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":settings:show_fragment_title";
+    public static final String EXTRA_SHOW_FRAGMENT_TITLE_RESID = ":settings:show_fragment_title_resid";
 
     private static final String META_DATA_KEY_FRAGMENT_CLASS =
         "com.android.settings.FRAGMENT_CLASS";
@@ -191,6 +195,7 @@
     private String mFragmentClass;
 
     private CharSequence mInitialTitle;
+    private int mInitialTitleResId;
 
     // Show only these settings for restricted users
     private int[] SETTINGS_FOR_RESTRICTED = {
@@ -273,7 +278,8 @@
             NotificationSettings.class.getName(),
             ChooseLockPassword.ChooseLockPasswordFragment.class.getName(),
             ChooseLockPattern.ChooseLockPatternFragment.class.getName(),
-            InstalledAppDetails.class.getName()
+            InstalledAppDetails.class.getName(),
+            BatterySaverSettings.class.getName(),
     };
 
     private SharedPreferences mDevelopmentPreferences;
@@ -306,7 +312,9 @@
     private SwitchBar mSwitchBar;
 
     private Button mNextButton;
+
     private boolean mDisplayHomeAsUpEnabled;
+    private boolean mDisplaySearch;
 
     private boolean mIsShowingDashboard;
 
@@ -401,6 +409,10 @@
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
+        if (!mDisplaySearch) {
+            return false;
+        }
+
         MenuInflater inflater = getMenuInflater();
         inflater.inflate(R.menu.options_menu, menu);
 
@@ -447,6 +459,20 @@
 
         super.onCreate(savedState);
 
+        // Getting Intent properties can only be done after the super.onCreate(...)
+        final String initialFragmentName = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
+
+        mIsShowingDashboard = (initialFragmentName == null);
+
+        final ComponentName cn = getIntent().getComponent();
+        final boolean isShortcut = !cn.getClassName().equals(SubSettings.class.getName());
+
+        // If this is a subsettings (but not a Shortcut) then apply the correct theme for
+        // the ActionBar content inset
+        if (!mIsShowingDashboard && !isShortcut) {
+            setTheme(R.style.Theme_SubSettings);
+        }
+
         setContentView(R.layout.settings_main);
 
         mContent = (ViewGroup) findViewById(R.id.prefs);
@@ -454,14 +480,10 @@
         getFragmentManager().addOnBackStackChangedListener(this);
 
         mDisplayHomeAsUpEnabled = true;
-
-        // Getting Intent properties can only be done after the super.onCreate(...)
-        final String initialFragmentName = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
-
-        mIsShowingDashboard = (initialFragmentName == null);
+        mDisplaySearch = true;
 
         if (mIsShowingDashboard) {
-            Index.getInstance(this).update();
+            Index.getInstance(getApplicationContext()).update();
         }
 
         if (savedState != null) {
@@ -470,9 +492,7 @@
             mSearchMenuItemExpanded = savedState.getBoolean(SAVE_KEY_SEARCH_MENU_EXPANDED);
             mSearchQuery = savedState.getString(SAVE_KEY_SEARCH_QUERY);
 
-            final String initialTitle = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE);
-            mInitialTitle = (initialTitle != null) ? initialTitle : getTitle();
-            setTitle(mInitialTitle);
+            setTitleFromIntent(getIntent());
 
             ArrayList<DashboardCategory> categories =
                     savedState.getParcelableArrayList(SAVE_KEY_CATEGORIES);
@@ -483,26 +503,25 @@
             }
 
             mDisplayHomeAsUpEnabled = savedState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP);
+            mDisplaySearch = savedState.getBoolean(SAVE_KEY_SHOW_SEARCH);
         } else {
             if (!mIsShowingDashboard) {
-                final ComponentName cn = getIntent().getComponent();
-                // No UP is we are launched thru a Settings shortcut
-                if (!cn.getClassName().equals(SubSettings.class.getName())) {
+                // No UP nor Search is shown we are launched thru a Settings "shortcut"
+                if (isShortcut) {
                     mDisplayHomeAsUpEnabled = false;
+                    mDisplaySearch = false;
                 }
-                final String initialTitle = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE);
-                mInitialTitle = (initialTitle != null) ? initialTitle : getTitle();
-                setTitle(mInitialTitle);
+                setTitleFromIntent(getIntent());
 
                 Bundle initialArguments = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
-                switchToFragment( initialFragmentName, initialArguments, true, false,
-                        mInitialTitle, false);
+                switchToFragment(initialFragmentName, initialArguments, true, false,
+                        mInitialTitleResId, mInitialTitle, false);
             } else {
                 // No UP if we are displaying the main Dashboard
                 mDisplayHomeAsUpEnabled = false;
-                mInitialTitle = getText(R.string.dashboard_title);
+                mInitialTitleResId = R.string.dashboard_title;
                 switchToFragment(DashboardSummary.class.getName(), null, false, false,
-                        mInitialTitle, false);
+                        mInitialTitleResId, mInitialTitle, false);
             }
         }
 
@@ -569,6 +588,20 @@
         }
     }
 
+    private void setTitleFromIntent(Intent intent) {
+        final int initialTitleResId = intent.getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, -1);
+        if (initialTitleResId > 0) {
+            mInitialTitle = null;
+            mInitialTitleResId = initialTitleResId;
+            setTitle(mInitialTitleResId);
+        } else {
+            mInitialTitleResId = -1;
+            final String initialTitle = intent.getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE);
+            mInitialTitle = (initialTitle != null) ? initialTitle : getTitle();
+            setTitle(mInitialTitle);
+        }
+    }
+
     @Override
     public void onBackStackChanged() {
         setTitleFromBackStack();
@@ -578,7 +611,11 @@
         final int count = getFragmentManager().getBackStackEntryCount();
 
         if (count == 0) {
-            setTitle(mInitialTitle);
+            if (mInitialTitleResId > 0) {
+                setTitle(mInitialTitleResId);
+            } else {
+                setTitle(mInitialTitle);
+            }
             return 0;
         }
 
@@ -610,17 +647,20 @@
         }
 
         outState.putBoolean(SAVE_KEY_SHOW_HOME_AS_UP, mDisplayHomeAsUpEnabled);
+        outState.putBoolean(SAVE_KEY_SHOW_SEARCH, mDisplaySearch);
 
-        // The option menus are created if the ActionBar is visible and they are also created
-        // asynchronously. If you launch Settings with an Intent action like
-        // android.intent.action.POWER_USAGE_SUMMARY and at the same time your device is locked
-        // thru a LockScreen, onCreateOptionsMenu() is not yet called and references to the search
-        // menu item and search view are null.
-        boolean isExpanded = (mSearchMenuItem != null) && mSearchMenuItem.isActionViewExpanded();
-        outState.putBoolean(SAVE_KEY_SEARCH_MENU_EXPANDED, isExpanded);
+        if (mDisplaySearch) {
+            // The option menus are created if the ActionBar is visible and they are also created
+            // asynchronously. If you launch Settings with an Intent action like
+            // android.intent.action.POWER_USAGE_SUMMARY and at the same time your device is locked
+            // thru a LockScreen, onCreateOptionsMenu() is not yet called and references to the search
+            // menu item and search view are null.
+            boolean isExpanded = (mSearchMenuItem != null) && mSearchMenuItem.isActionViewExpanded();
+            outState.putBoolean(SAVE_KEY_SEARCH_MENU_EXPANDED, isExpanded);
 
-        String query = (mSearchView != null) ? mSearchView.getQuery().toString() : EMPTY_QUERY;
-        outState.putString(SAVE_KEY_SEARCH_QUERY, query);
+            String query = (mSearchView != null) ? mSearchView.getQuery().toString() : EMPTY_QUERY;
+            outState.putString(SAVE_KEY_SEARCH_QUERY, query);
+        }
     }
 
     @Override
@@ -641,7 +681,7 @@
 
         mDynamicIndexableContentMonitor.register(this);
 
-        if(!TextUtils.isEmpty(mSearchQuery)) {
+        if(mDisplaySearch && !TextUtils.isEmpty(mSearchQuery)) {
             onQueryTextSubmit(mSearchQuery);
         }
     }
@@ -740,16 +780,17 @@
      */
     public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes,
             CharSequence titleText, Fragment resultTo, int resultRequestCode) {
-        String title;
-        if (titleRes > 0) {
-            title = getString(titleRes);
-        } else if (titleText != null) {
-            title = titleText.toString();
-        } else {
-            // There not much we can do in that case
-            title = "";
+        String title = null;
+        if (titleRes < 0) {
+            if (titleText != null) {
+                title = titleText.toString();
+            } else {
+                // There not much we can do in that case
+                title = "";
+            }
         }
-        Utils.startWithFragment(this, fragmentClass, args, resultTo, resultRequestCode, title);
+        Utils.startWithFragment(this, fragmentClass, args, resultTo, resultRequestCode,
+                titleRes, title);
     }
 
     /**
@@ -788,7 +829,7 @@
      * Switch to a specific Fragment with taking care of validation, Title and BackStack
      */
     private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
-            boolean addToBackStack, CharSequence title, boolean withTransition) {
+            boolean addToBackStack, int titleResId, CharSequence title, boolean withTransition) {
         if (validate && !isValidFragment(fragmentName)) {
             throw new IllegalArgumentException("Invalid fragment for this activity: "
                     + fragmentName);
@@ -802,7 +843,9 @@
         if (addToBackStack) {
             transaction.addToBackStack(SettingsActivity.BACK_STACK_PREFS);
         }
-        if (title != null) {
+        if (titleResId > 0) {
+            transaction.setBreadCrumbTitle(titleResId);
+        } else if (title != null) {
             transaction.setBreadCrumbTitle(title);
         }
         transaction.commitAllowingStateLoss();
@@ -1030,8 +1073,12 @@
                         category.removeTile(n);
                     }
                 } else if (id == R.id.user_settings) {
+                    boolean hasMultipleUsers =
+                            ((UserManager) getSystemService(Context.USER_SERVICE))
+                                    .getUserCount() > 1;
                     if (!UserHandle.MU_ENABLED
-                            || !UserManager.supportsMultipleUsers()
+                            || (!UserManager.supportsMultipleUsers()
+                                    && !hasMultipleUsers)
                             || Utils.isMonkeyRunning()) {
                         category.removeTile(n);
                     }
@@ -1253,10 +1300,9 @@
         if (current != null && current instanceof SearchResultsSummary) {
             mSearchResultsFragment = (SearchResultsSummary) current;
         } else {
-            String title = getString(R.string.search_results_title);
             mSearchResultsFragment = (SearchResultsSummary) switchToFragment(
-                    SearchResultsSummary.class.getName(), null, false, true, title,
-                    true);
+                    SearchResultsSummary.class.getName(), null, false, true,
+                    R.string.search_results_title, null, true);
         }
         mSearchResultsFragment.setSearchView(mSearchView);
         mSearchMenuItemExpanded = true;
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 4e0933d..d960ce6 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -47,6 +47,7 @@
 import android.view.ViewGroup;
 import android.view.ViewParent;
 import android.webkit.WebView;
+import android.widget.TextView;
 
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -92,6 +93,7 @@
     private WifiApDialog mDialog;
     private WifiManager mWifiManager;
     private WifiConfiguration mWifiConfig = null;
+    private UserManager mUm;
 
     private boolean mUsbConnected;
     private boolean mMassStorageActive;
@@ -110,11 +112,21 @@
     private String[] mProvisionApp;
     private static final int PROVISION_REQUEST = 0;
 
+    private boolean mUnavailable;
+
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         addPreferencesFromResource(R.xml.tether_prefs);
 
+        mUm = (UserManager) getSystemService(Context.USER_SERVICE);
+
+        if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
+            mUnavailable = true;
+            setPreferenceScreen(new PreferenceScreen(getActivity(), null));
+            return;
+        }
+
         final Activity activity = getActivity();
         BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
         if (adapter != null) {
@@ -264,6 +276,15 @@
     public void onStart() {
         super.onStart();
 
+        if (mUnavailable) {
+            TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
+            getListView().setEmptyView(emptyView);
+            if (emptyView != null) {
+                emptyView.setText(R.string.tethering_settings_not_available);
+            }
+            return;
+        }
+
         final Activity activity = getActivity();
 
         mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
@@ -297,6 +318,10 @@
     @Override
     public void onStop() {
         super.onStop();
+
+        if (mUnavailable) {
+            return;
+        }
         getActivity().unregisterReceiver(mTetherChangeReceiver);
         mTetherChangeReceiver = null;
         if (mWifiApEnabler != null) {
diff --git a/src/com/android/settings/TrustAgentUtils.java b/src/com/android/settings/TrustAgentUtils.java
index 31a073c..b08feff 100644
--- a/src/com/android/settings/TrustAgentUtils.java
+++ b/src/com/android/settings/TrustAgentUtils.java
@@ -43,6 +43,8 @@
      * @return true, if the service in resolveInfo has the permission to provide a trust agent.
      */
     public static boolean checkProvidePermission(ResolveInfo resolveInfo, PackageManager pm) {
+        // STOPSHIP Reenable this check once the GMS Core prebuild library has the permission.
+        /*
         String packageName = resolveInfo.serviceInfo.packageName;
         if (pm.checkPermission(PERMISSION_PROVIDE_AGENT, packageName)
                 != PackageManager.PERMISSION_GRANTED) {
@@ -50,6 +52,7 @@
                     + " does not have permission " + PERMISSION_PROVIDE_AGENT + ".");
             return false;
         }
+        */
         return true;
     }
 
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java
index 65d0934..eb7b142 100644
--- a/src/com/android/settings/TrustedCredentialsSettings.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -47,6 +47,7 @@
 import android.widget.Spinner;
 import android.widget.TabHost;
 import android.widget.TextView;
+
 import java.security.cert.CertificateEncodingException;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
@@ -170,6 +171,10 @@
 
     @Override public View onCreateView(
             LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
+        if (mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) {
+            return inflater.inflate(R.layout.credentials_disallowed_preference_screen,
+                    parent, false);
+        }
         mTabHost = (TabHost) inflater.inflate(R.layout.trusted_credentials, parent, false);
         mTabHost.setup();
         addTab(Tab.SYSTEM);
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 1b64064..59a137e 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -519,15 +519,16 @@
      * @param context The context.
      * @param fragmentName The name of the fragment to display.
      * @param args Optional arguments to supply to the fragment.
-     * @param resultTo Option fragment that should receive the result of
-     * the activity launch.
-     * @param resultRequestCode If resultTo is non-null, this is the request
-     * code in which to report the result.
+     * @param resultTo Option fragment that should receive the result of the activity launch.
+     * @param resultRequestCode If resultTo is non-null, this is the request code in which
+     *                          to report the result.
+     * @param titleResId resource id for the String to display for the title of this set
+     *                   of preferences.
      * @param title String to display for the title of this set of preferences.
      */
     public static void startWithFragment(Context context, String fragmentName, Bundle args,
-            Fragment resultTo, int resultRequestCode, CharSequence title) {
-        Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, title);
+            Fragment resultTo, int resultRequestCode, int titleResId, CharSequence title) {
+        Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResId, title);
         if (resultTo == null) {
             context.startActivity(intent);
         } else {
@@ -543,16 +544,18 @@
      * @param context The Context.
      * @param fragmentName The name of the fragment to display.
      * @param args Optional arguments to supply to the fragment.
+     * @param titleResId Optional title resource id to show for this item.
      * @param title Optional title to show for this item.
      * @return Returns an Intent that can be launched to display the given
      * fragment.
      */
     public static Intent onBuildStartFragmentIntent(Context context, String fragmentName,
-            Bundle args, CharSequence title) {
+            Bundle args, int titleResId, CharSequence title) {
         Intent intent = new Intent(Intent.ACTION_MAIN);
         intent.setClass(context, SubSettings.class);
         intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, fragmentName);
         intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
+        intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, titleResId);
         intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, title);
         return intent;
     }
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index fd2e945..507445f 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -30,13 +30,16 @@
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.nfc.NfcAdapter;
+import android.nfc.NfcManager;
 import android.os.Bundle;
 import android.os.SystemProperties;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.preference.CheckBoxPreference;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.PreferenceScreen;
+import android.provider.SearchIndexableResource;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
@@ -47,11 +50,16 @@
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.settings.nfc.NfcEnabler;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.List;
 
 public class WirelessSettings extends RestrictedSettingsFragment
-        implements OnPreferenceChangeListener {
+        implements OnPreferenceChangeListener, Indexable {
     private static final String TAG = "WirelessSettings";
 
     private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
@@ -79,6 +87,7 @@
     private ConnectivityManager mCm;
     private TelephonyManager mTm;
     private PackageManager mPm;
+    private UserManager mUm;
 
     private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1;
     private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";
@@ -244,6 +253,7 @@
         mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
         mTm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
         mPm = getPackageManager();
+        mUm = (UserManager) getSystemService(Context.USER_SERVICE);
 
         addPreferencesFromResource(R.xml.wireless_settings);
 
@@ -270,7 +280,7 @@
                 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
 
         //enable/disable wimax depending on the value in config.xml
-        boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
+        final boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
                 com.android.internal.R.bool.config_wimaxEnabled);
         if (!isWimaxEnabled) {
             PreferenceScreen root = getPreferenceScreen();
@@ -289,10 +299,11 @@
         if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) {
             findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
         }
-        if (isSecondaryUser) { // Disable VPN
+        // Disable VPN.
+        if (isSecondaryUser || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
             removePreference(KEY_VPN_SETTINGS);
         }
-        protectByRestrictions(KEY_VPN_SETTINGS);
+
         // Manually set dependencies for Bluetooth when not toggleable.
         if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_BLUETOOTH)) {
             // No bluetooth-dependent items in the list. Code kept in case one is added later.
@@ -304,7 +315,7 @@
             findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
         }
 
-        // Remove NFC if its not available
+        // Remove NFC if not available
         mNfcAdapter = NfcAdapter.getDefaultAdapter(activity);
         if (mNfcAdapter == null) {
             getPreferenceScreen().removePreference(nfc);
@@ -312,14 +323,16 @@
             mNfcEnabler = null;
         }
 
-        // Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device.
-        if (isSecondaryUser || Utils.isWifiOnly(getActivity())) {
+        // Remove Mobile Network Settings and Manage Mobile Plan for secondary users,
+        // if it's a wifi-only device, or if the settings are restricted.
+        if (isSecondaryUser || Utils.isWifiOnly(getActivity())
+                || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
             removePreference(KEY_MOBILE_NETWORK_SETTINGS);
             removePreference(KEY_MANAGE_MOBILE_PLAN);
         }
         // Remove Mobile Network Settings and Manage Mobile Plan
         // if config_show_mobile_plan sets false.
-        boolean isMobilePlanEnabled = this.getResources().getBoolean(
+        final boolean isMobilePlanEnabled = this.getResources().getBoolean(
                 R.bool.config_show_mobile_plan);
         if (!isMobilePlanEnabled) {
             Preference pref = findPreference(KEY_MANAGE_MOBILE_PLAN);
@@ -327,8 +340,6 @@
                 removePreference(KEY_MANAGE_MOBILE_PLAN);
             }
         }
-        protectByRestrictions(KEY_MOBILE_NETWORK_SETTINGS);
-        protectByRestrictions(KEY_MANAGE_MOBILE_PLAN);
 
         // Remove SMS Application if the device does not support SMS
         if (!isSmsSupported()) {
@@ -342,22 +353,22 @@
 
         // Enable Proxy selector settings if allowed.
         Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
-        DevicePolicyManager mDPM = (DevicePolicyManager)
+        final DevicePolicyManager mDPM = (DevicePolicyManager)
                 activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
         // proxy UI disabled until we have better app support
         getPreferenceScreen().removePreference(mGlobalProxy);
         mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
 
         // Disable Tethering if it's not allowed or if it's a wifi-only device
-        ConnectivityManager cm =
+        final ConnectivityManager cm =
                 (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
-        if (isSecondaryUser || !cm.isTetheringSupported()) {
+        if (isSecondaryUser || !cm.isTetheringSupported()
+                || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
             getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
         } else {
             Preference p = findPreference(KEY_TETHER_SETTINGS);
             p.setTitle(Utils.getTetheringLabel(cm));
         }
-        protectByRestrictions(KEY_TETHER_SETTINGS);
 
         // Enable link to CMAS app settings depending on the value in config.xml.
         boolean isCellBroadcastAppLinkEnabled = this.getResources().getBoolean(
@@ -372,12 +383,12 @@
         } catch (IllegalArgumentException ignored) {
             isCellBroadcastAppLinkEnabled = false;  // CMAS app not installed
         }
-        if (isSecondaryUser || !isCellBroadcastAppLinkEnabled) {
+        if (isSecondaryUser || !isCellBroadcastAppLinkEnabled
+                || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) {
             PreferenceScreen root = getPreferenceScreen();
             Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS);
             if (ps != null) root.removePreference(ps);
         }
-        protectByRestrictions(KEY_CELL_BROADCAST_SETTINGS);
     }
 
     @Override
@@ -446,4 +457,103 @@
         }
         return false;
     }
+
+    /**
+     * For Search.
+     */
+    public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+        new BaseSearchIndexProvider() {
+            @Override
+            public List<SearchIndexableResource> getXmlResourcesToIndex(
+                    Context context, boolean enabled) {
+                SearchIndexableResource sir = new SearchIndexableResource(context);
+                sir.xmlResId = R.xml.wireless_settings;
+                return Arrays.asList(sir);
+            }
+
+            @Override
+            public List<String> getNonIndexableKeys(Context context) {
+                final ArrayList<String> result = new ArrayList<String>();
+
+                result.add(KEY_TOGGLE_NSD);
+
+                final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER;
+                final boolean isWimaxEnabled = !isSecondaryUser && context.getResources().getBoolean(
+                        com.android.internal.R.bool.config_wimaxEnabled);
+                if (!isWimaxEnabled) {
+                    result.add(KEY_WIMAX_SETTINGS);
+                }
+
+                if (isSecondaryUser) { // Disable VPN
+                    result.add(KEY_VPN_SETTINGS);
+                }
+
+                // Remove NFC if not available
+                final NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
+                if (manager != null) {
+                    NfcAdapter adapter = manager.getDefaultAdapter();
+                    if (adapter == null) {
+                        result.add(KEY_TOGGLE_NFC);
+                        result.add(KEY_ANDROID_BEAM_SETTINGS);
+                    }
+                }
+
+                // Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device.
+                if (isSecondaryUser || Utils.isWifiOnly(context)) {
+                    result.add(KEY_MOBILE_NETWORK_SETTINGS);
+                    result.add(KEY_MANAGE_MOBILE_PLAN);
+                }
+
+                // Remove Mobile Network Settings and Manage Mobile Plan
+                // if config_show_mobile_plan sets false.
+                final boolean isMobilePlanEnabled = context.getResources().getBoolean(
+                        R.bool.config_show_mobile_plan);
+                if (!isMobilePlanEnabled) {
+                    result.add(KEY_MANAGE_MOBILE_PLAN);
+                }
+
+                // Remove SMS Application if the device does not support SMS
+                TelephonyManager tm =
+                        (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+                if (!tm.isSmsCapable()) {
+                    result.add(KEY_SMS_APPLICATION);
+                }
+
+                final PackageManager pm = context.getPackageManager();
+
+                // Remove Airplane Mode settings if it's a stationary device such as a TV.
+                if (pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
+                    result.add(KEY_TOGGLE_AIRPLANE);
+                }
+
+                // proxy UI disabled until we have better app support
+                result.add(KEY_PROXY_SETTINGS);
+
+                // Disable Tethering if it's not allowed or if it's a wifi-only device
+                ConnectivityManager cm =
+                        (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+                if (isSecondaryUser || !cm.isTetheringSupported()) {
+                    result.add(KEY_TETHER_SETTINGS);
+                }
+
+                // Enable link to CMAS app settings depending on the value in config.xml.
+                boolean isCellBroadcastAppLinkEnabled = context.getResources().getBoolean(
+                        com.android.internal.R.bool.config_cellBroadcastAppLinks);
+                try {
+                    if (isCellBroadcastAppLinkEnabled) {
+                        if (pm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver")
+                                == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
+                            isCellBroadcastAppLinkEnabled = false;  // CMAS app disabled
+                        }
+                    }
+                } catch (IllegalArgumentException ignored) {
+                    isCellBroadcastAppLinkEnabled = false;  // CMAS app not installed
+                }
+                if (isSecondaryUser || !isCellBroadcastAppLinkEnabled) {
+                    result.add(KEY_CELL_BROADCAST_SETTINGS);
+                }
+
+                return result;
+            }
+        };
 }
diff --git a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
index 5dcf121..53d614d 100644
--- a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
+++ b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
@@ -29,6 +29,7 @@
 import android.provider.Settings;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.View.OnLayoutChangeListener;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
 import android.view.accessibility.CaptioningManager;
@@ -64,11 +65,13 @@
     private static final String PREF_PRESET = "captioning_preset";
     private static final String PREF_CUSTOM = "custom";
 
-    private static final float DEFAULT_FONT_SIZE = 48f;
+    /** WebVtt specifies line height as 5.3% of the viewport height. */
+    private static final float LINE_HEIGHT_RATIO = 0.0533f;
 
     private CaptioningManager mCaptioningManager;
     private SubtitleView mPreviewText;
     private View mPreviewWindow;
+    private View mPreviewViewport;
     private SwitchBar mSwitchBar;
     private ToggleSwitch mToggleSwitch;
 
@@ -130,28 +133,39 @@
         mPreviewText = (SubtitleView) view.findViewById(R.id.preview_text);
         mPreviewText.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
 
+        mPreviewWindow = view.findViewById(R.id.preview_window);
+        mPreviewViewport = view.findViewById(R.id.preview_viewport);
+        mPreviewViewport.addOnLayoutChangeListener(new OnLayoutChangeListener() {
+            @Override
+            public void onLayoutChange(View v, int left, int top, int right, int bottom,
+                    int oldLeft, int oldTop, int oldRight, int oldBottom) {
+                refreshPreviewText();
+            }
+        });
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+
+        final boolean enabled = mCaptioningManager.isEnabled();
         SettingsActivity activity = (SettingsActivity) getActivity();
         mSwitchBar = activity.getSwitchBar();
+        mSwitchBar.setTextViewLabel(enabled);
         mToggleSwitch = mSwitchBar.getSwitch();
         mToggleSwitch.setCheckedInternal(enabled);
 
-        mPreviewWindow = view.findViewById(R.id.preview_window);
-
         getPreferenceScreen().setEnabled(enabled);
 
         refreshPreviewText();
-    }
 
-    @Override
-    public void onResume() {
-        super.onResume();
         installSwitchBarToggleSwitch();
     }
 
     @Override
-    public void onPause() {
+    public void onDestroyView() {
+        super.onDestroyView();
         removeSwitchBarToggleSwitch();
-        super.onPause();
     }
 
     private void refreshPreviewText() {
@@ -164,7 +178,7 @@
         final SubtitleView preview = mPreviewText;
         if (preview != null) {
             final int styleId = mCaptioningManager.getRawUserStyle();
-            applyCaptionProperties(mCaptioningManager, preview, styleId);
+            applyCaptionProperties(mCaptioningManager, preview, mPreviewViewport, styleId);
 
             final Locale locale = mCaptioningManager.getLocale();
             if (locale != null) {
@@ -176,18 +190,29 @@
             }
 
             final CaptionStyle style = mCaptioningManager.getUserStyle();
-            mPreviewWindow.setBackgroundColor(style.windowColor);
+            if (style.hasWindowColor()) {
+                mPreviewWindow.setBackgroundColor(style.windowColor);
+            } else {
+                final CaptionStyle defStyle = CaptionStyle.DEFAULT;
+                mPreviewWindow.setBackgroundColor(defStyle.windowColor);
+            }
         }
     }
 
-    public static void applyCaptionProperties(
-            CaptioningManager manager, SubtitleView previewText, int styleId) {
+    public static void applyCaptionProperties(CaptioningManager manager, SubtitleView previewText,
+            View previewWindow, int styleId) {
         previewText.setStyle(styleId);
 
         final Context context = previewText.getContext();
         final ContentResolver cr = context.getContentResolver();
         final float fontScale = manager.getFontScale();
-        previewText.setTextSize(fontScale * DEFAULT_FONT_SIZE);
+        if (previewWindow != null) {
+            previewText.setTextSize(previewWindow.getHeight() * LINE_HEIGHT_RATIO * fontScale);
+        } else {
+            final float textSize = context.getResources().getDimension(
+                    R.dimen.caption_preview_text_size);
+            previewText.setTextSize(textSize * fontScale);
+        }
 
         final Locale locale = manager.getLocale();
         if (locale != null) {
@@ -341,7 +366,7 @@
         final int opacityValue = opacity.getValue();
         final int value;
         if (Color.alpha(colorValue) == 0) {
-            value = Color.alpha(opacityValue);
+            value = colorValue & 0x00FFFF00 | Color.alpha(opacityValue);
         } else {
             value = colorValue & 0x00FFFFFF | opacityValue & 0xFF000000;
         }
diff --git a/src/com/android/settings/accessibility/ColorPreference.java b/src/com/android/settings/accessibility/ColorPreference.java
index f4a5ba7..39e555a 100644
--- a/src/com/android/settings/accessibility/ColorPreference.java
+++ b/src/com/android/settings/accessibility/ColorPreference.java
@@ -60,7 +60,7 @@
 
     @Override
     public boolean shouldDisableDependents() {
-        return getValue() == Color.TRANSPARENT || super.shouldDisableDependents();
+        return Color.alpha(getValue()) == 0 || super.shouldDisableDependents();
     }
 
     @Override
diff --git a/src/com/android/settings/accessibility/PresetPreference.java b/src/com/android/settings/accessibility/PresetPreference.java
index 9f1aee3..fe5ca68 100644
--- a/src/com/android/settings/accessibility/PresetPreference.java
+++ b/src/com/android/settings/accessibility/PresetPreference.java
@@ -49,10 +49,11 @@
 
     @Override
     protected void onBindListItem(View view, int index) {
+        final View previewViewport = view.findViewById(R.id.preview_viewport);
         final SubtitleView previewText = (SubtitleView) view.findViewById(R.id.preview);
         final int value = getValueAt(index);
         CaptionPropertiesFragment.applyCaptionProperties(
-                mCaptioningManager, previewText, value);
+                mCaptioningManager, previewText, previewViewport, value);
 
         final float density = getContext().getResources().getDisplayMetrics().density;
         previewText.setTextSize(DEFAULT_FONT_SIZE * density);
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index a446f49..cb7699e 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -163,7 +163,6 @@
                 AlertDialog ad = new AlertDialog.Builder(getActivity())
                         .setTitle(getString(R.string.enable_service_title,
                                 info.getResolveInfo().loadLabel(getPackageManager())))
-                        .setIconAttribute(android.R.attr.alertDialogIcon)
                         .setView(createEnableDialogContentView(info))
                         .setCancelable(true)
                         .setPositiveButton(android.R.string.ok, this)
@@ -182,7 +181,6 @@
                 return new AlertDialog.Builder(getActivity())
                         .setTitle(getString(R.string.disable_service_title,
                                 info.getResolveInfo().loadLabel(getPackageManager())))
-                        .setIconAttribute(android.R.attr.alertDialogIcon)
                         .setMessage(getString(R.string.disable_service_message,
                                 info.getResolveInfo().loadLabel(getPackageManager())))
                         .setCancelable(true)
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 331c0e3..bc21759 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -95,17 +95,17 @@
     }
 
     @Override
-    public void onResume() {
-        super.onResume();
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
 
         installActionBarToggleSwitch();
     }
 
     @Override
-    public void onPause() {
-        removeActionBarToggleSwitch();
+    public void onDestroyView() {
+        super.onDestroyView();
 
-        super.onPause();
+        removeActionBarToggleSwitch();
     }
 
     protected abstract void onPreferenceToggled(String preferenceKey, boolean enabled);
diff --git a/src/com/android/settings/accounts/AccountSettings.java b/src/com/android/settings/accounts/AccountSettings.java
index 2477877..bb06b2f 100644
--- a/src/com/android/settings/accounts/AccountSettings.java
+++ b/src/com/android/settings/accounts/AccountSettings.java
@@ -238,7 +238,7 @@
         public boolean onPreferenceClick(Preference preference) {
             if (mFragment != null) {
                 Utils.startWithFragment(
-                        getContext(), mFragment, mFragmentArguments, null, 0, mTitle);
+                        getContext(), mFragment, mFragmentArguments, null, 0, 0, mTitle);
                 return true;
             }
             return false;
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index ef27e2e..6ed517f 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -1109,7 +1109,6 @@
                 case DLG_CLEAR_DATA:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.clear_data_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.clear_data_dlg_text))
                     .setPositiveButton(R.string.dlg_ok,
                             new DialogInterface.OnClickListener() {
@@ -1123,7 +1122,6 @@
                 case DLG_FACTORY_RESET:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.app_factory_reset_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.app_factory_reset_dlg_text))
                     .setPositiveButton(R.string.dlg_ok,
                             new DialogInterface.OnClickListener() {
@@ -1138,7 +1136,6 @@
                 case DLG_APP_NOT_FOUND:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.app_not_found_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.app_not_found_dlg_title))
                     .setNeutralButton(getActivity().getText(R.string.dlg_ok),
                             new DialogInterface.OnClickListener() {
@@ -1151,7 +1148,6 @@
                 case DLG_CANNOT_CLEAR_DATA:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.clear_failed_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.clear_failed_dlg_text))
                     .setNeutralButton(R.string.dlg_ok,
                             new DialogInterface.OnClickListener() {
@@ -1165,7 +1161,6 @@
                 case DLG_FORCE_STOP:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.force_stop_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.force_stop_dlg_text))
                     .setPositiveButton(R.string.dlg_ok,
                         new DialogInterface.OnClickListener() {
@@ -1181,14 +1176,12 @@
                             getOwner().getMoveErrMsg(moveErrorCode));
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.move_app_failed_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(msg)
                     .setNeutralButton(R.string.dlg_ok, null)
                     .create();
                 case DLG_DISABLE:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.app_disable_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.app_disable_dlg_text))
                     .setPositiveButton(R.string.dlg_ok,
                         new DialogInterface.OnClickListener() {
@@ -1204,7 +1197,6 @@
                 case DLG_DISABLE_NOTIFICATIONS:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.app_disable_notifications_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.app_disable_notifications_dlg_text))
                     .setPositiveButton(R.string.dlg_ok,
                         new DialogInterface.OnClickListener() {
@@ -1224,7 +1216,6 @@
                 case DLG_SPECIAL_DISABLE:
                     return new AlertDialog.Builder(getActivity())
                     .setTitle(getActivity().getText(R.string.app_special_disable_dlg_title))
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setMessage(getActivity().getText(R.string.app_special_disable_dlg_text))
                     .setPositiveButton(R.string.dlg_ok,
                             new DialogInterface.OnClickListener() {
diff --git a/src/com/android/settings/applications/RunningServiceDetails.java b/src/com/android/settings/applications/RunningServiceDetails.java
index 73547f1..45cad3d 100644
--- a/src/com/android/settings/applications/RunningServiceDetails.java
+++ b/src/com/android/settings/applications/RunningServiceDetails.java
@@ -583,7 +583,6 @@
                     
                     return new AlertDialog.Builder(getActivity())
                             .setTitle(getActivity().getString(R.string.runningservicedetails_stop_dlg_title))
-                            .setIconAttribute(android.R.attr.alertDialogIcon)
                             .setMessage(getActivity().getString(R.string.runningservicedetails_stop_dlg_text))
                             .setPositiveButton(R.string.dlg_ok,
                                     new DialogInterface.OnClickListener() {
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index be03b63..45f3d06 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -89,6 +89,16 @@
         mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
     }
 
+    public void setupSwitchBar() {
+        mSwitchBar.addOnSwitchChangeListener(this);
+        mSwitchBar.show();
+    }
+
+    public void teardownSwitchBar() {
+        mSwitchBar.removeOnSwitchChangeListener(this);
+        mSwitchBar.hide();
+    }
+
     public void resume(Context context) {
         if (mLocalAdapter == null) {
             mSwitch.setEnabled(false);
@@ -103,8 +113,6 @@
         handleStateChanged(mLocalAdapter.getBluetoothState());
 
         mContext.registerReceiver(mReceiver, mIntentFilter);
-        mSwitchBar.addOnSwitchChangeListener(this);
-        mSwitchBar.show();
         mValidListener = true;
     }
 
@@ -114,8 +122,6 @@
         }
 
         mContext.unregisterReceiver(mReceiver);
-        mSwitchBar.removeOnSwitchChangeListener(this);
-        mSwitchBar.hide();
         mValidListener = false;
     }
 
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index dd4edff..eb318cd 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -119,6 +119,14 @@
         mSwitchBar = activity.getSwitchBar();
 
         mBluetoothEnabler = new BluetoothEnabler(activity, mSwitchBar);
+        mBluetoothEnabler.setupSwitchBar();
+    }
+
+    @Override
+    public void onDestroyView() {
+        super.onDestroyView();
+
+        mBluetoothEnabler.teardownSwitchBar();
     }
 
     @Override
diff --git a/src/com/android/settings/bluetooth/Utils.java b/src/com/android/settings/bluetooth/Utils.java
index fb44d5a..1970400 100755
--- a/src/com/android/settings/bluetooth/Utils.java
+++ b/src/com/android/settings/bluetooth/Utils.java
@@ -93,7 +93,6 @@
         Context activity = manager.getForegroundActivity();
         if(manager.isForegroundActivity()) {
             new AlertDialog.Builder(activity)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
                 .setTitle(R.string.bluetooth_error_title)
                 .setMessage(message)
                 .setPositiveButton(android.R.string.ok, null)
diff --git a/src/com/android/settings/dashboard/DashboardTileView.java b/src/com/android/settings/dashboard/DashboardTileView.java
index a114f70..099459c 100644
--- a/src/com/android/settings/dashboard/DashboardTileView.java
+++ b/src/com/android/settings/dashboard/DashboardTileView.java
@@ -85,7 +85,7 @@
     public void onClick(View v) {
         if (mTile.fragment != null) {
             Utils.startWithFragment(getContext(), mTile.fragment, mTile.fragmentArguments, null, 0,
-                    mTile.getTitle(getResources()));
+                    mTile.titleRes, mTile.getTitle(getResources()));
         } else if (mTile.intent != null) {
             getContext().startActivity(mTile.intent);
         }
diff --git a/src/com/android/settings/dashboard/SearchResultsSummary.java b/src/com/android/settings/dashboard/SearchResultsSummary.java
index 387e9bc..5f23671 100644
--- a/src/com/android/settings/dashboard/SearchResultsSummary.java
+++ b/src/com/android/settings/dashboard/SearchResultsSummary.java
@@ -166,6 +166,9 @@
         mResultsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                // We have a header, so we need to decrement the position by one
+                position--;
+
                 final Cursor cursor = mResultsAdapter.mCursor;
                 cursor.moveToPosition(position);
 
@@ -181,7 +184,7 @@
                     Bundle args = new Bundle();
                     args.putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key);
 
-                    Utils.startWithFragment(sa, className, args, null, 0, screenTitle);
+                    Utils.startWithFragment(sa, className, args, null, 0, -1, screenTitle);
                 } else {
                     final Intent intent = new Intent(action);
 
@@ -202,12 +205,22 @@
                 saveQueryToDatabase();
             }
         });
+        mResultsListView.addHeaderView(
+                LayoutInflater.from(getActivity()).inflate(
+                R.layout.search_panel_results_header, mResultsListView, false));
 
         mSuggestionsListView = (ListView) view.findViewById(R.id.list_suggestions);
         mSuggestionsListView.setAdapter(mSuggestionsAdapter);
         mSuggestionsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                // We have a header, so we need to decrement the position by one
+                position--;
+                // Some Monkeys could create a case where they were probably clicking on the
+                // List Header and thus the position passed was "0" and then by decrement was "-1"
+                if (position < 0) {
+                    return;
+                }
                 final Cursor cursor = mSuggestionsAdapter.mCursor;
                 cursor.moveToPosition(position);
 
@@ -216,6 +229,9 @@
                 mSearchView.setQuery(mQuery, false);
             }
         });
+        mSuggestionsListView.addHeaderView(
+                LayoutInflater.from(getActivity()).inflate(
+                        R.layout.search_panel_suggestions_header, mSuggestionsListView, false));
 
         return view;
     }
@@ -572,7 +588,6 @@
 
             View view;
             TextView textTitle;
-            TextView textSummary;
             ImageView imageView;
 
             if (convertView == null) {
@@ -582,38 +597,11 @@
             }
 
             textTitle = (TextView) view.findViewById(R.id.title);
-            textSummary = (TextView) view.findViewById(R.id.summary);
             imageView = (ImageView) view.findViewById(R.id.icon);
 
             final SearchResult result = (SearchResult) getItem(position);
             textTitle.setText(result.title);
 
-            final String summaryOn = result.summaryOn;
-            final String entries = result.entries;
-
-            final StringBuilder sb = new StringBuilder();
-            if (!TextUtils.isEmpty(summaryOn) &&
-                    !summaryOn.contains(PERCENT_RECLACE) && !summaryOn.contains(DOLLAR_REPLACE)) {
-                sb.append(summaryOn);
-                sb.append(ELLIPSIS);
-            } else if (!TextUtils.isEmpty(entries)) {
-                final int index  = entries.indexOf(Index.ENTRIES_SEPARATOR);
-                if (index > 0) {
-                    final String firstEntriesValue = entries.substring(0, index);
-                    sb.append(firstEntriesValue);
-                } else {
-                    sb.append(entries);
-                }
-                sb.append(ELLIPSIS);
-            }
-
-            if (TextUtils.isEmpty(sb)) {
-                textSummary.setVisibility(View.GONE);
-            } else {
-                textSummary.setText(sb.toString());
-                textSummary.setVisibility(View.VISIBLE);
-            }
-
             if (result.iconResId != R.drawable.empty_icon) {
                 final Context packageContext = result.context;
                 final Drawable drawable;
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
index 4c6a503..85047ce 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
@@ -45,6 +45,7 @@
 
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Locale;
 
 public class BatteryHistoryChart extends View {
     static final boolean DEBUG = false;
@@ -200,10 +201,7 @@
     int mLevelBottom;
     int mLevelLeft;
     int mLevelRight;
-    static final int PHONE_SIGNAL_X_MASK = CHART_DATA_X_MASK;
-    static final int PHONE_SIGNAL_BIN_MASK = CHART_DATA_BIN_MASK;
-    static final int PHONE_SIGNAL_BIN_SHIFT = CHART_DATA_BIN_SHIFT;
-    
+
     int mNumHist;
     long mHistStart;
     long mHistDataEnd;
@@ -315,22 +313,11 @@
         final String label;
         final int width;
 
-        TimeLabel(Context context, TextPaint paint, int x, Calendar cal, boolean use24hr) {
+        TimeLabel(TextPaint paint, int x, Calendar cal, boolean use24hr) {
             this.x = x;
-            if (use24hr) {
-                label = context.getString(R.string.battery_stats_hour_24_label,
-                        cal.get(Calendar.HOUR_OF_DAY));
-            } else {
-                int hour = cal.get(Calendar.HOUR);
-                if (hour == 0) {
-                    hour = 12;
-                }
-                if (cal.get(Calendar.AM_PM) == Calendar.AM) {
-                    label = context.getString(R.string.battery_stats_hour_am_label, hour);
-                } else {
-                    label = context.getString(R.string.battery_stats_hour_pm_label, hour);
-                }
-            }
+            final String bestFormat = DateFormat.getBestDateTimePattern(
+                    Locale.getDefault(), use24hr ? "km" : "ha");
+            label = DateFormat.format(bestFormat, cal).toString();
             width = (int)paint.measureText(label);
         }
     }
@@ -340,15 +327,11 @@
         final String label;
         final int width;
 
-        DateLabel(Context context, TextPaint paint, int x, Calendar cal, boolean dayFirst) {
+        DateLabel(TextPaint paint, int x, Calendar cal, boolean dayFirst) {
             this.x = x;
-            if (dayFirst) {
-                label = context.getString(R.string.battery_stats_date_day_first_label,
-                        cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH));
-            } else {
-                label = context.getString(R.string.battery_stats_date_month_first_label,
-                        cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH));
-            }
+            final String bestFormat = DateFormat.getBestDateTimePattern(
+                    Locale.getDefault(), dayFirst ? "dM" : "Md");
+            label = DateFormat.format(bestFormat, cal).toString();
             width = (int)paint.measureText(label);
         }
     }
@@ -374,18 +357,22 @@
         mBatteryCriticalPaint.setStyle(Paint.Style.STROKE);
         mTimeRemainPaint.setColor(0xFFCED7BB);
         mTimeRemainPaint.setStyle(Paint.Style.FILL);
-        mChargingPaint.setARGB(255, 0, 128, 0);
         mChargingPaint.setStyle(Paint.Style.STROKE);
         mScreenOnPaint.setStyle(Paint.Style.STROKE);
         mGpsOnPaint.setStyle(Paint.Style.STROKE);
         mWifiRunningPaint.setStyle(Paint.Style.STROKE);
         mCpuRunningPaint.setStyle(Paint.Style.STROKE);
         mPhoneSignalChart.setColors(new int[] {
-                0x00000000, 0xffa00000, 0xffa07000, 0xffa0a000,
-                0xff80a000, 0xff409000, 0xff008000
+                0x00000000, 0xffc43828, 0xffe54918, 0xfff47b00,
+                0xfffabf2c, 0xff679e37, 0xff0a7f42
         });
         mDebugRectPaint.setARGB(255, 255, 0, 0);
         mDebugRectPaint.setStyle(Paint.Style.STROKE);
+        mScreenOnPaint.setColor(0xFF009688);
+        mGpsOnPaint.setColor(0xFF009688);
+        mWifiRunningPaint.setColor(0xFF009688);
+        mCpuRunningPaint.setColor(0xFF009688);
+        mChargingPaint.setColor(0xFF009688);
 
         TypedArray a =
             context.obtainStyledAttributes(
@@ -442,6 +429,11 @@
 
                 case R.styleable.BatteryHistoryChart_barPrimaryColor:
                     mBatteryBackgroundPaint.setColor(a.getInt(attr, 0));
+                    mScreenOnPaint.setColor(a.getInt(attr, 0));
+                    mGpsOnPaint.setColor(a.getInt(attr, 0));
+                    mWifiRunningPaint.setColor(a.getInt(attr, 0));
+                    mCpuRunningPaint.setColor(a.getInt(attr, 0));
+                    mChargingPaint.setColor(a.getInt(attr, 0));
                     break;
 
                 case R.styleable.BatteryHistoryChart_barPredictionColor:
@@ -497,11 +489,9 @@
                 R.string.percentage, 0);
 
         int batteryLevel = com.android.settings.Utils.getBatteryLevel(mBatteryBroadcast);
-        final int status = mBatteryBroadcast.getIntExtra(BatteryManager.EXTRA_STATUS,
-                BatteryManager.BATTERY_STATUS_UNKNOWN);
         long remainingTimeUs = 0;
         mDischarging = true;
-        if (status == BatteryManager.BATTERY_STATUS_DISCHARGING) {
+        if (mBatteryBroadcast.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) == 0) {
             final long drainTime = mStats.computeBatteryTimeRemaining(elapsedRealtimeUs);
             if (drainTime > 0) {
                 remainingTimeUs = drainTime;
@@ -517,6 +507,8 @@
             final long chargeTime = mStats.computeChargeTimeRemaining(elapsedRealtimeUs);
             final String statusLabel = com.android.settings.Utils.getBatteryStatus(getResources(),
                     mBatteryBroadcast);
+            final int status = mBatteryBroadcast.getIntExtra(BatteryManager.EXTRA_STATUS,
+                    BatteryManager.BATTERY_STATUS_UNKNOWN);
             if (chargeTime > 0 && status != BatteryManager.BATTERY_STATUS_FULL) {
                 mDischarging = false;
                 remainingTimeUs = chargeTime;
@@ -706,17 +698,9 @@
                 // Compress lines to make more room for chart.
                 mLineWidth = textHeight/3;
             }
-            mScreenOnPaint.setARGB(255, 32, 64, 255);
-            mGpsOnPaint.setARGB(255, 32, 64, 255);
-            mWifiRunningPaint.setARGB(255, 32, 64, 255);
-            mCpuRunningPaint.setARGB(255, 32, 64, 255);
         } else {
             mLargeMode = false;
             mLineWidth = mThinLineWidth;
-            mScreenOnPaint.setARGB(255, 0, 0, 255);
-            mGpsOnPaint.setARGB(255, 0, 0, 255);
-            mWifiRunningPaint.setARGB(255, 0, 0, 255);
-            mCpuRunningPaint.setARGB(255, 0, 0, 255);
         }
         if (mLineWidth <= 0) mLineWidth = 1;
 
@@ -1033,7 +1017,7 @@
     void addTimeLabel(Calendar cal, int levelLeft, int levelRight, boolean is24hr) {
         final long walltimeStart = mStartWallTime;
         final long walltimeChange = mEndWallTime-walltimeStart;
-        mTimeLabels.add(new TimeLabel(getContext(), mTextPaint,
+        mTimeLabels.add(new TimeLabel(mTextPaint,
                 levelLeft + (int)(((cal.getTimeInMillis()-walltimeStart)*(levelRight-levelLeft))
                         / walltimeChange),
                 cal, is24hr));
@@ -1042,7 +1026,7 @@
     void addDateLabel(Calendar cal, int levelLeft, int levelRight, boolean isDayFirst) {
         final long walltimeStart = mStartWallTime;
         final long walltimeChange = mEndWallTime-walltimeStart;
-        mDateLabels.add(new DateLabel(getContext(), mTextPaint,
+        mDateLabels.add(new DateLabel(mTextPaint,
                 levelLeft + (int)(((cal.getTimeInMillis()-walltimeStart)*(levelRight-levelLeft))
                         / walltimeChange),
                 cal, isDayFirst));
diff --git a/src/com/android/settings/fuelgauge/BatterySaverSettings.java b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
new file mode 100644
index 0000000..808fb25
--- /dev/null
+++ b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2014 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.settings.fuelgauge;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import android.provider.Settings.Global;
+import android.util.Log;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.notification.SettingPref;
+
+public class BatterySaverSettings extends SettingsPreferenceFragment {
+    private static final String TAG = "BatterySaverSettings";
+    private static final String KEY_ALWAYS_ON = "always_on";
+    private static final String KEY_TURN_ON_AUTOMATICALLY = "turn_on_automatically";
+    private static final long WAIT_FOR_SWITCH_ANIM = 500;
+
+    private final Handler mHandler = new Handler();
+    private final SettingsObserver mSettingsObserver = new SettingsObserver(mHandler);
+
+    private Context mContext;
+    private boolean mCreated;
+    private SettingPref mAlwaysOnPref;
+    private SettingPref mTriggerPref;
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+        if (mCreated) return;
+        mCreated = true;
+        addPreferencesFromResource(R.xml.battery_saver_settings);
+
+        mContext = getActivity();
+        mAlwaysOnPref = new SettingPref(SettingPref.TYPE_GLOBAL, KEY_ALWAYS_ON,
+                Global.LOW_POWER_MODE, 0) {
+            @Override
+            protected boolean setSetting(Context context, int value) {
+                mHandler.removeCallbacks(mStartMode);
+                if (value == 0) {
+                    return super.setSetting(context, value);
+                } else {
+                    // about lose animations, make sure we don't turn the mode on until the switch
+                    // stops moving
+                    mHandler.postDelayed(mStartMode, WAIT_FOR_SWITCH_ANIM);
+                    return true;
+                }
+            }
+        };
+        mTriggerPref = new SettingPref(SettingPref.TYPE_GLOBAL, KEY_TURN_ON_AUTOMATICALLY,
+                Global.LOW_POWER_MODE_TRIGGER_LEVEL,
+                mContext.getResources().getInteger(
+                        com.android.internal.R.integer.config_lowBatteryWarningLevel),
+                getResources().getIntArray(R.array.battery_saver_trigger_values)) {
+            @Override
+            protected String getCaption(Resources res, int value) {
+                if (value > 0 && value < 100) {
+                    return res.getString(R.string.battery_saver_turn_on_automatically_pct, value);
+                }
+                return res.getString(R.string.battery_saver_turn_on_automatically_never);
+            }
+        };
+        mAlwaysOnPref.init(this);
+        mTriggerPref.init(this);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        mSettingsObserver.setListening(true);
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        mSettingsObserver.setListening(false);
+    }
+
+    private final Runnable mStartMode = new Runnable() {
+        @Override
+        public void run() {
+            AsyncTask.execute(new Runnable() {
+                @Override
+                public void run() {
+                    Log.d(TAG, "Starting LOW_POWER_MODE from settings");
+                    Global.putInt(mContext.getContentResolver(), Global.LOW_POWER_MODE, 1);
+                }
+            });
+        }
+    };
+
+    private final class SettingsObserver extends ContentObserver {
+        private final Uri LOW_POWER_MODE_URI = Global.getUriFor(Global.LOW_POWER_MODE);
+        private final Uri LOW_POWER_MODE_TRIGGER_LEVEL_URI
+                = Global.getUriFor(Global.LOW_POWER_MODE_TRIGGER_LEVEL);
+
+        public SettingsObserver(Handler handler) {
+            super(handler);
+        }
+
+        @Override
+        public void onChange(boolean selfChange, Uri uri) {
+            if (LOW_POWER_MODE_URI.equals(uri)) {
+                mAlwaysOnPref.update(mContext);
+            }
+            if (LOW_POWER_MODE_TRIGGER_LEVEL_URI.equals(uri)) {
+                mTriggerPref.update(mContext);
+            }
+        }
+
+        public void setListening(boolean listening) {
+            final ContentResolver cr = getContentResolver();
+            if (listening) {
+                cr.registerContentObserver(LOW_POWER_MODE_URI, false, this);
+                cr.registerContentObserver(LOW_POWER_MODE_TRIGGER_LEVEL_URI, false, this);
+            } else {
+                cr.unregisterContentObserver(this);
+            }
+        }
+    }
+}
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index e4e2b0a..1159a2c 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -60,7 +60,8 @@
 
     private static final int MENU_STATS_TYPE = Menu.FIRST;
     private static final int MENU_STATS_REFRESH = Menu.FIRST + 1;
-    private static final int MENU_HELP = Menu.FIRST + 2;
+    private static final int MENU_BATTERY_SAVER = Menu.FIRST + 2;
+    private static final int MENU_HELP = Menu.FIRST + 3;
 
     private UserManager mUm;
 
@@ -180,6 +181,9 @@
         refresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
                 MenuItem.SHOW_AS_ACTION_WITH_TEXT);
 
+        MenuItem batterySaver = menu.add(0, MENU_BATTERY_SAVER, 0, R.string.battery_saver);
+        batterySaver.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+
         String helpUrl;
         if (!TextUtils.isEmpty(helpUrl = getResources().getString(R.string.help_url_battery))) {
             final MenuItem help = menu.add(0, MENU_HELP, 0, R.string.help_label);
@@ -203,6 +207,11 @@
                 refreshStats();
                 mHandler.removeMessages(MSG_REFRESH_STATS);
                 return true;
+            case MENU_BATTERY_SAVER:
+                final SettingsActivity sa = (SettingsActivity) getActivity();
+                sa.startPreferencePanel(BatterySaverSettings.class.getName(), null,
+                        R.string.battery_saver, null, null, 0);
+                return true;
             default:
                 return false;
         }
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
index 419a877..3351e63 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
@@ -166,7 +166,6 @@
                 if (mDialog == null) {
                     mDialog = (new AlertDialog.Builder(getActivity()))
                             .setTitle(android.R.string.dialog_alert_title)
-                            .setIconAttribute(android.R.attr.alertDialogIcon)
                             .setCancelable(true)
                             .setPositiveButton(android.R.string.ok,
                                     new DialogInterface.OnClickListener() {
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index 1d920de..e04f2c7 100644
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -265,7 +265,6 @@
         }
         mDialog = (new AlertDialog.Builder(mFragment.getActivity()))
                 .setTitle(android.R.string.dialog_alert_title)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
                 .setCancelable(true)
                 .setPositiveButton(android.R.string.ok,
                         new DialogInterface.OnClickListener() {
diff --git a/src/com/android/settings/inputmethod/SpellCheckersSettings.java b/src/com/android/settings/inputmethod/SpellCheckersSettings.java
index 8b1b867..03867c7 100644
--- a/src/com/android/settings/inputmethod/SpellCheckersSettings.java
+++ b/src/com/android/settings/inputmethod/SpellCheckersSettings.java
@@ -122,7 +122,6 @@
         }
         mDialog = (new AlertDialog.Builder(getActivity()))
                 .setTitle(android.R.string.dialog_alert_title)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
                 .setCancelable(true)
                 .setPositiveButton(android.R.string.ok,
                         new DialogInterface.OnClickListener() {
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 8794a8d..b10d4b6 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -73,6 +73,16 @@
 
         mSwitchBar = activity.getSwitchBar();
         mSwitch = mSwitchBar.getSwitch();
+        mSwitchBar.addOnSwitchChangeListener(this);
+        mSwitchBar.show();
+    }
+
+    @Override
+    public void onDestroyView() {
+        super.onDestroyView();
+
+        mSwitchBar.removeOnSwitchChangeListener(this);
+        mSwitchBar.hide();
     }
 
     @Override
@@ -84,8 +94,6 @@
     public void onResume() {
         super.onResume();
         createPreferenceHierarchy();
-        mSwitchBar.addOnSwitchChangeListener(this);
-        mSwitchBar.show();
         mValidListener = true;
     }
 
@@ -97,8 +105,6 @@
             // Ignore exceptions caused by race condition
         }
         super.onPause();
-        mSwitchBar.removeOnSwitchChangeListener(this);
-        mSwitchBar.hide();
         mValidListener = false;
     }
 
diff --git a/src/com/android/settings/nfc/AndroidBeam.java b/src/com/android/settings/nfc/AndroidBeam.java
index eb3ff9b..add0fa7 100644
--- a/src/com/android/settings/nfc/AndroidBeam.java
+++ b/src/com/android/settings/nfc/AndroidBeam.java
@@ -33,7 +33,6 @@
     private View mView;
     private NfcAdapter mNfcAdapter;
     private SwitchBar mSwitchBar;
-    private Switch mSwitch;
     private CharSequence mOldActivityTitle;
 
     @Override
@@ -63,46 +62,33 @@
         SettingsActivity activity = (SettingsActivity) getActivity();
 
         mSwitchBar = activity.getSwitchBar();
-        mSwitch = mSwitchBar.getSwitch();
-        mSwitch.setChecked(mNfcAdapter.isNdefPushEnabled());
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-
+        mSwitchBar.setChecked(mNfcAdapter.isNdefPushEnabled());
         mSwitchBar.addOnSwitchChangeListener(this);
         mSwitchBar.show();
     }
 
     @Override
-    public void onPause() {
-        super.onPause();
-
-        mSwitchBar.removeOnSwitchChangeListener(this);
-        mSwitchBar.hide();
-    }
-
-    @Override
     public void onDestroyView() {
         super.onDestroyView();
         if (mOldActivityTitle != null) {
             getActivity().getActionBar().setTitle(mOldActivityTitle);
         }
+        mSwitchBar.removeOnSwitchChangeListener(this);
+        mSwitchBar.hide();
     }
 
     @Override
     public void onSwitchChanged(Switch switchView, boolean desiredState) {
         boolean success = false;
-        mSwitch.setEnabled(false);
+        mSwitchBar.setEnabled(false);
         if (desiredState) {
             success = mNfcAdapter.enableNdefPush();
         } else {
             success = mNfcAdapter.disableNdefPush();
         }
         if (success) {
-            mSwitch.setChecked(desiredState);
+            mSwitchBar.setChecked(desiredState);
         }
-        mSwitch.setEnabled(true);
+        mSwitchBar.setEnabled(true);
     }
 }
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 91035732..ec8af26 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -20,6 +20,7 @@
 import android.app.AlertDialog;
 import android.app.INotificationManager;
 import android.app.ListFragment;
+import android.app.Notification;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
@@ -65,10 +66,22 @@
     private static final String TAG = "AppNotificationSettings";
     private static final boolean DEBUG = true;
 
+    /**
+     * Show a checkbox in the per-app notification control dialog to allow the user
+     * to promote this app's notifications to higher priority.
+     */
+    private static final boolean ENABLE_APP_NOTIFICATION_PRIORITY_OPTION = false;
+    /**
+     * Show a checkbox in the per-app notification control dialog to allow the user to
+     * selectively redact this app's notifications on the lockscreen.
+     */
+    private static final boolean ENABLE_APP_NOTIFICATION_PRIVACY_OPTION = false;
+
     private static final String SECTION_BEFORE_A = "*";
     private static final String SECTION_AFTER_Z = "**";
     private static final Intent APP_NOTIFICATION_PREFS_CATEGORY_INTENT
-            = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_NOTIFICATION_PREFERENCES);
+            = new Intent(Intent.ACTION_MAIN)
+                .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES);
 
     private final Handler mHandler = new Handler();
     private final ArrayMap<String, AppRow> mRows = new ArrayMap<String, AppRow>();
@@ -187,6 +200,14 @@
         final CheckBox priBox = (CheckBox) layout.findViewById(android.R.id.button2);
         final CheckBox senBox = (CheckBox) layout.findViewById(android.R.id.button3);
 
+        if (!ENABLE_APP_NOTIFICATION_PRIORITY_OPTION) {
+            priBox.setVisibility(View.GONE);
+        }
+
+        if (!ENABLE_APP_NOTIFICATION_PRIVACY_OPTION) {
+            senBox.setVisibility(View.GONE);
+        }
+
         showBox.setChecked(!row.banned);
         final OnCheckedChangeListener showListener = new OnCheckedChangeListener() {
             @Override
diff --git a/src/com/android/settings/notification/DropDownPreference.java b/src/com/android/settings/notification/DropDownPreference.java
index 36ecf95..45c83a5 100644
--- a/src/com/android/settings/notification/DropDownPreference.java
+++ b/src/com/android/settings/notification/DropDownPreference.java
@@ -97,8 +97,12 @@
         }
     }
 
-    public void addItem(int resId, Object value) {
-        mAdapter.add(mContext.getResources().getString(resId));
+    public void addItem(int captionResid, Object value) {
+        addItem(mContext.getResources().getString(captionResid), value);
+    }
+
+    public void addItem(String caption, Object value) {
+        mAdapter.add(caption);
         mValues.add(value);
     }
 
diff --git a/src/com/android/settings/notification/ManagedServiceSettings.java b/src/com/android/settings/notification/ManagedServiceSettings.java
index 1144cb9..880ecde 100644
--- a/src/com/android/settings/notification/ManagedServiceSettings.java
+++ b/src/com/android/settings/notification/ManagedServiceSettings.java
@@ -106,7 +106,6 @@
             return new AlertDialog.Builder(getActivity())
                     .setMessage(summary)
                     .setTitle(title)
-                    .setIconAttribute(android.R.attr.alertDialogIcon)
                     .setCancelable(true)
                     .setPositiveButton(android.R.string.ok,
                             new DialogInterface.OnClickListener() {
diff --git a/src/com/android/settings/notification/OtherSoundSettings.java b/src/com/android/settings/notification/OtherSoundSettings.java
index de5c917..8528ec7 100644
--- a/src/com/android/settings/notification/OtherSoundSettings.java
+++ b/src/com/android/settings/notification/OtherSoundSettings.java
@@ -21,6 +21,7 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.res.Resources;
 import android.database.ContentObserver;
 import android.media.AudioManager;
 import android.net.Uri;
@@ -114,10 +115,15 @@
         }
 
         @Override
-        protected int getResId(Context context, int value) {
-            if (value == DOCK_AUDIO_MEDIA_DISABLED) return R.string.dock_audio_media_disabled;
-            if (value == DOCK_AUDIO_MEDIA_ENABLED) return R.string.dock_audio_media_enabled;
-            throw new IllegalArgumentException();
+        protected String getCaption(Resources res, int value) {
+            switch(value) {
+                case DOCK_AUDIO_MEDIA_DISABLED:
+                    return res.getString(R.string.dock_audio_media_disabled);
+                case DOCK_AUDIO_MEDIA_ENABLED:
+                    return res.getString(R.string.dock_audio_media_enabled);
+                default:
+                    throw new IllegalArgumentException();
+            }
         }
     };
 
@@ -131,11 +137,17 @@
         }
 
         @Override
-        protected int getResId(Context context, int value) {
-            if (value == EMERGENCY_TONE_SILENT) return R.string.emergency_tone_silent;
-            if (value == EMERGENCY_TONE_ALERT) return R.string.emergency_tone_alert;
-            if (value == EMERGENCY_TONE_VIBRATE) return R.string.emergency_tone_vibrate;
-            throw new IllegalArgumentException();
+        protected String getCaption(Resources res, int value) {
+            switch(value) {
+                case EMERGENCY_TONE_SILENT:
+                    return res.getString(R.string.emergency_tone_silent);
+                case EMERGENCY_TONE_ALERT:
+                    return res.getString(R.string.emergency_tone_alert);
+                case EMERGENCY_TONE_VIBRATE:
+                    return res.getString(R.string.emergency_tone_vibrate);
+                default:
+                    throw new IllegalArgumentException();
+            }
         }
     };
 
diff --git a/src/com/android/settings/notification/SettingPref.java b/src/com/android/settings/notification/SettingPref.java
index 1e50e2b..7fd89d8 100644
--- a/src/com/android/settings/notification/SettingPref.java
+++ b/src/com/android/settings/notification/SettingPref.java
@@ -18,6 +18,7 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.res.Resources;
 import android.net.Uri;
 import android.preference.Preference;
 import android.preference.TwoStatePreference;
@@ -55,7 +56,7 @@
         return true;
     }
 
-    protected int getResId(Context context, int value) {
+    protected String getCaption(Resources res, int value) {
         throw new UnsupportedOperationException();
     }
 
@@ -71,7 +72,7 @@
         } else if (p instanceof DropDownPreference) {
             mDropDown = (DropDownPreference) p;
             for (int value : mValues) {
-                mDropDown.addItem(getResId(context, value), value);
+                mDropDown.addItem(getCaption(context.getResources(), value), value);
             }
         }
         update(context);
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index e9323d8..40e2c55 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -107,7 +107,6 @@
     private final SettingsObserver mSettingsObserver = new SettingsObserver();
 
     private SwitchBar mSwitchBar;
-    private Switch mSwitch;
     private Context mContext;
     private PackageManager mPM;
     private ZenModeConfig mConfig;
@@ -159,7 +158,8 @@
         if (DEBUG) Log.d(TAG, "Loaded mConfig=" + mConfig);
 
         mSwitchBar = ((SettingsActivity) mContext).getSwitchBar();
-        mSwitch = mSwitchBar.getSwitch();
+        mSwitchBar.addOnSwitchChangeListener(this);
+        mSwitchBar.show();
 
         final PreferenceCategory general = (PreferenceCategory) root.findPreference(KEY_GENERAL);
 
@@ -400,14 +400,17 @@
         updateControls();
         updateZenMode();
         mSettingsObserver.register();
-        mSwitchBar.addOnSwitchChangeListener(this);
-        mSwitchBar.show();
     }
 
     @Override
     public void onPause() {
         super.onPause();
         mSettingsObserver.unregister();
+    }
+
+    @Override
+    public void onDestroyView() {
+        super.onDestroyView();
         mSwitchBar.removeOnSwitchChangeListener(this);
         mSwitchBar.hide();
     }
@@ -415,8 +418,8 @@
     private void updateZenMode() {
         final boolean zenMode = Global.getInt(getContentResolver(),
                 Global.ZEN_MODE, Global.ZEN_MODE_OFF) != Global.ZEN_MODE_OFF;
-        if (mSwitch.isChecked() != zenMode) {
-            mSwitch.setChecked(zenMode);
+        if (mSwitchBar.isChecked() != zenMode) {
+            mSwitchBar.setChecked(zenMode);
             mIgnoreNext = true;
         }
     }
diff --git a/src/com/android/settings/print/PrintServiceSettingsFragment.java b/src/com/android/settings/print/PrintServiceSettingsFragment.java
index f104a06..7af6338 100644
--- a/src/com/android/settings/print/PrintServiceSettingsFragment.java
+++ b/src/com/android/settings/print/PrintServiceSettingsFragment.java
@@ -143,16 +143,12 @@
         mSettingsContentObserver.register(getContentResolver());
         updateEmptyView();
         updateUiForServiceState();
-        mSwitchBar.addOnSwitchChangeListener(this);
-        mSwitchBar.show();
     }
 
     @Override
     public void onPause() {
         mSettingsContentObserver.unregister(getContentResolver());
         super.onPause();
-        mSwitchBar.removeOnSwitchChangeListener(this);
-        mSwitchBar.hide();
     }
 
     @Override
@@ -168,6 +164,8 @@
             getActivity().getActionBar().setTitle(mOldActivityTitle);
         }
         super.onDestroyView();
+        mSwitchBar.removeOnSwitchChangeListener(this);
+        mSwitchBar.hide();
     }
 
     private void onPreferenceToggled(String preferenceKey, boolean enabled) {
@@ -195,7 +193,6 @@
         }
         return new AlertDialog.Builder(getActivity())
                 .setTitle(title)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
                 .setMessage(message)
                 .setCancelable(true)
                 .setPositiveButton(android.R.string.ok, this)
@@ -293,6 +290,8 @@
         final SettingsActivity activity = (SettingsActivity) getActivity();
 
         mSwitchBar = activity.getSwitchBar();
+        mSwitchBar.addOnSwitchChangeListener(this);
+        mSwitchBar.show();
 
         mToggleSwitch = mSwitchBar.getSwitch();
         mToggleSwitch.setOnBeforeCheckedChangeListener(new ToggleSwitch.OnBeforeCheckedChangeListener() {
@@ -740,7 +739,7 @@
                     }
                 });
             }
-            mDiscoverySession.startPrinterDisovery(null);
+            mDiscoverySession.startPrinterDiscovery(null);
         }
     }
 }
diff --git a/src/com/android/settings/quicklaunch/QuickLaunchSettings.java b/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
index 0081a1e..a7ddc07 100644
--- a/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
+++ b/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
@@ -153,7 +153,6 @@
                 // Create the dialog for clearing a shortcut
                 return new AlertDialog.Builder(getActivity())
                         .setTitle(getString(R.string.quick_launch_clear_dialog_title))
-                        .setIconAttribute(android.R.attr.alertDialogIcon)
                         .setMessage(getString(R.string.quick_launch_clear_dialog_message,
                                 mClearDialogShortcut, mClearDialogBookmarkTitle))
                         .setPositiveButton(R.string.quick_launch_clear_ok_button, this)
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index 1b1825c..9723fbf 100644
--- a/src/com/android/settings/search/Index.java
+++ b/src/com/android/settings/search/Index.java
@@ -139,6 +139,8 @@
     // Max number of proposed suggestions
     private static final int MAX_PROPOSED_SUGGESTIONS = 5;
 
+    private static final String BASE_AUTHORITY = "com.android.settings";
+
     private static final String EMPTY = "";
     private static final String NON_BREAKING_HYPHEN = "\u2011";
     private static final String HYPHEN = "-";
@@ -160,6 +162,7 @@
     private final AtomicBoolean mIsAvailable = new AtomicBoolean(false);
     private final UpdateData mDataToProcess = new UpdateData();
     private Context mContext;
+    private final String mBaseAuthority;
 
     /**
      * A private class to describe the update data for the Index database
@@ -190,15 +193,16 @@
      */
     public static Index getInstance(Context context) {
         if (sInstance == null) {
-            sInstance = new Index(context);
+            sInstance = new Index(context, BASE_AUTHORITY);
         } else {
             sInstance.setContext(context);
         }
         return sInstance;
     }
 
-    public Index(Context context) {
+    public Index(Context context, String baseAuthority) {
         mContext = context;
+        mBaseAuthority = baseAuthority;
     }
 
     public void setContext(Context context) {
@@ -286,14 +290,15 @@
         try {
             final int baseRank = Ranking.getBaseRankForAuthority(authority);
 
-            final Context packageContext = mContext.createPackageContext(packageName, 0);
+            final Context context = mBaseAuthority.equals(authority) ?
+                    mContext : mContext.createPackageContext(packageName, 0);
 
             final Uri uriForResources = buildUriForXmlResources(authority);
-            addIndexablesForXmlResourceUri(packageContext, packageName, uriForResources,
+            addIndexablesForXmlResourceUri(context, packageName, uriForResources,
                     SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS, baseRank);
 
             final Uri uriForRawData = buildUriForRawData(authority);
-            addIndexablesForRawDataUri(packageContext, packageName, uriForRawData,
+            addIndexablesForRawDataUri(context, packageName, uriForRawData,
                     SearchIndexablesContract.INDEXABLES_RAW_COLUMNS, baseRank);
             return true;
         } catch (PackageManager.NameNotFoundException e) {
@@ -1137,7 +1142,12 @@
             final int count = dataToUpdate.size();
             for (int n = 0; n < count; n++) {
                 final SearchIndexableData data = dataToUpdate.get(n);
-                indexOneSearchIndexableData(database, localeStr, data, nonIndexableKeys);
+                try {
+                    indexOneSearchIndexableData(database, localeStr, data, nonIndexableKeys);
+                } catch (Exception e) {
+                    Log.e(LOG_TAG,
+                            "Cannot index: " + data.className + " for locale: " + localeStr, e);
+                }
             }
 
             final long now = System.currentTimeMillis();
diff --git a/src/com/android/settings/search/Ranking.java b/src/com/android/settings/search/Ranking.java
index 074a8d7..80ea83a 100644
--- a/src/com/android/settings/search/Ranking.java
+++ b/src/com/android/settings/search/Ranking.java
@@ -30,6 +30,7 @@
 import com.android.settings.accessibility.AccessibilitySettings;
 import com.android.settings.bluetooth.BluetoothSettings;
 import com.android.settings.deviceinfo.Memory;
+import com.android.settings.fuelgauge.BatterySaverSettings;
 import com.android.settings.fuelgauge.PowerUsageSummary;
 import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
 import com.android.settings.location.LocationSettings;
@@ -103,6 +104,7 @@
         sRankMap.put(Memory.class.getName(), RANK_MEMORY);
 
         sRankMap.put(PowerUsageSummary.class.getName(), RANK_POWER_USAGE);
+        sRankMap.put(BatterySaverSettings.class.getName(), RANK_POWER_USAGE);
 
         sRankMap.put(UserSettings.class.getName(), RANK_USERS);
 
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index 01d3c07..086ebfc 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -33,6 +33,7 @@
 import com.android.settings.accessibility.AccessibilitySettings;
 import com.android.settings.bluetooth.BluetoothSettings;
 import com.android.settings.deviceinfo.Memory;
+import com.android.settings.fuelgauge.BatterySaverSettings;
 import com.android.settings.fuelgauge.PowerUsageSummary;
 import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
 import com.android.settings.location.LocationSettings;
@@ -87,9 +88,9 @@
         sResMap.put(WirelessSettings.class.getName(),
                 new SearchIndexableResource(
                         Ranking.getRankForClassName(WirelessSettings.class.getName()),
-                        R.xml.wireless_settings,
+                        NO_DATA_RES_ID,
                         WirelessSettings.class.getName(),
-                        R.drawable.empty_icon));
+                        R.drawable.ic_settings_more));
 
         sResMap.put(HomeSettings.class.getName(),
                 new SearchIndexableResource(
@@ -154,6 +155,13 @@
                         PowerUsageSummary.class.getName(),
                         R.drawable.ic_settings_battery));
 
+        sResMap.put(BatterySaverSettings.class.getName(),
+                new SearchIndexableResource(
+                        Ranking.getRankForClassName(BatterySaverSettings.class.getName()),
+                        R.xml.battery_saver_settings,
+                        BatterySaverSettings.class.getName(),
+                        R.drawable.ic_settings_battery));
+
         sResMap.put(UserSettings.class.getName(),
                 new SearchIndexableResource(
                         Ranking.getRankForClassName(UserSettings.class.getName()),
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index 4a98661..d3f9c7b 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -482,11 +482,10 @@
 
     private void displayNetworkAlert() {
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
-        builder.setTitle(android.R.string.dialog_alert_title);
-        builder.setIconAttribute(android.R.attr.alertDialogIcon);
-        builder.setMessage(getActivity().getString(R.string.tts_engine_network_required));
-        builder.setCancelable(false);
-        builder.setPositiveButton(android.R.string.ok, null);
+        builder.setTitle(android.R.string.dialog_alert_title)
+                .setMessage(getActivity().getString(R.string.tts_engine_network_required))
+                .setCancelable(false)
+                .setPositiveButton(android.R.string.ok, null);
 
         AlertDialog dialog = builder.create();
         dialog.show();
diff --git a/src/com/android/settings/tts/TtsEnginePreference.java b/src/com/android/settings/tts/TtsEnginePreference.java
index 7e50c47..ae921f8 100644
--- a/src/com/android/settings/tts/TtsEnginePreference.java
+++ b/src/com/android/settings/tts/TtsEnginePreference.java
@@ -198,13 +198,12 @@
         Log.i(TAG, "Displaying data alert for :" + mEngineInfo.name);
 
         AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
-        builder.setTitle(android.R.string.dialog_alert_title);
-        builder.setIconAttribute(android.R.attr.alertDialogIcon);
-        builder.setMessage(getContext().getString(
-                R.string.tts_engine_security_warning, mEngineInfo.label));
-        builder.setCancelable(true);
-        builder.setPositiveButton(android.R.string.ok, positiveOnClickListener);
-        builder.setNegativeButton(android.R.string.cancel, negativeOnClickListener);
+        builder.setTitle(android.R.string.dialog_alert_title)
+                .setMessage(getContext().getString(
+                        R.string.tts_engine_security_warning, mEngineInfo.label))
+                .setCancelable(true)
+                .setPositiveButton(android.R.string.ok, positiveOnClickListener)
+                .setNegativeButton(android.R.string.cancel, negativeOnClickListener);
 
         AlertDialog dialog = builder.create();
         dialog.show();
diff --git a/src/com/android/settings/tts/TtsEngineSettingsFragment.java b/src/com/android/settings/tts/TtsEngineSettingsFragment.java
index 47493fb..15824cf 100644
--- a/src/com/android/settings/tts/TtsEngineSettingsFragment.java
+++ b/src/com/android/settings/tts/TtsEngineSettingsFragment.java
@@ -233,34 +233,25 @@
             mLocalePreference.setEnabled(false);
             return;
         }
-        String currentLocale = "";
+        Locale currentLocale = null;
         if (!mEnginesHelper.isLocaleSetToDefaultForEngine(getEngineName())) {
             currentLocale = mEnginesHelper.getLocalePrefForEngine(getEngineName());
         }
 
-        ArrayList<Pair<String, String>> entryPairs =
-                new ArrayList<Pair<String, String>>(availableLangs.size());
+        ArrayList<Pair<String, Locale>> entryPairs =
+                new ArrayList<Pair<String, Locale>>(availableLangs.size());
         for (int i = 0; i < availableLangs.size(); i++) {
-            String[] langCountryVariant = availableLangs.get(i).split("-");
-            Locale loc = null;
-            if (langCountryVariant.length == 1){
-                loc = new Locale(langCountryVariant[0]);
-            } else if (langCountryVariant.length == 2){
-                loc = new Locale(langCountryVariant[0], langCountryVariant[1]);
-            } else if (langCountryVariant.length == 3){
-                loc = new Locale(langCountryVariant[0], langCountryVariant[1],
-                                 langCountryVariant[2]);
-            }
-            if (loc != null){
-                entryPairs.add(new Pair<String, String>(
-                        loc.getDisplayName(), availableLangs.get(i)));
+            Locale locale = mEnginesHelper.parseLocaleString(availableLangs.get(i));
+            if (locale != null){
+                entryPairs.add(new Pair<String, Locale>(
+                        locale.getDisplayName(), locale));
             }
         }
 
         // Sort it
-        Collections.sort(entryPairs, new Comparator<Pair<String, String>>() {
+        Collections.sort(entryPairs, new Comparator<Pair<String, Locale>>() {
             @Override
-            public int compare(Pair<String, String> lhs, Pair<String, String> rhs) {
+            public int compare(Pair<String, Locale> lhs, Pair<String, Locale> rhs) {
                 return lhs.first.compareToIgnoreCase(rhs.first);
             }
         });
@@ -274,12 +265,12 @@
         entryValues[0] = "";
 
         int i = 1;
-        for (Pair<String, String> entry : entryPairs) {
-            if (entry.second.equalsIgnoreCase(currentLocale)) {
+        for (Pair<String, Locale> entry : entryPairs) {
+            if (entry.second.equals(currentLocale)) {
                 mSelectedLocaleIndex = i;
             }
             entries[i] = entry.first;
-            entryValues[i++] = entry.second;
+            entryValues[i++] = entry.second.toString();
         }
 
         mLocalePreference.setEntries(entries);
@@ -332,16 +323,19 @@
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         if (preference == mLocalePreference) {
-            updateLanguageTo((String) newValue);
+            String localeString = (String) newValue;
+            updateLanguageTo((!TextUtils.isEmpty(localeString) ?
+                    mEnginesHelper.parseLocaleString(localeString) : null));
             return true;
         }
         return false;
     }
 
-    private void updateLanguageTo(String locale) {
+    private void updateLanguageTo(Locale locale) {
         int selectedLocaleIndex = -1;
+        String localeString = (locale != null) ? locale.toString() : "";
         for (int i=0; i < mLocalePreference.getEntryValues().length; i++) {
-            if (locale.equalsIgnoreCase(mLocalePreference.getEntryValues()[i].toString())) {
+            if (localeString.equalsIgnoreCase(mLocalePreference.getEntryValues()[i].toString())) {
                 selectedLocaleIndex = i;
                 break;
             }
@@ -357,15 +351,8 @@
         mEnginesHelper.updateLocalePrefForEngine(getEngineName(), locale);
 
         if (getEngineName().equals(mTts.getCurrentEngine())) {
-            if (!locale.isEmpty()) {
-                String[] localeArray = TtsEngines.parseLocalePref(locale);
-                if (localeArray != null) {
-                    mTts.setLanguage(new Locale(localeArray[0], localeArray[1], localeArray[2]));
-                }
-            } else {
-                // Empty locale means "use system default"
-                mTts.setLanguage(Locale.getDefault());
-            }
+            // Null locale means "use system default"
+            mTts.setLanguage((locale != null) ? locale : Locale.getDefault());
         }
     }
 
diff --git a/src/com/android/settings/users/RestrictedProfileSettings.java b/src/com/android/settings/users/RestrictedProfileSettings.java
index c293536..535e196 100644
--- a/src/com/android/settings/users/RestrictedProfileSettings.java
+++ b/src/com/android/settings/users/RestrictedProfileSettings.java
@@ -202,7 +202,6 @@
 
             mEditUserInfoDialog = new AlertDialog.Builder(getActivity())
                 .setTitle(R.string.profile_info_settings_title)
-                .setIconAttribute(R.drawable.ic_settings_multiuser)
                 .setView(content)
                 .setCancelable(true)
                 .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
diff --git a/src/com/android/settings/users/UserPreference.java b/src/com/android/settings/users/UserPreference.java
index 9f53aa5..56ca114 100644
--- a/src/com/android/settings/users/UserPreference.java
+++ b/src/com/android/settings/users/UserPreference.java
@@ -58,11 +58,13 @@
 
     @Override
     protected void onBindView(View view) {
+        UserManager um = (UserManager) getContext().getSystemService(Context.USER_SERVICE);
         View deleteDividerView = view.findViewById(R.id.divider_delete);
         View manageDividerView = view.findViewById(R.id.divider_manage);
         View deleteView = view.findViewById(R.id.trash_user);
         if (deleteView != null) {
-            if (mDeleteClickListener != null) {
+            if (mDeleteClickListener != null
+                    && !um.hasUserRestriction(UserManager.DISALLOW_REMOVE_USER)) {
                 deleteView.setOnClickListener(mDeleteClickListener);
                 deleteView.setTag(this);
             } else {
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index a05aaa9..8d27c65 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -64,12 +64,12 @@
 import com.android.settings.ChooseLockGeneric;
 import com.android.settings.OwnerInfoSettings;
 import com.android.settings.R;
-import com.android.settings.RestrictedSettingsFragment;
 import com.android.settings.SelectableEditTextPreference;
 import com.android.settings.SettingsActivity;
+import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.Utils;
 
-public class UserSettings extends RestrictedSettingsFragment
+public class UserSettings extends SettingsPreferenceFragment
         implements OnPreferenceClickListener, OnClickListener, DialogInterface.OnDismissListener,
         Preference.OnPreferenceChangeListener {
 
@@ -136,10 +136,6 @@
     private SparseArray<Bitmap> mUserIcons = new SparseArray<Bitmap>();
     private boolean mIsOwner = UserHandle.myUserId() == UserHandle.USER_OWNER;
 
-    public UserSettings() {
-        super(RestrictedSettingsFragment.RESTRICTIONS_PIN_SET);
-    }
-
     private Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
@@ -186,7 +182,9 @@
         }
         final Context context = getActivity();
         mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
-        if (!mUserManager.supportsMultipleUsers() || Utils.isMonkeyRunning()) {
+        boolean hasMultipleUsers = mUserManager.getUserCount() > 1;
+        if ((!UserManager.supportsMultipleUsers() && !hasMultipleUsers)
+                || Utils.isMonkeyRunning()) {
             mEnabled = false;
             return;
         }
@@ -201,7 +199,9 @@
             mMePreference.setSummary(R.string.user_owner);
         }
         mAddUser = findPreference(KEY_ADD_USER);
-        if (!mIsOwner || UserManager.getMaxSupportedUsers() < 2) {
+        if (!mIsOwner || UserManager.getMaxSupportedUsers() < 2
+                || !UserManager.supportsMultipleUsers()
+                || mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER)) {
             removePreference(KEY_ADD_USER);
         } else {
             mAddUser.setOnPreferenceClickListener(this);
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 73aae99..ea6325e 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -29,8 +29,10 @@
 import android.os.Message;
 import android.os.ServiceManager;
 import android.os.SystemProperties;
+import android.os.UserManager;
 import android.preference.Preference;
 import android.preference.PreferenceGroup;
+import android.preference.PreferenceScreen;
 import android.security.Credentials;
 import android.security.KeyStore;
 import android.text.TextUtils;
@@ -45,6 +47,7 @@
 import android.widget.AdapterView.AdapterContextMenuInfo;
 import android.widget.ArrayAdapter;
 import android.widget.ListView;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import com.android.internal.net.LegacyVpnInfo;
@@ -80,14 +83,25 @@
 
     private Handler mUpdater;
     private LegacyVpnInfo mInfo;
+    private UserManager mUm;
 
     // The key of the profile for the current ContextMenu.
     private String mSelectedKey;
 
+    private boolean mUnavailable;
+
     @Override
     public void onCreate(Bundle savedState) {
         super.onCreate(savedState);
 
+        mUm = (UserManager) getSystemService(Context.USER_SERVICE);
+
+        if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
+            mUnavailable = true;
+            setPreferenceScreen(new PreferenceScreen(getActivity(), null));
+            return;
+        }
+
         setHasOptionsMenu(true);
         addPreferencesFromResource(R.xml.vpn_settings2);
 
@@ -156,6 +170,15 @@
     public void onResume() {
         super.onResume();
 
+        if (mUnavailable) {
+            TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
+            getListView().setEmptyView(emptyView);
+            if (emptyView != null) {
+                emptyView.setText(R.string.vpn_settings_not_available);
+            }
+            return;
+        }
+
         final boolean pickLockdown = getActivity()
                 .getIntent().getBooleanExtra(EXTRA_PICK_LOCKDOWN, false);
         if (pickLockdown) {
@@ -214,6 +237,10 @@
     public void onPause() {
         super.onPause();
 
+        if (mUnavailable) {
+            return;
+        }
+
         // Hide the dialog if there is one.
         if (mDialog != null) {
             mDialog.setOnDismissListener(null);
diff --git a/src/com/android/settings/widget/SwitchBar.java b/src/com/android/settings/widget/SwitchBar.java
index bc06d87..b503cf6 100644
--- a/src/com/android/settings/widget/SwitchBar.java
+++ b/src/com/android/settings/widget/SwitchBar.java
@@ -17,10 +17,11 @@
 package com.android.settings.widget;
 
 import android.content.Context;
+import android.os.Parcel;
+import android.os.Parcelable;
 import android.transition.TransitionManager;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.CompoundButton;
@@ -72,12 +73,11 @@
         mTextView.setText(R.string.switch_off_text);
 
         mSwitch = (ToggleSwitch) findViewById(R.id.switch_widget);
-        mSwitch.setOnCheckedChangeListener(this);
 
         addOnSwitchChangeListener(new OnSwitchChangeListener() {
             @Override
             public void onSwitchChanged(Switch switchView, boolean isChecked) {
-                mTextView.setText(isChecked ? R.string.switch_on_text : R.string.switch_off_text);
+                setTextViewLabel(isChecked);
             }
         });
 
@@ -90,18 +90,41 @@
         setVisibility(View.GONE);
     }
 
-    public ToggleSwitch getSwitch() {
+    public void setTextViewLabel(boolean isChecked) {
+        mTextView.setText(isChecked ? R.string.switch_on_text : R.string.switch_off_text);
+    }
+
+    public void setChecked(boolean checked) {
+        setTextViewLabel(checked);
+        mSwitch.setChecked(checked);
+    }
+
+    public boolean isChecked() {
+        return mSwitch.isChecked();
+    }
+
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+        mTextView.setEnabled(enabled);
+        mSwitch.setEnabled(false);
+    }
+
+    public final ToggleSwitch getSwitch() {
         return mSwitch;
     }
 
     public void show() {
-        TransitionManager.beginDelayedTransition((ViewGroup) getParent());
-        setVisibility(View.VISIBLE);
+        if (!isShowing()) {
+            setVisibility(View.VISIBLE);
+            mSwitch.setOnCheckedChangeListener(this);
+        }
     }
 
     public void hide() {
-        TransitionManager.beginDelayedTransition((ViewGroup) getParent());
-        setVisibility(View.GONE);
+        if (isShowing()) {
+            setVisibility(View.GONE);
+            mSwitch.setOnCheckedChangeListener(null);
+        }
     }
 
     public boolean isShowing() {
@@ -139,4 +162,69 @@
         }
         mSwitchChangeListeners.remove(listener);
     }
+
+    static class SavedState extends BaseSavedState {
+        boolean checked;
+        boolean visible;
+
+        SavedState(Parcelable superState) {
+            super(superState);
+        }
+
+        /**
+         * Constructor called from {@link #CREATOR}
+         */
+        private SavedState(Parcel in) {
+            super(in);
+            checked = (Boolean)in.readValue(null);
+            visible = (Boolean)in.readValue(null);
+        }
+
+        @Override
+        public void writeToParcel(Parcel out, int flags) {
+            super.writeToParcel(out, flags);
+            out.writeValue(checked);
+            out.writeValue(visible);
+        }
+
+        @Override
+        public String toString() {
+            return "SwitchBar.SavedState{"
+                    + Integer.toHexString(System.identityHashCode(this))
+                    + " checked=" + checked
+                    + " visible=" + visible + "}";
+        }
+
+        public static final Parcelable.Creator<SavedState> CREATOR
+                = new Parcelable.Creator<SavedState>() {
+            public SavedState createFromParcel(Parcel in) {
+                return new SavedState(in);
+            }
+
+            public SavedState[] newArray(int size) {
+                return new SavedState[size];
+            }
+        };
+    }
+
+    @Override
+    public Parcelable onSaveInstanceState() {
+        Parcelable superState = super.onSaveInstanceState();
+
+        SavedState ss = new SavedState(superState);
+        ss.checked = mSwitch.isChecked();
+        ss.visible = isShowing();
+        return ss;
+    }
+
+    @Override
+    public void onRestoreInstanceState(Parcelable state) {
+        SavedState ss = (SavedState) state;
+
+        super.onRestoreInstanceState(ss.getSuperState());
+        mSwitch.setChecked(ss.checked);
+        setTextViewLabel(ss.checked);
+        setVisibility(ss.visible ? View.VISIBLE : View.GONE);
+        requestLayout();
+    }
 }
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index 4ac9112..cd08565 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -19,6 +19,7 @@
 import com.android.settings.R;
 
 import android.content.Context;
+import android.graphics.drawable.Drawable;
 import android.net.NetworkInfo.DetailedState;
 import android.net.wifi.ScanResult;
 import android.net.wifi.WifiConfiguration;
@@ -48,6 +49,8 @@
     };
     private static final int[] STATE_NONE = {};
 
+    private static int[] wifi_signal_attributes = { R.attr.wifi_signal };
+
     /** These values are matched in string arrays -- changes must be kept in sync */
     static final int SECURITY_NONE = 0;
     static final int SECURITY_WEP = 1;
@@ -163,21 +166,18 @@
 
     AccessPoint(Context context, WifiConfiguration config) {
         super(context);
-        setWidgetLayoutResource(R.layout.preference_widget_wifi_signal);
         loadConfig(config);
         refresh();
     }
 
     AccessPoint(Context context, ScanResult result) {
         super(context);
-        setWidgetLayoutResource(R.layout.preference_widget_wifi_signal);
         loadResult(result);
         refresh();
     }
 
     AccessPoint(Context context, Bundle savedState) {
         super(context);
-        setWidgetLayoutResource(R.layout.preference_widget_wifi_signal);
 
         mConfig = savedState.getParcelable(KEY_CONFIG);
         if (mConfig != null) {
@@ -228,18 +228,28 @@
     @Override
     protected void onBindView(View view) {
         super.onBindView(view);
-        ImageView signal = (ImageView) view.findViewById(R.id.signal);
-        if (mRssi == Integer.MAX_VALUE) {
-            signal.setImageDrawable(null);
+        updateIcon(getLevel());
+        notifyChanged();
+    }
+
+    protected void updateIcon(int level) {
+        if (level == -1) {
+            setIcon(null);
         } else {
-            signal.setImageLevel(getLevel());
-            signal.setImageDrawable(getContext().getTheme().obtainStyledAttributes(
-                    new int[] {R.attr.wifi_signal}).getDrawable(0));
-            signal.setImageState((security != SECURITY_NONE) ?
-                    STATE_SECURED : STATE_NONE, true);
+            Drawable drawable = getIcon();
+
+            if (drawable == null) {
+                drawable = getContext().getTheme().obtainStyledAttributes(
+                        wifi_signal_attributes).getDrawable(0);
+                setIcon(drawable);
+            }
+
+            drawable.setLevel(level);
+            drawable.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
         }
     }
 
+
     @Override
     public int compareTo(Preference preference) {
         if (!(preference instanceof AccessPoint)) {
@@ -253,6 +263,7 @@
         // Reachable one goes before unreachable one.
         if (mRssi != Integer.MAX_VALUE && other.mRssi == Integer.MAX_VALUE) return -1;
         if (mRssi == Integer.MAX_VALUE && other.mRssi != Integer.MAX_VALUE) return 1;
+        if (mRssi == Integer.MAX_VALUE && other.mRssi != Integer.MAX_VALUE) return 1;
 
         // Configured one goes before unconfigured one.
         if (networkId != WifiConfiguration.INVALID_NETWORK_ID
@@ -368,7 +379,7 @@
     }
 
     /** visibility status of the WifiConfiguration
-     * @return RSSI and update indicator
+     * @return autojoin debugging information
      * TODO: use a string formatter
      * ["rssi 5Ghz", "num results on 5GHz" / "rssi 5Ghz", "num results on 5GHz"]
      * For instance [-40,5/-30,2]
@@ -380,12 +391,22 @@
         long age = (now - mSeen);
         if (age < VISIBILITY_MAX_AGE_IN_MILLI) {
             //show age in seconds, in the form xx
-            visibility.append(Long.toString((age / SECOND_TO_MILLI) % SECOND_TO_MILLI));
+            visibility.append(Long.toString((age / SECOND_TO_MILLI) % SECOND_TO_MILLI))
+                    .append("s");
         } else {
             //not seen for more than 1000 seconds
             visibility.append("!");
         }
 
+        if (mInfo != null) {
+            visibility.append(" sc=").append(Integer.toString(mInfo.score));
+            visibility.append(" ");
+            visibility.append(String.format("tx=%.1f,", mInfo.txSuccessRate));
+            visibility.append(String.format("%.1f,", mInfo.txRetriesRate));
+            visibility.append(String.format("%.1f ", mInfo.txBadRate));
+            visibility.append(String.format("rx=%.1f", mInfo.rxSuccessRate));
+        }
+
         if (scanResultCache != null) {
             int rssi5 = WifiConfiguration.INVALID_RSSI;
             int rssi24 = WifiConfiguration.INVALID_RSSI;
@@ -438,7 +459,7 @@
             visibility.append("]");
         } else {
             if (mRssi != Integer.MAX_VALUE) {
-                visibility.append(", ");
+                visibility.append(", ss=");
                 visibility.append(Integer.toString(mRssi));
                 if (mScanResult != null) {
                     visibility.append(", ");
@@ -446,18 +467,25 @@
                 }
             }
         }
+
         return visibility.toString();
     }
 
     /** Updates the title and summary; may indirectly call notifyChanged()  */
     private void refresh() {
         setTitle(ssid);
+        updateIcon(getLevel());
+
         StringBuilder summary = new StringBuilder();
 
         Context context = getContext();
-        if (mConfig != null && (mConfig.status == WifiConfiguration.Status.DISABLED
-                || mConfig.autoJoinStatus != WifiConfiguration.AUTO_JOIN_ENABLED)) {
-            if (mConfig.autoJoinStatus != WifiConfiguration.AUTO_JOIN_ENABLED) {
+
+        if (mState != null) { // This is the active connection
+            summary.append(Summary.get(context, mState));
+        } else if (mConfig != null && ((mConfig.status == WifiConfiguration.Status.DISABLED &&
+                mConfig.disableReason != WifiConfiguration.DISABLED_UNKNOWN_REASON)
+               || mConfig.autoJoinStatus >= WifiConfiguration.AUTO_JOIN_DISABLED_ON_AUTH_FAILURE)) {
+            if (mConfig.autoJoinStatus >= WifiConfiguration.AUTO_JOIN_DISABLED_ON_AUTH_FAILURE) {
                 summary.append(context.getString(R.string.wifi_disabled_password_failure));
             } else {
                 switch (mConfig.disableReason) {
@@ -469,13 +497,13 @@
                         summary.append(context.getString(R.string.wifi_disabled_network_failure));
                         break;
                     case WifiConfiguration.DISABLED_UNKNOWN_REASON:
+                        //this state is not useful anymore as auto-join may attempt joining
+                        //those networks
                         summary.append(context.getString(R.string.wifi_disabled_generic));
                 }
             }
         } else if (mRssi == Integer.MAX_VALUE) { // Wifi out of range
             summary.append(context.getString(R.string.wifi_not_in_range));
-        } else if (mState != null) { // This is the active connection
-            summary.append(Summary.get(context, mState));
         } else { // In range, not disabled.
             if (mConfig != null) { // Is saved network
                 summary.append(context.getString(R.string.wifi_remembered));
@@ -502,7 +530,25 @@
         if (WifiSettings.mVerboseLogging > 0) {
             //add RSSI/band information for this config, what was seen up to 6 seconds ago
             //verbose WiFi Logging is only turned on thru developers settings
+            if (mInfo != null && mState != null) { // This is the active connection
+                summary.append(" (f=" + Integer.toString(mInfo.getFrequency()) + ")");
+            }
             summary.append(" " + getVisibilityStatus());
+            if (mConfig != null && mConfig.autoJoinStatus > 0) {
+                summary.append(" (" + mConfig.autoJoinStatus);
+                if (mConfig.blackListTimestamp > 0) {
+                    long now = System.currentTimeMillis();
+                    long diff = (now - mConfig.blackListTimestamp)/1000;
+                    long sec = diff%60; //seconds
+                    long min = (diff/60)%60; //minutes
+                    long hour = (min/60)%60; //hours
+                    summary.append(", ");
+                    if (hour > 0) summary.append(Long.toString(hour) + "h ");
+                    summary.append( Long.toString(min) + "m ");
+                    summary.append( Long.toString(sec) + "s ");
+                }
+                summary.append(")");
+            }
         }
         setSummary(summary.toString());
     }
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 8779798..497132c 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -561,7 +561,7 @@
             } catch (IllegalArgumentException e) {
                 return R.string.wifi_ip_settings_invalid_dns;
             }
-            linkProperties.addDns(dnsAddr);
+            linkProperties.addDnsServer(dnsAddr);
         }
 
         if (mDns2View.length() > 0) {
@@ -571,7 +571,7 @@
             } catch (IllegalArgumentException e) {
                 return R.string.wifi_ip_settings_invalid_dns;
             }
-            linkProperties.addDns(dnsAddr);
+            linkProperties.addDnsServer(dnsAddr);
         }
         return 0;
     }
@@ -798,7 +798,7 @@
                     }
                 }
 
-                Iterator<InetAddress> dnsIterator = linkProperties.getDnses().iterator();
+                Iterator<InetAddress> dnsIterator = linkProperties.getDnsServers().iterator();
                 if (dnsIterator.hasNext()) {
                     mDns1View.setText(dnsIterator.next().getHostAddress());
                 }
diff --git a/src/com/android/settings/wifi/WifiEnabler.java b/src/com/android/settings/wifi/WifiEnabler.java
index d190045..dc3974e 100644
--- a/src/com/android/settings/wifi/WifiEnabler.java
+++ b/src/com/android/settings/wifi/WifiEnabler.java
@@ -100,20 +100,27 @@
         // The order matters! We really should not depend on this. :(
         mIntentFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
         mIntentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
+        setupSwitchBar();
+    }
+
+    public void setupSwitchBar() {
+        mSwitchBar.addOnSwitchChangeListener(this);
+        mSwitchBar.show();
+    }
+
+    public void teardownSwitchBar() {
+        mSwitchBar.removeOnSwitchChangeListener(this);
+        mSwitchBar.hide();
     }
 
     public void resume(Context context) {
         mContext = context;
         // Wi-Fi state is sticky, so just let the receiver update UI
         mContext.registerReceiver(mReceiver, mIntentFilter);
-        mSwitchBar.addOnSwitchChangeListener(this);
-        mSwitchBar.show();
     }
 
     public void pause() {
         mContext.unregisterReceiver(mReceiver);
-        mSwitchBar.removeOnSwitchChangeListener(this);
-        mSwitchBar.hide();
     }
 
     private void handleWifiStateChanged(int state) {
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 3420f36..ec77937 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -136,8 +136,6 @@
     private AccessPoint mDlgAccessPoint;
     private Bundle mAccessPointSavedState;
 
-    private SwitchBar mSwitchBar;
-
     /** verbose logging flag. this flag is set thru developer debugging options
      * and used so as to assist with in-the-field WiFi connectivity debugging  */
     public static int mVerboseLogging = 0;
@@ -233,6 +231,15 @@
     }
 
     @Override
+    public void onDestroyView() {
+        super.onDestroyView();
+
+        if (mWifiEnabler != null) {
+            mWifiEnabler.teardownSwitchBar();
+        }
+    }
+
+    @Override
     public void onStart() {
         super.onStart();