Merge "Define a specific preferenceFragmentStyle in Settings Theme"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 61b965e..0ec6098 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1698,21 +1698,6 @@
                 android:resource="@id/notification_settings" />
         </activity-alias>
 
-        <activity android:name="Settings$NotificationDisplaySettingsActivity"
-                android:label="@string/notification_display_settings"
-                android:exported="true"
-                android:taskAffinity="">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <action android:name="android.settings.ACTION_NOTIFICATION_DISPLAY_SETTINGS" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                android:value="com.android.settings.notification.NotificationDisplaySettings" />
-            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
-                android:resource="@id/notification_settings" />
-        </activity>
-
         <activity android:name="Settings$OtherSoundSettingsActivity"
                 android:label="@string/other_sound_settings"
                 android:exported="true"
diff --git a/res/layout/zen_downtime_day.xml b/res/layout/zen_downtime_day.xml
new file mode 100755
index 0000000..076ad4c
--- /dev/null
+++ b/res/layout/zen_downtime_day.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+
+<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeightSmall"
+    android:textAppearance="?android:attr/textAppearanceMedium"
+    android:gravity="center_vertical"
+    android:paddingStart="@dimen/zen_downtime_checkbox_padding"
+    android:layout_marginStart="@dimen/zen_downtime_margin"
+    android:layout_marginEnd="@dimen/zen_downtime_margin" />
diff --git a/res/layout/zen_mode_section.xml b/res/layout/zen_mode_section.xml
deleted file mode 100644
index c9daedc..0000000
--- a/res/layout/zen_mode_section.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-     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.
--->
-<LinearLayout 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"
-    android:orientation="vertical" >
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="2dip"
-        android:layout_marginBottom="4dip"
-        android:alpha="?android:attr/disabledAlpha"
-        android:background="#000" />
-
-    <TextView
-        android:id="@android:id/title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:textAllCaps="true"
-        android:textStyle="bold" />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/zen_mode_section_first.xml b/res/layout/zen_mode_section_first.xml
deleted file mode 100644
index e43a4d2..0000000
--- a/res/layout/zen_mode_section_first.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-     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.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
-    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
-
-    <TextView
-        android:id="@android:id/title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:textAllCaps="true"
-        android:textStyle="bold" />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/notification_app_section.xml b/res/values/aliases.xml
similarity index 65%
rename from res/layout/notification_app_section.xml
rename to res/values/aliases.xml
index 144ea11..97a50c5 100644
--- a/res/layout/notification_app_section.xml
+++ b/res/values/aliases.xml
@@ -1,5 +1,5 @@
-<!--
-     Copyright (C) 2014 The Android Open Source Project
+<?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.
@@ -13,8 +13,9 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    style="?android:attr/listSeparatorTextViewStyle"
-    android:id="@android:id/title"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content" />
+
+<resources>
+    <item name="notification_app_section" type="layout">@*android:layout/preference_category_material
+    </item>
+</resources>
+
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index cb2a9f0..992e57f 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -86,6 +86,8 @@
     <dimen name="notification_app_icon_badge_margin">4dp</dimen>
     <dimen name="notification_app_settings_divider_height">48dp</dimen>
     <dimen name="zen_mode_dropdown_width">160dp</dimen>
+    <dimen name="zen_downtime_checkbox_padding">7dp</dimen>
+    <dimen name="zen_downtime_margin">10dp</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>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1110553..611801c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5139,113 +5139,113 @@
     <string name="default_sound">Default sound</string>
 
 
-    <!-- Sounds and Notifications -->
+    <!-- Sounds and Notification -->
 
-    <!-- Sound & notifications: Settings header. [CHAR LIMIT=20] -->
-    <string name="notification_settings">Sound &amp; Notifications</string>
+    <!-- Sound & notification: Settings header. [CHAR LIMIT=20] -->
+    <string name="notification_settings">Sound &amp; Notification</string>
 
-    <!-- Sound & notifications: Title for the option managing media volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Sound section: Title for the option managing media volume. [CHAR LIMIT=30] -->
     <string name="media_volume_option_title">Media volume</string>
 
-    <!-- Sound & notifications: Title for the option managing alarm volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Sound section: Title for the option managing alarm volume. [CHAR LIMIT=30] -->
     <string name="alarm_volume_option_title">Alarm volume</string>
 
-    <!-- Sound & notifications: Title for the option managing ringer volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Sound section: Title for the option managing ringer volume. [CHAR LIMIT=30] -->
     <string name="ring_volume_option_title">Ring volume</string>
 
-    <!-- Sound & notifications: Title for the option managing notification volume. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Sound section: Title for the option managing notification volume. [CHAR LIMIT=30] -->
     <string name="notification_volume_option_title">Notification volume</string>
 
-    <!-- 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>
+    <!-- Sound & notification > Sound section: Title for the Interruptions option and associated settings page. [CHAR LIMIT=30] -->
+    <string name="zen_mode_settings_title">Interruptions</string>
 
-    <!-- Sound & notifications: Title for the ringer mode option. [CHAR LIMIT=60] -->
-    <string name="ringer_mode_title">When calls and notifications arrive</string>
+    <!-- Sound & notification > Sound section: Title for the zen mode option. [CHAR LIMIT=60] -->
+    <string name="zen_mode_option_title">When calls and notifications arrive</string>
 
-    <!-- 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>
+    <!-- Sound & notification > Sound section: Title for the zen mode option for devices without voice. [CHAR LIMIT=60] -->
+    <string name="zen_mode_option_title_novoice">When notifications arrive</string>
 
-    <!-- Sound & notifications: Value for the ringer mode option when audible. [CHAR LIMIT=30] -->
-    <string name="ringer_mode_audible">Ring</string>
+    <!-- Sound & notification > Sound section: Zen mode option: Off [CHAR LIMIT=60] -->
+    <string name="zen_mode_option_off">Always interrupt</string>
 
-    <!-- Sound & notifications: Value for the ringer mode option when vibrate. [CHAR LIMIT=30] -->
-    <string name="ringer_mode_vibrate">Vibrate instead of ringing</string>
+    <!-- Sound & notification > Sound section: Zen mode option: Important interruptions [CHAR LIMIT=60] -->
+    <string name="zen_mode_option_important_interruptions">Allow only priority interruptions</string>
 
-    <!-- Sound & notifications: Value for the ringer mode option when silent. [CHAR LIMIT=30] -->
-    <string name="ringer_mode_silent">Don\'t ring or vibrate</string>
+    <!-- Sound & notification > Sound section: Zen mode option: No interruptions [CHAR LIMIT=60] -->
+    <string name="zen_mode_option_no_interruptions">Don\'t interrupt</string>
 
-    <!-- Sound & notifications: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Sound section: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
     <string name="ringtone_title">Phone ringtone</string>
 
-    <!-- Sound & notifications: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Sound section: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
     <string name="notification_ringtone_title">Default notification ringtone</string>
 
-    <!-- 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>
+    <!-- Sound & notification > Sound section: Title for the option managing whether or not to vibrate when ringing. [CHAR LIMIT=30] -->
+    <string name="vibrate_when_ringing_title">Also vibrate for calls</string>
 
-    <!-- Sound & notifications: Title for the showing notifications option and associated settings page. [CHAR LIMIT=30] -->
-    <string name="notification_display_settings">Showing notifications</string>
+    <!-- Sound & notification: Notification section header [CHAR LIMIT=30] -->
+    <string name="notification_section_header">Notification</string>
 
-    <!-- Sound & notifications > Showing notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Notification section: Title for the pulse notification light option. [CHAR LIMIT=30] -->
     <string name="notification_pulse_title">Pulse notification light</string>
 
-    <!-- Sound & notifications > Showing notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Notification section: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
     <string name="lock_screen_notifications_title">When device is locked</string>
 
-    <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications:  all information will be
+    <!-- Sound & notification > Notification section: 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>
 
-    <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications: sensitive information will be
+    <!-- Sound & notification > Notification section: 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>
 
-    <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications: notifications will not appear on a secure lock screen
+    <!-- Sound & notification > Notification section: 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>
 
-    <!-- Sound & notifications > Showing notifications: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Notification section: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
     <string name="app_notifications_title">App notifications</string>
 
-    <!-- Sound & notifications: Title for the other sounds option and associated settings page. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Sound section: Title for the other sounds option and associated settings page. [CHAR LIMIT=30] -->
     <string name="other_sound_settings">Other sounds</string>
 
-    <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds for dial pad tones. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > 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>
 
-    <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds for screen locking sounds. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > 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>
 
-    <!-- Sound & notifications > Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
     <string name="docking_sounds_title">Docking sounds</string>
 
-    <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
     <string name="touch_sounds_title">Touch sounds</string>
 
-    <!-- Sound & notifications > Other sounds: Title for the option enabling haptic feedback on touch. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Title for the option enabling haptic feedback on touch. [CHAR LIMIT=30] -->
     <string name="vibrate_on_touch_title">Vibrate on touch</string>
 
-    <!-- Sound & notifications > Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=30] -->
     <string name="dock_audio_media_title">Dock speaker plays</string>
 
-    <!-- Sound & notifications > Other sounds: Value for the dock audio media with value 0: disabled. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Value for the dock audio media with value 0: disabled. [CHAR LIMIT=30] -->
     <string name="dock_audio_media_disabled">All audio</string>
 
-    <!-- Sound & notifications > Other sounds: Value for the dock audio media with value 1: enabled. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > 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>
 
-    <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 0: silent. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Value for the emergency tone option with value 0: silent. [CHAR LIMIT=30] -->
     <string name="emergency_tone_silent">Silent</string>
 
-    <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 1: alert. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Value for the emergency tone option with value 1: alert. [CHAR LIMIT=30] -->
     <string name="emergency_tone_alert">Alert</string>
 
-    <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 2: vibrate. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Other sounds: Value for the emergency tone option with value 2: vibrate. [CHAR LIMIT=30] -->
     <string name="emergency_tone_vibrate">Vibrate</string>
 
-    <!-- Sound & notifications: Title for managing notification listeners option. [CHAR LIMIT=30] -->
+    <!-- Sound & notification > Notification section: 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 -->
@@ -5327,14 +5327,20 @@
     <!-- [CHAR LIMIT=30] Zen mode settings: Exit condition selection dialog, default option -->
     <string name="zen_mode_default_option">Until you turn this off</string>
 
-    <!-- [CHAR LIMIT=40] Zen mode settings: General category text -->
-    <string name="zen_mode_general_category">Block all interruptions except</string>
+    <!-- [CHAR LIMIT=40] Zen mode settings: Important category text -->
+    <string name="zen_mode_important_category">Priority interruptions</string>
 
-    <!-- [CHAR LIMIT=40] Zen mode settings: Automatic category text -->
-    <string name="zen_mode_automatic_category">At night</string>
+    <!-- [CHAR LIMIT=40] Zen mode settings: Downtime category text -->
+    <string name="zen_mode_downtime_category">Downtime (priority interruptions only)</string>
+
+    <!-- [CHAR LIMIT=40] Zen mode settings: Downtime days option title -->
+    <string name="zen_mode_downtime_days">Days</string>
+
+    <!-- [CHAR LIMIT=40] Zen mode settings: Downtime days option value, no days set -->
+    <string name="zen_mode_downtime_days_none">None</string>
 
     <!-- [CHAR LIMIT=40] Zen mode settings: Automation category text -->
-    <string name="zen_mode_automation_category">Other automation</string>
+    <string name="zen_mode_automation_category">Automation</string>
 
     <!-- [CHAR LIMIT=40] Zen mode settings: Entry conditions option: title -->
     <string name="zen_mode_entry_conditions_title">Automatically turn on</string>
@@ -5364,7 +5370,7 @@
     <string name="zen_mode_from_starred">Starred contacts only</string>
 
     <!-- [CHAR LIMIT=60] Zen mode settings: Reminder text about alarms -->
-    <string name="zen_mode_alarm_info">Alarms and timers are never blocked</string>
+    <string name="zen_mode_alarm_info">Alarms and timers are always priority interruptions</string>
 
     <!-- [CHAR LIMIT=20] Zen mode settings: When option -->
     <string name="zen_mode_when">Automatically turn on</string>
diff --git a/res/xml/notification_display_settings.xml b/res/xml/notification_display_settings.xml
deleted file mode 100644
index 2dbe4b3..0000000
--- a/res/xml/notification_display_settings.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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/notification_display_settings"
-        android:key="notification_display_settings"
-        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
-
-    <!-- Pulse notification light -->
-    <SwitchPreference
-            android:key="notification_pulse"
-            android:title="@string/notification_pulse_title"
-            android:switchTextOff=""
-            android:switchTextOn=""
-            android:persistent="false" />
-
-     <!-- When device is locked -->
-    <com.android.settings.notification.DropDownPreference
-            android:key="lock_screen_notifications"
-            android:title="@string/lock_screen_notifications_title"
-            android:persistent="false" />
-
-    <!-- App notifications -->
-    <PreferenceScreen
-            android:key="app_notifications"
-            android:title="@string/app_notifications_title"
-            android:fragment="com.android.settings.notification.AppNotificationSettings" />
-
-</PreferenceScreen>
diff --git a/res/xml/notification_settings.xml b/res/xml/notification_settings.xml
index 176c822..af9ab6c 100644
--- a/res/xml/notification_settings.xml
+++ b/res/xml/notification_settings.xml
@@ -19,85 +19,102 @@
         android:key="notification_settings"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
 
-    <!-- Media volume -->
-    <com.android.settings.notification.VolumeSeekBarPreference
-            android:key="media_volume"
-            android:icon="@*android:drawable/ic_audio_vol"
-            android:title="@string/media_volume_option_title" />
+    <PreferenceCategory
+        android:key="sound"
+        android:title="@string/sound_settings" >
 
-    <!-- Alarm volume -->
-    <com.android.settings.notification.VolumeSeekBarPreference
-            android:key="alarm_volume"
-            android:icon="@*android:drawable/ic_audio_alarm"
-            android:title="@string/alarm_volume_option_title" />
+        <!-- Media volume -->
+        <com.android.settings.notification.VolumeSeekBarPreference
+                android:key="media_volume"
+                android:icon="@*android:drawable/ic_audio_vol"
+                android:title="@string/media_volume_option_title" />
 
-    <!-- Ring volume -->
-    <com.android.settings.notification.VolumeSeekBarPreference
-            android:key="ring_volume"
-            android:icon="@*android:drawable/ic_audio_ring_notif"
-            android:title="@string/ring_volume_option_title" />
+        <!-- Alarm volume -->
+        <com.android.settings.notification.VolumeSeekBarPreference
+                android:key="alarm_volume"
+                android:icon="@*android:drawable/ic_audio_alarm"
+                android:title="@string/alarm_volume_option_title" />
 
-    <!-- Notification volume -->
-    <com.android.settings.notification.VolumeSeekBarPreference
-            android:key="notification_volume"
-            android:icon="@*android:drawable/ic_audio_ring_notif"
-            android:title="@string/notification_volume_option_title" />
+        <!-- Ring volume -->
+        <com.android.settings.notification.VolumeSeekBarPreference
+                android:key="ring_volume"
+                android:icon="@*android:drawable/ic_audio_ring_notif"
+                android:title="@string/ring_volume_option_title" />
 
-    <!-- Do not disturb -->
-    <PreferenceScreen
-            android:key="zen_mode"
-            android:title="@string/zen_mode_settings_title"
-            android:fragment="com.android.settings.notification.ZenModeSettings" />
+        <!-- Notification volume -->
+        <com.android.settings.notification.VolumeSeekBarPreference
+                android:key="notification_volume"
+                android:icon="@*android:drawable/ic_audio_ring_notif"
+                android:title="@string/notification_volume_option_title" />
 
-    <!-- When calls and notifications arrive -->
-    <com.android.settings.notification.DropDownPreference
-            android:key="ringer_mode"
-            android:title="@string/ringer_mode_title"
-            android:persistent="false" />
+        <!-- Also vibrate for calls -->
+        <SwitchPreference
+                android:key="vibrate_when_ringing"
+                android:title="@string/vibrate_when_ringing_title"
+                android:persistent="false" />
 
-    <!-- Phone ringtone -->
-    <com.android.settings.DefaultRingtonePreference
-            android:key="ringtone"
-            android:title="@string/ringtone_title"
-            android:dialogTitle="@string/ringtone_title"
-            android:persistent="false"
-            android:ringtoneType="ringtone" />
+        <!-- Interruptions -->
+        <PreferenceScreen
+                android:key="zen_mode"
+                android:title="@string/zen_mode_settings_title"
+                android:fragment="com.android.settings.notification.ZenModeSettings" />
 
-    <!-- Default notification ringtone -->
-    <com.android.settings.DefaultRingtonePreference
-            android:key="notification_ringtone"
-            android:title="@string/notification_ringtone_title"
-            android:dialogTitle="@string/notification_ringtone_title"
-            android:persistent="false"
-            android:ringtoneType="notification" />
+        <!-- Phone ringtone -->
+        <com.android.settings.DefaultRingtonePreference
+                android:key="ringtone"
+                android:title="@string/ringtone_title"
+                android:dialogTitle="@string/ringtone_title"
+                android:persistent="false"
+                android:ringtoneType="ringtone" />
 
-    <!-- Vibrate when ringing -->
-    <SwitchPreference
-            android:key="vibrate_when_ringing"
-            android:title="@string/vibrate_when_ringing_title"
-            android:switchTextOff=""
-            android:switchTextOn=""
-            android:persistent="false" />
+        <!-- Default notification ringtone -->
+        <com.android.settings.DefaultRingtonePreference
+                android:key="notification_ringtone"
+                android:title="@string/notification_ringtone_title"
+                android:dialogTitle="@string/notification_ringtone_title"
+                android:persistent="false"
+                android:ringtoneType="notification" />
 
-    <!-- Showing notifications -->
-    <Preference
-            android:key="showing_notifications"
-            android:title="@string/notification_display_settings"
-            android:persistent="false"
-            android:fragment="com.android.settings.notification.NotificationDisplaySettings" />
+        <!-- Other sounds -->
+        <Preference
+                android:key="other_sounds"
+                android:title="@string/other_sound_settings"
+                android:persistent="false"
+                android:fragment="com.android.settings.notification.OtherSoundSettings" />
 
-    <!-- Touch sounds -->
-    <Preference
-            android:key="other_sounds"
-            android:title="@string/other_sound_settings"
-            android:persistent="false"
-            android:fragment="com.android.settings.notification.OtherSoundSettings" />
+    </PreferenceCategory>
 
-    <!-- Notification access -->
-    <Preference
-            android:key="manage_notification_access"
-            android:title="@string/manage_notification_access_title"
-            android:persistent="false"
-            android:fragment="com.android.settings.notification.NotificationAccessSettings" />
+    <PreferenceCategory
+        android:key="notification"
+        android:title="@string/notification_section_header" >
+
+        <!-- Pulse notification light -->
+        <SwitchPreference
+                android:key="notification_pulse"
+                android:title="@string/notification_pulse_title"
+                android:switchTextOff=""
+                android:switchTextOn=""
+                android:persistent="false" />
+
+         <!-- When device is locked -->
+        <com.android.settings.notification.DropDownPreference
+                android:key="lock_screen_notifications"
+                android:title="@string/lock_screen_notifications_title"
+                android:persistent="false" />
+
+        <!-- App notifications -->
+        <PreferenceScreen
+                android:key="app_notifications"
+                android:title="@string/app_notifications_title"
+                android:fragment="com.android.settings.notification.AppNotificationSettings" />
+
+        <!-- Notification access -->
+        <Preference
+                android:key="manage_notification_access"
+                android:title="@string/manage_notification_access_title"
+                android:persistent="false"
+                android:fragment="com.android.settings.notification.NotificationAccessSettings" />
+
+    </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/res/xml/zen_mode_settings.xml b/res/xml/zen_mode_settings.xml
index 35732d6..6f2fc2e 100644
--- a/res/xml/zen_mode_settings.xml
+++ b/res/xml/zen_mode_settings.xml
@@ -19,42 +19,58 @@
     android:key="zen_mode_settings"
     android:title="@string/zen_mode_settings_title" >
 
+    <!-- When calls and notifications arrive -->
+    <com.android.settings.notification.DropDownPreference
+            android:key="zen_mode"
+            android:title="@string/zen_mode_option_title"
+            android:persistent="false" />
+
     <PreferenceCategory
-        android:key="general"
-        android:layout="@layout/zen_mode_section_first"
-        android:title="@string/zen_mode_general_category" >
+        android:key="important"
+        android:title="@string/zen_mode_important_category" >
+
         <SwitchPreference
             android:key="phone_calls"
             android:persistent="false"
             android:switchTextOff=""
             android:switchTextOn=""
             android:title="@string/zen_mode_phone_calls" />
+
         <SwitchPreference
             android:key="messages"
             android:persistent="false"
             android:switchTextOff=""
             android:switchTextOn=""
             android:title="@string/zen_mode_messages" />
+
     </PreferenceCategory>
 
     <PreferenceCategory
-        android:key="automatic"
-        android:layout="@layout/zen_mode_section"
-        android:title="@string/zen_mode_automatic_category" />
+        android:key="downtime"
+        android:title="@string/zen_mode_downtime_category" >
+
+        <Preference
+            android:key="days"
+            android:title="@string/zen_mode_downtime_days"
+            android:persistent="false" />
+
+    </PreferenceCategory>
 
     <PreferenceCategory
         android:key="automation"
-        android:layout="@layout/zen_mode_section"
         android:title="@string/zen_mode_automation_category" >
+
         <Preference
             android:key="entry"
             android:title="@string/zen_mode_entry_conditions_title"
             android:persistent="false" />
+
         <Preference
                 android:key="manage_condition_providers"
                 android:title="@string/manage_condition_providers"
                 android:persistent="false"
                 android:fragment="com.android.settings.notification.ConditionProviderSettings" />
+
     </PreferenceCategory>
 
 </PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 7ef33ae..33bdedf 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -88,7 +88,6 @@
     public static class PrintJobSettingsActivity extends SettingsActivity { /* empty */ }
     public static class ZenModeSettingsActivity extends SettingsActivity { /* empty */ }
     public static class NotificationSettingsActivity extends SettingsActivity { /* empty */ }
-    public static class NotificationDisplaySettingsActivity extends SettingsActivity { /* empty */ }
     public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
     public static class OtherSoundSettingsActivity extends SettingsActivity { /* empty */ }
 
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index ef1f5c5..2c3d827 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -328,7 +328,7 @@
                 }
             }
 
-            String rawNumber = mPhone.getLine1Number();  // may be null or empty
+            String rawNumber = mTelephonyManager.getLine1Number();  // may be null or empty
             String formattedNumber = null;
             if (!TextUtils.isEmpty(rawNumber)) {
                 formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index ec8af26..34d465e 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -353,7 +353,7 @@
         public void bindView(final View view, Row r, boolean animate) {
             if (!(r instanceof AppRow)) {
                 // it's a section row
-                TextView tv = (TextView)view;
+                final TextView tv = (TextView)view.findViewById(android.R.id.title);
                 tv.setText(r.section);
                 return;
             }
diff --git a/src/com/android/settings/notification/NotificationDisplaySettings.java b/src/com/android/settings/notification/NotificationDisplaySettings.java
deleted file mode 100644
index 54406f0..0000000
--- a/src/com/android/settings/notification/NotificationDisplaySettings.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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.notification;
-
-import android.content.ContentResolver;
-import android.database.ContentObserver;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
-import android.preference.TwoStatePreference;
-import android.provider.Settings;
-import android.util.Log;
-
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-
-public class NotificationDisplaySettings extends SettingsPreferenceFragment {
-    private static final String TAG = "NotificationDisplaySettings";
-
-    private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
-    private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "lock_screen_notifications";
-
-    private final Handler mHandler = new Handler();
-    private final SettingsObserver mSettingsObserver = new SettingsObserver();
-
-    private TwoStatePreference mNotificationPulse;
-    private DropDownPreference mLockscreen;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        addPreferencesFromResource(R.xml.notification_display_settings);
-
-        final PreferenceScreen root = getPreferenceScreen();
-        initPulse(root);
-        initLockscreenNotifications(root);
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        mSettingsObserver.register(true);
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        mSettingsObserver.register(false);
-    }
-
-    // === Pulse notification light ===
-
-    private void initPulse(PreferenceScreen parent) {
-        mNotificationPulse = (TwoStatePreference) parent.findPreference(KEY_NOTIFICATION_PULSE);
-        if (mNotificationPulse == null) return;
-        if (!getResources()
-                .getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed)) {
-            parent.removePreference(mNotificationPulse);
-        } else {
-            updatePulse();
-            mNotificationPulse.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
-                @Override
-                public boolean onPreferenceChange(Preference preference, Object newValue) {
-                    final boolean val = (Boolean)newValue;
-                    return Settings.System.putInt(getContentResolver(),
-                            Settings.System.NOTIFICATION_LIGHT_PULSE,
-                            val ? 1 : 0);
-                }
-            });
-        }
-    }
-
-    private void updatePulse() {
-        if (mNotificationPulse == null) return;
-        try {
-            mNotificationPulse.setChecked(Settings.System.getInt(getContentResolver(),
-                    Settings.System.NOTIFICATION_LIGHT_PULSE) == 1);
-        } catch (Settings.SettingNotFoundException snfe) {
-            Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found");
-        }
-    }
-
-    // === Lockscreen (public / private) notifications ===
-
-    private void initLockscreenNotifications(PreferenceScreen parent) {
-        mLockscreen = (DropDownPreference) parent.findPreference(KEY_LOCK_SCREEN_NOTIFICATIONS);
-        if (mLockscreen == null) return;
-        mLockscreen.addItem(R.string.lock_screen_notifications_summary_show,
-                R.string.lock_screen_notifications_summary_show);
-        mLockscreen.addItem(R.string.lock_screen_notifications_summary_hide,
-                R.string.lock_screen_notifications_summary_hide);
-        mLockscreen.addItem(R.string.lock_screen_notifications_summary_disable,
-                R.string.lock_screen_notifications_summary_disable);
-        updateLockscreenNotifications();
-        mLockscreen.setCallback(new DropDownPreference.Callback() {
-            @Override
-            public boolean onItemSelected(int pos, Object value) {
-                final int val = (Integer) value;
-                final boolean enabled = val != R.string.lock_screen_notifications_summary_disable;
-                final boolean show = val == R.string.lock_screen_notifications_summary_show;
-                Settings.Secure.putInt(getContentResolver(),
-                        Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0);
-                Settings.Global.putInt(getContentResolver(),
-                        Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0);
-                return true;
-            }
-        });
-    }
-
-    private void updateLockscreenNotifications() {
-        if (mLockscreen == null) return;
-        final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
-        final boolean enabled = getLockscreenNotificationsEnabled();
-        final int val = !enabled ? R.string.lock_screen_notifications_summary_disable :
-                allowPrivate ? R.string.lock_screen_notifications_summary_show :
-                R.string.lock_screen_notifications_summary_hide;
-        mLockscreen.setSelectedValue(val);
-    }
-
-    private boolean getLockscreenNotificationsEnabled() {
-        return Settings.Global.getInt(getContentResolver(),
-                Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) != 0;
-    }
-
-    private boolean getLockscreenAllowPrivateNotifications() {
-        return Settings.Secure.getInt(getContentResolver(),
-                Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0) != 0;
-    }
-
-    // === Callbacks ===
-
-    private final class SettingsObserver extends ContentObserver {
-        private final Uri NOTIFICATION_LIGHT_PULSE_URI =
-                Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE);
-        private final Uri LOCK_SCREEN_PRIVATE_URI =
-                Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
-        private final Uri LOCK_SCREEN_SHOW_URI =
-                Settings.Global.getUriFor(Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS);
-
-        public SettingsObserver() {
-            super(mHandler);
-        }
-
-        public void register(boolean register) {
-            final ContentResolver cr = getContentResolver();
-            if (register) {
-                cr.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this);
-                cr.registerContentObserver(LOCK_SCREEN_PRIVATE_URI, false, this);
-                cr.registerContentObserver(LOCK_SCREEN_SHOW_URI, false, this);
-            } else {
-                cr.unregisterContentObserver(this);
-            }
-        }
-
-        @Override
-        public void onChange(boolean selfChange, Uri uri) {
-            super.onChange(selfChange, uri);
-            if (NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) {
-                updatePulse();
-            }
-            if (LOCK_SCREEN_PRIVATE_URI.equals(uri) || LOCK_SCREEN_SHOW_URI.equals(uri)) {
-                updateLockscreenNotifications();
-            }
-        }
-    }
-}
diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java
index 8caa420..4b5718b 100644
--- a/src/com/android/settings/notification/NotificationSettings.java
+++ b/src/com/android/settings/notification/NotificationSettings.java
@@ -16,11 +16,8 @@
 
 package com.android.settings.notification;
 
-import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
 import android.content.pm.PackageManager;
 import android.database.ContentObserver;
 import android.database.Cursor;
@@ -35,12 +32,13 @@
 import android.os.Message;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
+import android.preference.PreferenceCategory;
 import android.preference.SeekBarVolumizer;
 import android.preference.TwoStatePreference;
 import android.provider.MediaStore;
 import android.provider.SearchIndexableResource;
 import android.provider.Settings;
+import android.util.Log;
 
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
@@ -55,14 +53,17 @@
 public class NotificationSettings extends SettingsPreferenceFragment implements Indexable {
     private static final String TAG = "NotificationSettings";
 
+    private static final String KEY_SOUND = "sound";
     private static final String KEY_MEDIA_VOLUME = "media_volume";
     private static final String KEY_ALARM_VOLUME = "alarm_volume";
     private static final String KEY_RING_VOLUME = "ring_volume";
     private static final String KEY_NOTIFICATION_VOLUME = "notification_volume";
-    private static final String KEY_RINGER_MODE = "ringer_mode";
     private static final String KEY_PHONE_RINGTONE = "ringtone";
     private static final String KEY_NOTIFICATION_RINGTONE = "notification_ringtone";
     private static final String KEY_VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
+    private static final String KEY_NOTIFICATION = "notification";
+    private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
+    private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "lock_screen_notifications";
     private static final String KEY_NOTIFICATION_ACCESS = "manage_notification_access";
 
     private static final int SAMPLE_CUTOFF = 2000;  // manually cap sample playback at 2 seconds
@@ -75,10 +76,11 @@
     private PackageManager mPM;
     private boolean mVoiceCapable;
 
-    private DropDownPreference mRingerMode;
     private Preference mPhoneRingtonePreference;
     private Preference mNotificationRingtonePreference;
     private TwoStatePreference mVibrateWhenRinging;
+    private TwoStatePreference mNotificationPulse;
+    private DropDownPreference mLockscreen;
     private Preference mNotificationAccess;
 
     @Override
@@ -89,19 +91,23 @@
         mVoiceCapable = Utils.isVoiceCapable(mContext);
         addPreferencesFromResource(R.xml.notification_settings);
 
-        final PreferenceScreen root = getPreferenceScreen();
+        final PreferenceCategory sound = (PreferenceCategory) findPreference(KEY_SOUND);
         initVolumePreference(KEY_MEDIA_VOLUME, AudioManager.STREAM_MUSIC);
         initVolumePreference(KEY_ALARM_VOLUME, AudioManager.STREAM_ALARM);
         if (mVoiceCapable) {
             initVolumePreference(KEY_RING_VOLUME, AudioManager.STREAM_RING);
-            removePreference(KEY_NOTIFICATION_VOLUME);
+            sound.removePreference(sound.findPreference(KEY_NOTIFICATION_VOLUME));
         } else {
             initVolumePreference(KEY_NOTIFICATION_VOLUME, AudioManager.STREAM_NOTIFICATION);
-            removePreference(KEY_RING_VOLUME);
+            sound.removePreference(sound.findPreference(KEY_RING_VOLUME));
         }
-        initRingerMode(root);
-        initRingtones(root);
-        initVibrateWhenRinging(root);
+        initRingtones(sound);
+        initVibrateWhenRinging(sound);
+
+        final PreferenceCategory notification = (PreferenceCategory)
+                findPreference(KEY_NOTIFICATION);
+        initPulse(notification);
+        initLockscreenNotifications(notification);
 
         mNotificationAccess = findPreference(KEY_NOTIFICATION_ACCESS);
         refreshNotificationListeners();
@@ -112,8 +118,6 @@
         super.onResume();
         refreshNotificationListeners();
         lookupRingtoneNames();
-        final IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
-        mContext.registerReceiver(mReceiver, filter);
         mSettingsObserver.register(true);
     }
 
@@ -121,7 +125,6 @@
     public void onPause() {
         super.onPause();
         mVolumeCallback.stopSample();
-        mContext.unregisterReceiver(mReceiver);
         mSettingsObserver.register(false);
     }
 
@@ -155,37 +158,10 @@
         }
     };
 
-    // === Ringer mode ===
-
-    private void initRingerMode(PreferenceScreen root) {
-        mRingerMode = (DropDownPreference) root.findPreference(KEY_RINGER_MODE);
-        if (mRingerMode == null) return;
-        if (!mVoiceCapable) {
-            mRingerMode.setTitle(R.string.ringer_mode_title_novoice);
-        }
-        final AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-        mRingerMode.addItem(R.string.ringer_mode_audible, AudioManager.RINGER_MODE_NORMAL);
-        mRingerMode.addItem(R.string.ringer_mode_vibrate, AudioManager.RINGER_MODE_VIBRATE);
-        mRingerMode.addItem(R.string.ringer_mode_silent, AudioManager.RINGER_MODE_SILENT);
-        updateRingerMode();
-        mRingerMode.setCallback(new DropDownPreference.Callback() {
-            @Override
-            public boolean onItemSelected(int pos, Object value) {
-                final int val = (Integer) value;
-                am.setRingerMode(val);
-                return true;
-            }
-        });
-    }
-
-    private void updateRingerMode() {
-        final AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-        mRingerMode.setSelectedValue(am.getRingerMode());
-    }
 
     // === Phone & notification ringtone ===
 
-    private void initRingtones(PreferenceScreen root) {
+    private void initRingtones(PreferenceCategory root) {
         mPhoneRingtonePreference = root.findPreference(KEY_PHONE_RINGTONE);
         if (mPhoneRingtonePreference != null && !mVoiceCapable) {
             root.removePreference(mPhoneRingtonePreference);
@@ -219,7 +195,10 @@
     };
 
     private static CharSequence updateRingtoneName(Context context, int type) {
-        if (context == null) return null;
+        if (context == null) {
+            Log.e(TAG, "Unable to update ringtone name, no context provided");
+            return null;
+        }
         Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
         CharSequence summary = context.getString(com.android.internal.R.string.ringtone_unknown);
         // Is it a silent ringtone?
@@ -249,9 +228,12 @@
 
     // === Vibrate when ringing ===
 
-    private void initVibrateWhenRinging(PreferenceScreen root) {
+    private void initVibrateWhenRinging(PreferenceCategory root) {
         mVibrateWhenRinging = (TwoStatePreference) root.findPreference(KEY_VIBRATE_WHEN_RINGING);
-        if (mVibrateWhenRinging == null) return;
+        if (mVibrateWhenRinging == null) {
+            Log.i(TAG, "Preference not found: " + KEY_VIBRATE_WHEN_RINGING);
+            return;
+        }
         if (!mVoiceCapable) {
             root.removePreference(mVibrateWhenRinging);
             mVibrateWhenRinging = null;
@@ -276,6 +258,95 @@
                 Settings.System.VIBRATE_WHEN_RINGING, 0) != 0);
     }
 
+    // === Pulse notification light ===
+
+    private void initPulse(PreferenceCategory parent) {
+        mNotificationPulse = (TwoStatePreference) parent.findPreference(KEY_NOTIFICATION_PULSE);
+        if (mNotificationPulse == null) {
+            Log.i(TAG, "Preference not found: " + KEY_NOTIFICATION_PULSE);
+            return;
+        }
+        if (!getResources()
+                .getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed)) {
+            parent.removePreference(mNotificationPulse);
+        } else {
+            updatePulse();
+            mNotificationPulse.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+                @Override
+                public boolean onPreferenceChange(Preference preference, Object newValue) {
+                    final boolean val = (Boolean)newValue;
+                    return Settings.System.putInt(getContentResolver(),
+                            Settings.System.NOTIFICATION_LIGHT_PULSE,
+                            val ? 1 : 0);
+                }
+            });
+        }
+    }
+
+    private void updatePulse() {
+        if (mNotificationPulse == null) {
+            return;
+        }
+        try {
+            mNotificationPulse.setChecked(Settings.System.getInt(getContentResolver(),
+                    Settings.System.NOTIFICATION_LIGHT_PULSE) == 1);
+        } catch (Settings.SettingNotFoundException snfe) {
+            Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found");
+        }
+    }
+
+    // === Lockscreen (public / private) notifications ===
+
+    private void initLockscreenNotifications(PreferenceCategory parent) {
+        mLockscreen = (DropDownPreference) parent.findPreference(KEY_LOCK_SCREEN_NOTIFICATIONS);
+        if (mLockscreen == null) {
+            Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_NOTIFICATIONS);
+            return;
+        }
+        mLockscreen.addItem(R.string.lock_screen_notifications_summary_show,
+                R.string.lock_screen_notifications_summary_show);
+        mLockscreen.addItem(R.string.lock_screen_notifications_summary_hide,
+                R.string.lock_screen_notifications_summary_hide);
+        mLockscreen.addItem(R.string.lock_screen_notifications_summary_disable,
+                R.string.lock_screen_notifications_summary_disable);
+        updateLockscreenNotifications();
+        mLockscreen.setCallback(new DropDownPreference.Callback() {
+            @Override
+            public boolean onItemSelected(int pos, Object value) {
+                final int val = (Integer) value;
+                final boolean enabled = val != R.string.lock_screen_notifications_summary_disable;
+                final boolean show = val == R.string.lock_screen_notifications_summary_show;
+                Settings.Secure.putInt(getContentResolver(),
+                        Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0);
+                Settings.Global.putInt(getContentResolver(),
+                        Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0);
+                return true;
+            }
+        });
+    }
+
+    private void updateLockscreenNotifications() {
+        if (mLockscreen == null) {
+            return;
+        }
+        final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
+        final boolean enabled = getLockscreenNotificationsEnabled();
+        final int selectedVal = !enabled ? R.string.lock_screen_notifications_summary_disable :
+                allowPrivate ? R.string.lock_screen_notifications_summary_show :
+                R.string.lock_screen_notifications_summary_hide;
+        mLockscreen.setSelectedValue(selectedVal);
+    }
+
+    private boolean getLockscreenNotificationsEnabled() {
+        return Settings.Global.getInt(getContentResolver(),
+                Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) != 0;
+    }
+
+    private boolean getLockscreenAllowPrivateNotifications() {
+        return Settings.Secure.getInt(getContentResolver(),
+                Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0) != 0;
+    }
+
     // === Notification listeners ===
 
     private void refreshNotificationListeners() {
@@ -299,18 +370,15 @@
 
     // === Callbacks ===
 
-    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(intent.getAction())) {
-                updateRingerMode();
-            }
-        }
-    };
-
     private final class SettingsObserver extends ContentObserver {
         private final Uri VIBRATE_WHEN_RINGING_URI =
                 Settings.System.getUriFor(Settings.System.VIBRATE_WHEN_RINGING);
+        private final Uri NOTIFICATION_LIGHT_PULSE_URI =
+                Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE);
+        private final Uri LOCK_SCREEN_PRIVATE_URI =
+                Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
+        private final Uri LOCK_SCREEN_SHOW_URI =
+                Settings.Global.getUriFor(Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS);
 
         public SettingsObserver() {
             super(mHandler);
@@ -320,6 +388,9 @@
             final ContentResolver cr = getContentResolver();
             if (register) {
                 cr.registerContentObserver(VIBRATE_WHEN_RINGING_URI, false, this);
+                cr.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this);
+                cr.registerContentObserver(LOCK_SCREEN_PRIVATE_URI, false, this);
+                cr.registerContentObserver(LOCK_SCREEN_SHOW_URI, false, this);
             } else {
                 cr.unregisterContentObserver(this);
             }
@@ -331,6 +402,12 @@
             if (VIBRATE_WHEN_RINGING_URI.equals(uri)) {
                 updateVibrateWhenRinging();
             }
+            if (NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) {
+                updatePulse();
+            }
+            if (LOCK_SCREEN_PRIVATE_URI.equals(uri) || LOCK_SCREEN_SHOW_URI.equals(uri)) {
+                updateLockscreenNotifications();
+            }
         }
     }
 
diff --git a/src/com/android/settings/notification/SettingPref.java b/src/com/android/settings/notification/SettingPref.java
index 7fd89d8..de01def 100644
--- a/src/com/android/settings/notification/SettingPref.java
+++ b/src/com/android/settings/notification/SettingPref.java
@@ -60,7 +60,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public void init(SettingsPreferenceFragment settings) {
+    public Preference init(SettingsPreferenceFragment settings) {
         final Context context = settings.getActivity();
         Preference p = settings.getPreferenceScreen().findPreference(mKey);
         if (p != null && !isApplicable(context)) {
@@ -84,14 +84,18 @@
                     return true;
                 }
             });
-        } else if (mDropDown != null) {
+            return mTwoState;
+        }
+        if (mDropDown != null) {
             mDropDown.setCallback(new DropDownPreference.Callback() {
                 @Override
                 public boolean onItemSelected(int pos, Object value) {
                     return setSetting(context, (Integer) value);
                 }
             });
+            return mDropDown;
         }
+        return null;
     }
 
     protected boolean setSetting(Context context, int value) {
diff --git a/src/com/android/settings/notification/ZenModeDowntimeDaysSelection.java b/src/com/android/settings/notification/ZenModeDowntimeDaysSelection.java
new file mode 100644
index 0000000..74dae9e0
--- /dev/null
+++ b/src/com/android/settings/notification/ZenModeDowntimeDaysSelection.java
@@ -0,0 +1,90 @@
+/*
+ * 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.notification;
+
+import android.content.Context;
+import android.service.notification.ZenModeConfig;
+import android.util.SparseBooleanArray;
+import android.view.LayoutInflater;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.LinearLayout;
+
+import com.android.settings.R;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+public class ZenModeDowntimeDaysSelection extends LinearLayout {
+    private static final int[] DAYS = {
+        Calendar.MONDAY, Calendar.TUESDAY, Calendar.WEDNESDAY, Calendar.THURSDAY, Calendar.FRIDAY,
+        Calendar.SATURDAY, Calendar.SUNDAY
+    };
+    private static final SimpleDateFormat DAY_FORMAT = new SimpleDateFormat("EEEE");
+
+    private final SparseBooleanArray mDays = new SparseBooleanArray();
+
+    public ZenModeDowntimeDaysSelection(Context context, String mode) {
+        super(context);
+        final int[] days = ZenModeConfig.tryParseDays(mode);
+        if (days != null) {
+            for (int i = 0; i < days.length; i++) {
+                mDays.put(days[i], true);
+            }
+        }
+        setOrientation(VERTICAL);
+        final Calendar c = Calendar.getInstance();
+        final LayoutInflater inflater = LayoutInflater.from(context);
+        for (int i = 0; i < DAYS.length; i++) {
+            final int day = DAYS[i];
+            final CheckBox checkBox = (CheckBox) inflater.inflate(R.layout.zen_downtime_day,
+                    this, false);
+            c.set(Calendar.DAY_OF_WEEK, day);
+            checkBox.setText(DAY_FORMAT.format(c.getTime()));
+            checkBox.setChecked(mDays.get(day));
+            checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+                @Override
+                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                    mDays.put(day, isChecked);
+                    onChanged(getMode());
+                }
+            });
+            addView(checkBox);
+        }
+    }
+
+    private String getMode() {
+        final StringBuilder sb = new StringBuilder(ZenModeConfig.SLEEP_MODE_DAYS_PREFIX);
+        boolean empty = true;
+        for (int i = 0; i < mDays.size(); i++) {
+            final int day = mDays.keyAt(i);
+            if (!mDays.valueAt(i)) continue;
+            if (empty) {
+                empty = false;
+            } else {
+                sb.append(',');
+            }
+            sb.append(day);
+        }
+        return empty ? null : sb.toString();
+    }
+
+    protected void onChanged(String mode) {
+        // event hook for subclasses
+    }
+}
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index 40e2c55..02bb85e 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -30,7 +30,6 @@
 import android.database.ContentObserver;
 import android.graphics.Typeface;
 import android.net.Uri;
-import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.ServiceManager;
@@ -48,37 +47,34 @@
 import android.util.SparseArray;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.Switch;
 import android.widget.TextView;
 import android.widget.TimePicker;
 
 import com.android.settings.R;
-import com.android.settings.SettingsActivity;
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.Utils;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
 import com.android.settings.search.SearchIndexableRaw;
-import com.android.settings.widget.SwitchBar;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
 import java.util.Objects;
 
-public class ZenModeSettings extends SettingsPreferenceFragment implements Indexable,
-        SwitchBar.OnSwitchChangeListener {
+public class ZenModeSettings extends SettingsPreferenceFragment implements Indexable {
     private static final String TAG = "ZenModeSettings";
     private static final boolean DEBUG = true;
-    private static final boolean SHOW_CONDITION_DIALOG = false;
 
-    private static final String KEY_GENERAL = "general";
+    private static final String KEY_ZEN_MODE = "zen_mode";
+    private static final String KEY_IMPORTANT = "important";
     private static final String KEY_CALLS = "phone_calls";
     private static final String KEY_MESSAGES = "messages";
     private static final String KEY_STARRED = "starred";
 
-    private static final String KEY_AUTOMATIC = "automatic";
-    private static final String KEY_WHEN = "when";
+    private static final String KEY_DOWNTIME = "downtime";
+    private static final String KEY_DAYS = "days";
     private static final String KEY_START_TIME = "start_time";
     private static final String KEY_END_TIME = "end_time";
 
@@ -86,16 +82,36 @@
     private static final String KEY_ENTRY = "entry";
     private static final String KEY_CONDITION_PROVIDERS = "manage_condition_providers";
 
+    private static final SettingPref PREF_ZEN_MODE = new SettingPref(SettingPref.TYPE_GLOBAL,
+            KEY_ZEN_MODE, Global.ZEN_MODE, Global.ZEN_MODE_OFF, Global.ZEN_MODE_OFF,
+            Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, Global.ZEN_MODE_NO_INTERRUPTIONS) {
+        protected String getCaption(Resources res, int value) {
+            switch (value) {
+                case Global.ZEN_MODE_NO_INTERRUPTIONS:
+                    return res.getString(R.string.zen_mode_option_no_interruptions);
+                case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
+                    return res.getString(R.string.zen_mode_option_important_interruptions);
+                default:
+                    return res.getString(R.string.zen_mode_option_off);
+            }
+        }
+    };
+
+    private static final SimpleDateFormat DAY_FORMAT = new SimpleDateFormat("EEE");
+
     private static SparseArray<String> allKeyTitles(Context context) {
         final SparseArray<String> rt = new SparseArray<String>();
-        rt.put(R.string.zen_mode_general_category, KEY_GENERAL);
+        rt.put(R.string.zen_mode_important_category, KEY_IMPORTANT);
         if (Utils.isVoiceCapable(context)) {
             rt.put(R.string.zen_mode_phone_calls, KEY_CALLS);
+            rt.put(R.string.zen_mode_option_title, KEY_ZEN_MODE);
+        } else {
+            rt.put(R.string.zen_mode_option_title_novoice, KEY_ZEN_MODE);
         }
         rt.put(R.string.zen_mode_messages, KEY_MESSAGES);
         rt.put(R.string.zen_mode_from_starred, KEY_STARRED);
-        rt.put(R.string.zen_mode_automatic_category, KEY_AUTOMATIC);
-        rt.put(R.string.zen_mode_when, KEY_WHEN);
+        rt.put(R.string.zen_mode_downtime_category, KEY_DOWNTIME);
+        rt.put(R.string.zen_mode_downtime_days, KEY_DAYS);
         rt.put(R.string.zen_mode_start_time, KEY_START_TIME);
         rt.put(R.string.zen_mode_end_time, KEY_END_TIME);
         rt.put(R.string.zen_mode_automation_category, KEY_AUTOMATION);
@@ -106,7 +122,6 @@
     private final Handler mHandler = new Handler();
     private final SettingsObserver mSettingsObserver = new SettingsObserver();
 
-    private SwitchBar mSwitchBar;
     private Context mContext;
     private PackageManager mPM;
     private ZenModeConfig mConfig;
@@ -114,42 +129,20 @@
     private SwitchPreference mCalls;
     private SwitchPreference mMessages;
     private DropDownPreference mStarred;
-    private DropDownPreference mWhen;
+    private Preference mDays;
     private TimePickerPreference mStart;
     private TimePickerPreference mEnd;
     private PreferenceCategory mAutomationCategory;
     private Preference mEntry;
     private Preference mConditionProviders;
-    private AlertDialog mDialog;
-    private boolean mIgnoreNext;
 
     @Override
-    public void onSwitchChanged(Switch switchView, final boolean isChecked) {
-        if (DEBUG) Log.d(TAG, "onPreferenceChange isChecked=" + isChecked
-                + " mIgnoreNext=" + mIgnoreNext);
-        if (mIgnoreNext) {
-            mIgnoreNext = false;
-        }
-        AsyncTask.execute(new Runnable() {
-            @Override
-            public void run() {
-                final int v = isChecked ? Global.ZEN_MODE_ON : Global.ZEN_MODE_OFF;
-                putZenModeSetting(v);
-                final int n = ConditionProviderSettings.getEnabledProviderCount(mContext);
-                if (SHOW_CONDITION_DIALOG && n > 0) {
-                    mHandler.post(isChecked ? mShowDialog : mHideDialog);
-                }
-            }
-        });
-    }
-
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState) {
-        super.onActivityCreated(savedInstanceState);
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
         mContext = getActivity();
         mPM = mContext.getPackageManager();
         final Resources res = mContext.getResources();
-        final int p = res.getDimensionPixelSize(R.dimen.content_margin_left);
+        final int padding = res.getDimensionPixelSize(R.dimen.content_margin_left);
 
         addPreferencesFromResource(R.xml.zen_mode_settings);
         final PreferenceScreen root = getPreferenceScreen();
@@ -157,13 +150,15 @@
         mConfig = getZenModeConfig();
         if (DEBUG) Log.d(TAG, "Loaded mConfig=" + mConfig);
 
-        mSwitchBar = ((SettingsActivity) mContext).getSwitchBar();
-        mSwitchBar.addOnSwitchChangeListener(this);
-        mSwitchBar.show();
+        final Preference zenMode = PREF_ZEN_MODE.init(this);
+        if (!Utils.isVoiceCapable(mContext)) {
+            zenMode.setTitle(R.string.zen_mode_option_title_novoice);
+        }
 
-        final PreferenceCategory general = (PreferenceCategory) root.findPreference(KEY_GENERAL);
+        final PreferenceCategory important =
+                (PreferenceCategory) root.findPreference(KEY_IMPORTANT);
 
-        mCalls = (SwitchPreference) general.findPreference(KEY_CALLS);
+        mCalls = (SwitchPreference) important.findPreference(KEY_CALLS);
         if (Utils.isVoiceCapable(mContext)) {
             mCalls.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
                 @Override
@@ -178,11 +173,11 @@
                 }
             });
         } else {
-            general.removePreference(mCalls);
+            important.removePreference(mCalls);
             mCalls = null;
         }
 
-        mMessages = (SwitchPreference) general.findPreference(KEY_MESSAGES);
+        mMessages = (SwitchPreference) important.findPreference(KEY_MESSAGES);
         mMessages.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
             @Override
             public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -216,44 +211,52 @@
                 return setZenModeConfig(newConfig);
             }
         });
-        general.addPreference(mStarred);
+        important.addPreference(mStarred);
 
         final Preference alarmInfo = new Preference(mContext) {
             @Override
             public View getView(View convertView, ViewGroup parent) {
                 final TextView tv = new TextView(mContext);
                 tv.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.ITALIC));
-                tv.setPadding(p, p, p, p);
+                tv.setPadding(padding, padding, padding, padding);
                 tv.setText(R.string.zen_mode_alarm_info);
                 return tv;
             }
         };
         alarmInfo.setPersistent(false);
         alarmInfo.setSelectable(false);
-        general.addPreference(alarmInfo);
+        important.addPreference(alarmInfo);
 
-        final PreferenceCategory auto = (PreferenceCategory) root.findPreference(KEY_AUTOMATIC);
+        final PreferenceCategory downtime = (PreferenceCategory) root.findPreference(KEY_DOWNTIME);
 
-        mWhen = new DropDownPreference(mContext);
-        mWhen.setKey(KEY_WHEN);
-        mWhen.setTitle(R.string.zen_mode_when);
-        mWhen.setDropDownWidth(R.dimen.zen_mode_dropdown_width);
-        mWhen.addItem(R.string.zen_mode_when_every_night, ZenModeConfig.SLEEP_MODE_NIGHTS);
-        mWhen.addItem(R.string.zen_mode_when_weeknights, ZenModeConfig.SLEEP_MODE_WEEKNIGHTS);
-        mWhen.addItem(R.string.zen_mode_when_never, null);
-        mWhen.setCallback(new DropDownPreference.Callback() {
+        mDays = downtime.findPreference(KEY_DAYS);
+        mDays.setOnPreferenceClickListener(new OnPreferenceClickListener() {
             @Override
-            public boolean onItemSelected(int pos, Object value) {
-                if (mDisableListeners) return true;
-                final String mode = (String) value;
-                if (Objects.equals(mode, mConfig.sleepMode)) return true;
-                if (DEBUG) Log.d(TAG, "onPrefChange sleepMode=" + mode);
-                final ZenModeConfig newConfig = mConfig.copy();
-                newConfig.sleepMode = mode;
-                return setZenModeConfig(newConfig);
+            public boolean onPreferenceClick(Preference preference) {
+                new AlertDialog.Builder(mContext)
+                        .setTitle(R.string.zen_mode_downtime_days)
+                        .setView(new ZenModeDowntimeDaysSelection(mContext, mConfig.sleepMode) {
+                              @Override
+                              protected void onChanged(String mode) {
+                                  if (mDisableListeners) return;
+                                  if (Objects.equals(mode, mConfig.sleepMode)) return;
+                                  if (DEBUG) Log.d(TAG, "days.onChanged sleepMode=" + mode);
+                                  final ZenModeConfig newConfig = mConfig.copy();
+                                  newConfig.sleepMode = mode;
+                                  setZenModeConfig(newConfig);
+                              }
+                        })
+                        .setOnDismissListener(new OnDismissListener() {
+                            @Override
+                            public void onDismiss(DialogInterface dialog) {
+                                updateDays();
+                            }
+                        })
+                        .setPositiveButton(R.string.done_button, null)
+                        .show();
+                return true;
             }
         });
-        auto.addPreference(mWhen);
 
         final FragmentManager mgr = getFragmentManager();
 
@@ -276,8 +279,8 @@
                 return setZenModeConfig(newConfig);
             }
         });
-        auto.addPreference(mStart);
-        mStart.setDependency(mWhen.getKey());
+        downtime.addPreference(mStart);
+        mStart.setDependency(mDays.getKey());
 
         mEnd = new TimePickerPreference(mContext, mgr);
         mEnd.setKey(KEY_END_TIME);
@@ -298,8 +301,8 @@
                 return setZenModeConfig(newConfig);
             }
         });
-        auto.addPreference(mEnd);
-        mEnd.setDependency(mWhen.getKey());
+        downtime.addPreference(mEnd);
+        mEnd.setDependency(mDays.getKey());
 
         mAutomationCategory = (PreferenceCategory) findPreference(KEY_AUTOMATION);
         mEntry = findPreference(KEY_ENTRY);
@@ -322,10 +325,39 @@
         });
         mConditionProviders = findPreference(KEY_CONDITION_PROVIDERS);
 
-        updateZenMode();
         updateControls();
     }
 
+    private void updateDays() {
+        if (mConfig != null) {
+            final int[] days = ZenModeConfig.tryParseDays(mConfig.sleepMode);
+            if (days != null && days.length != 0) {
+                final StringBuilder sb = new StringBuilder();
+                final Calendar c = Calendar.getInstance();
+                for (int i = 0; i < ZenModeConfig.ALL_DAYS.length; i++) {
+                    final int day = ZenModeConfig.ALL_DAYS[i];
+                    for (int j = 0; j < days.length; j++) {
+                        if (day == days[j]) {
+                            c.set(Calendar.DAY_OF_WEEK, day);
+                            if (sb.length() > 0) {
+                                sb.append(mContext.getString(R.string.summary_divider_text));
+                            }
+                            sb.append(DAY_FORMAT.format(c.getTime()));
+                            break;
+                        }
+                    }
+                }
+                if (sb.length() > 0) {
+                    mDays.setSummary(sb);
+                    mDays.notifyDependencyChange(false);
+                    return;
+                }
+            }
+        }
+        mDays.setSummary(R.string.zen_mode_downtime_days_none);
+        mDays.notifyDependencyChange(true);
+    }
+
     private void updateEndSummary() {
         final int startMin = 60 * mConfig.sleepStartHour + mConfig.sleepStartMinute;
         final int endMin = 60 * mConfig.sleepEndHour + mConfig.sleepEndMinute;
@@ -340,7 +372,7 @@
         }
         mMessages.setChecked(mConfig.allowMessages);
         mStarred.setSelectedValue(mConfig.allowFrom);
-        mWhen.setSelectedValue(mConfig.sleepMode);
+        updateDays();
         mStart.setTime(mConfig.sleepStartHour, mConfig.sleepStartMinute);
         mEnd.setTime(mConfig.sleepEndHour, mConfig.sleepEndMinute);
         mDisableListeners = false;
@@ -398,7 +430,6 @@
     public void onResume() {
         super.onResume();
         updateControls();
-        updateZenMode();
         mSettingsObserver.register();
     }
 
@@ -408,22 +439,6 @@
         mSettingsObserver.unregister();
     }
 
-    @Override
-    public void onDestroyView() {
-        super.onDestroyView();
-        mSwitchBar.removeOnSwitchChangeListener(this);
-        mSwitchBar.hide();
-    }
-
-    private void updateZenMode() {
-        final boolean zenMode = Global.getInt(getContentResolver(),
-                Global.ZEN_MODE, Global.ZEN_MODE_OFF) != Global.ZEN_MODE_OFF;
-        if (mSwitchBar.isChecked() != zenMode) {
-            mSwitchBar.setChecked(zenMode);
-            mIgnoreNext = true;
-        }
-    }
-
     private void updateZenModeConfig() {
         final ZenModeConfig config = getZenModeConfig();
         if (Objects.equals(config, mConfig)) return;
@@ -468,38 +483,6 @@
         return new ZenModeConditionSelection(mContext);
     }
 
-    private final Runnable mHideDialog = new Runnable() {
-        @Override
-        public void run() {
-            if (mDialog != null) {
-                mDialog.dismiss();
-                mDialog = null;
-            }
-        }
-    };
-
-    private final Runnable mShowDialog = new Runnable() {
-        @Override
-        public void run() {
-            mDialog = new AlertDialog.Builder(mContext)
-                    .setTitle(R.string.zen_mode_settings_title)
-                    .setView(newConditionSelection())
-                    .setNegativeButton(R.string.dlg_cancel, new DialogInterface.OnClickListener() {
-                        @Override
-                        public void onClick(DialogInterface dialog, int which) {
-                            putZenModeSetting(Global.ZEN_MODE_OFF);
-                        }
-                    })
-                    .setPositiveButton(R.string.dlg_ok, new DialogInterface.OnClickListener() {
-                        @Override
-                        public void onClick(DialogInterface dialog, int which) {
-                            // noop
-                        }
-                    })
-                    .show();
-        }
-    };
-
     // Enable indexing of searchable data
     public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
         new BaseSearchIndexProvider() {
@@ -549,7 +532,7 @@
         public void onChange(boolean selfChange, Uri uri) {
             super.onChange(selfChange, uri);
             if (ZEN_MODE_URI.equals(uri)) {
-                updateZenMode();
+                PREF_ZEN_MODE.update(mContext);
             }
             if (ZEN_MODE_CONFIG_ETAG_URI.equals(uri)) {
                 updateZenModeConfig();
diff --git a/src/com/android/settings/search/Ranking.java b/src/com/android/settings/search/Ranking.java
index d8f69c3..8115cb5 100644
--- a/src/com/android/settings/search/Ranking.java
+++ b/src/com/android/settings/search/Ranking.java
@@ -36,7 +36,6 @@
 import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
 import com.android.settings.location.LocationSettings;
 import com.android.settings.net.DataUsageMeteredSettings;
-import com.android.settings.notification.NotificationDisplaySettings;
 import com.android.settings.notification.NotificationSettings;
 import com.android.settings.notification.OtherSoundSettings;
 import com.android.settings.notification.ZenModeSettings;
@@ -108,7 +107,6 @@
 
         // Notifications
         sRankMap.put(NotificationSettings.class.getName(), RANK_NOTIFICATIONS);
-        sRankMap.put(NotificationDisplaySettings.class.getName(), RANK_NOTIFICATIONS);
         sRankMap.put(OtherSoundSettings.class.getName(), RANK_NOTIFICATIONS);
         sRankMap.put(ZenModeSettings.class.getName(), RANK_NOTIFICATIONS);
 
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index 6d43f97..e78d9b8 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -39,7 +39,6 @@
 import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
 import com.android.settings.location.LocationSettings;
 import com.android.settings.net.DataUsageMeteredSettings;
-import com.android.settings.notification.NotificationDisplaySettings;
 import com.android.settings.notification.NotificationSettings;
 import com.android.settings.notification.OtherSoundSettings;
 import com.android.settings.notification.ZenModeSettings;
@@ -129,13 +128,6 @@
                         NotificationSettings.class.getName(),
                         R.drawable.ic_settings_notifications));
 
-        sResMap.put(NotificationDisplaySettings.class.getName(),
-                new SearchIndexableResource(
-                        Ranking.getRankForClassName(NotificationDisplaySettings.class.getName()),
-                        R.xml.notification_display_settings,
-                        NotificationDisplaySettings.class.getName(),
-                        R.drawable.ic_settings_notifications));
-
         sResMap.put(OtherSoundSettings.class.getName(),
                 new SearchIndexableResource(
                         Ranking.getRankForClassName(OtherSoundSettings.class.getName()),