Split Sound & notification settings.

Bug: 25860852
Change-Id: If88daf6fd50b5abf86fb86f3590361f0118172a1
This commit is contained in:
Julia Reynolds
2015-11-24 10:08:14 -05:00
parent b6cda97235
commit 8c0a423865
16 changed files with 594 additions and 473 deletions

View File

@@ -859,7 +859,7 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE_LAUNCH" /> <category android:name="android.intent.category.VOICE_LAUNCH" />
</intent-filter> </intent-filter>
<intent-filter android:priority="9"> <intent-filter android:priority="10">
<action android:name="com.android.settings.action.SETTINGS" /> <action android:name="com.android.settings.action.SETTINGS" />
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.category" <meta-data android:name="com.android.settings.category"
@@ -885,7 +885,7 @@
<category android:name="android.intent.category.VOICE_LAUNCH" /> <category android:name="android.intent.category.VOICE_LAUNCH" />
<category android:name="com.android.settings.SHORTCUT" /> <category android:name="com.android.settings.SHORTCUT" />
</intent-filter> </intent-filter>
<intent-filter android:priority="8"> <intent-filter android:priority="9">
<action android:name="com.android.settings.action.SETTINGS" /> <action android:name="com.android.settings.action.SETTINGS" />
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.category" <meta-data android:name="com.android.settings.category"
@@ -2336,8 +2336,8 @@
android:value="com.android.settings.notification.ZenAccessSettings" /> android:value="com.android.settings.notification.ZenAccessSettings" />
</activity> </activity>
<activity android:name="Settings$NotificationSettingsActivity" <activity android:name="Settings$ConfigureNotificationSettingsActivity"
android:label="@string/notification_settings" android:label="@string/configure_notification_settings"
android:icon="@drawable/ic_settings_notifications" android:icon="@drawable/ic_settings_notifications"
android:exported="true" android:exported="true"
android:taskAffinity=""> android:taskAffinity="">
@@ -2350,22 +2350,18 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.settings.SHORTCUT" /> <category android:name="com.android.settings.SHORTCUT" />
</intent-filter> </intent-filter>
<intent-filter android:priority="7">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.device" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.notification.NotificationSettings" /> android:value="com.android.settings.notification.ConfigureNotificationSettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
<!-- Keep compatibility with old shortcuts. --> <!-- Keep compatibility with old shortcuts. -->
<activity-alias android:name="Settings$SoundSettingsActivity" <activity android:name="Settings$SoundSettingsActivity"
android:label="@string/notification_settings" android:label="@string/sound_settings"
android:icon="@drawable/ic_settings_sound"
android:taskAffinity="" android:taskAffinity=""
android:targetActivity="Settings$NotificationSettingsActivity"> android:exported="true">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="com.android.settings.SOUND_SETTINGS" /> <action android:name="com.android.settings.SOUND_SETTINGS" />
<action android:name="android.settings.SOUND_SETTINGS" /> <action android:name="android.settings.SOUND_SETTINGS" />
@@ -2375,20 +2371,26 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE_LAUNCH" /> <category android:name="android.intent.category.VOICE_LAUNCH" />
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter> </intent-filter>
<intent-filter android:priority="7">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.device" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.notification.NotificationSettings" /> android:value="com.android.settings.notification.SoundSettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity-alias> </activity>
<!-- Keep compatibility with old shortcuts. --> <!-- Keep compatibility with old shortcuts. -->
<activity-alias android:name="SoundSettings" <activity-alias android:name="SoundSettings"
android:label="@string/notification_settings" android:label="@string/sound_settings"
android:exported="true" android:exported="true"
android:targetActivity="Settings$NotificationSettingsActivity"> android:targetActivity="Settings$SoundSettingsActivity">
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.notification.NotificationSettings" /> android:value="com.android.settings.notification.SoundSettings" />
</activity-alias> </activity-alias>
<activity android:name="Settings$OtherSoundSettingsActivity" <activity android:name="Settings$OtherSoundSettingsActivity"
@@ -2412,8 +2414,14 @@
<!-- Show apps for which application-level notification settings are applicable --> <!-- Show apps for which application-level notification settings are applicable -->
<activity android:name="Settings$NotificationAppListActivity" <activity android:name="Settings$NotificationAppListActivity"
android:label="@string/app_notifications_title" android:label="@string/app_notifications_title"
android:icon="@drawable/ic_settings_notifications"
android:exported="true" android:exported="true"
android:taskAffinity=""> android:taskAffinity="">
<intent-filter android:priority="8">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.device" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.ManageApplications" /> android:value="com.android.settings.applications.ManageApplications" />
</activity> </activity>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/zen_access"
android:title="@string/manage_zen_access_title"
android:showAsAction="never" />
</menu>

View File

@@ -5888,7 +5888,7 @@
<string name="keywords_network_reset">reset restore factory</string> <string name="keywords_network_reset">reset restore factory</string>
<string name="keywords_factory_data_reset">wipe delete restore clear remove</string> <string name="keywords_factory_data_reset">wipe delete restore clear remove</string>
<string name="keywords_printing">printer</string> <string name="keywords_printing">printer</string>
<string name="keywords_sounds_and_notifications">speaker beep</string> <string name="keywords_sounds">speaker beep</string>
<string name="keywords_sounds_and_notifications_interruptions">dont don\u2019t disturb interrupt interruption break</string> <string name="keywords_sounds_and_notifications_interruptions">dont don\u2019t disturb interrupt interruption break</string>
<string name="keywords_app">RAM</string> <string name="keywords_app">RAM</string>
<string name="keywords_location">nearby location history reporting</string> <string name="keywords_location">nearby location history reporting</string>
@@ -5929,78 +5929,117 @@
<!-- Sounds and Notification --> <!-- Sounds and Notification -->
<!-- Sound: Dashboard summary. [CHAR LIMIT=100] -->
<string name="sound_settings_summary">Ringer volume at <xliff:g id="percentage" example="2">%1$s</xliff:g></string>
<!-- Sound & notification: Settings header. [CHAR LIMIT=30] --> <!-- Sound: Title for the option managing media volume. [CHAR LIMIT=30] -->
<string name="notification_settings">Sound &amp; notification</string>
<!-- Sound & notification > Sound section: Title for the option managing media volume. [CHAR LIMIT=30] -->
<string name="media_volume_option_title">Media volume</string> <string name="media_volume_option_title">Media volume</string>
<!-- Sound & notification > Sound section: Title for the option managing alarm volume. [CHAR LIMIT=30] --> <!-- Sound: Title for the option managing alarm volume. [CHAR LIMIT=30] -->
<string name="alarm_volume_option_title">Alarm volume</string> <string name="alarm_volume_option_title">Alarm volume</string>
<!-- Sound & notification > Sound section: Title for the option managing ringer volume. [CHAR LIMIT=30] --> <!-- Sound: Title for the option managing ringer volume. [CHAR LIMIT=30] -->
<string name="ring_volume_option_title">Ring volume</string> <string name="ring_volume_option_title">Ring volume</string>
<!-- Sound & notification > Sound section: Title for the option managing notification volume. [CHAR LIMIT=30] --> <!-- Sound: Title for the option managing notification volume. [CHAR LIMIT=30] -->
<string name="notification_volume_option_title">Notification volume</string> <string name="notification_volume_option_title">Notification volume</string>
<!-- Sound & notification > Sound section: Title for the Interruptions option and associated settings page. [CHAR LIMIT=30] --> <!-- Sound: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
<string name="zen_mode_settings_title" translatable="false">@*android:string/zen_mode_feature_name</string>
<!-- Sound & notification > Sound section: Title for the Priority interruptions option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_priority_settings_title">Priority only allows</string>
<!-- Sound & notification > Sound section: Title for the zen mode automation option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_automation_settings_title">Automatic rules</string>
<!-- Sound & notification > Sound section: Zen mode option: Important interruptions [CHAR LIMIT=60] -->
<string name="zen_mode_option_important_interruptions">Priority only</string>
<!-- Sound & notification > Sound section: Zen mode option: Alarms only [CHAR LIMIT=60] -->
<string name="zen_mode_option_alarms">Alarms only</string>
<!-- Sound & notification > Sound section: Zen mode option: No interruptions [CHAR LIMIT=60] -->
<string name="zen_mode_option_no_interruptions">Total silence</string>
<!-- Sound & notification > Sound section: Zen mode combined summary + condition line [CHAR LIMIT=60] -->
<string name="zen_mode_summary_combination"><xliff:g id="mode" example="Priority only">%1$s</xliff:g>: <xliff:g id="exit condition" example="Until you turn this off">%2$s</xliff:g></string>
<!-- Sound & notification > Do not disturb section: Title for the Visual interruptions option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_visual_interruptions_settings_title">Visual interruptions</string>
<!-- Sound & notification > Sound section: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
<string name="ringtone_title">Phone ringtone</string> <string name="ringtone_title">Phone ringtone</string>
<!-- Sound & notification > Sound section: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] --> <!-- Sound: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
<string name="notification_ringtone_title">Default notification ringtone</string> <string name="notification_ringtone_title">Default notification ringtone</string>
<!-- Sound & notification > Sound section: Title for the option managing whether or not to vibrate when ringing. [CHAR LIMIT=30] --> <!-- Sound: 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> <string name="vibrate_when_ringing_title">Also vibrate for calls</string>
<!-- Sound & notification: Notification section header [CHAR LIMIT=30] --> <!-- Sound: Title for the other sounds option and associated settings page. [CHAR LIMIT=30] -->
<string name="notification_section_header">Notification</string> <string name="other_sound_settings">Other sounds</string>
<!-- Sound & notification: Advanced section header [CHAR LIMIT=30] --> <!-- Sound: 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: 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: Other sounds: Title for the option enabling charging sounds. [CHAR LIMIT=30] -->
<string name="charging_sounds_title">Charging sounds</string>
<!-- Sound: Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
<string name="docking_sounds_title">Docking sounds</string>
<!-- Sound: Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
<string name="touch_sounds_title">Touch sounds</string>
<!-- Sound: 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: Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=50] -->
<string name="dock_audio_media_title">Dock speaker plays</string>
<!-- Sound: 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: 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: Other sounds: Value for the emergency tone option with value 0: silent. [CHAR LIMIT=30] -->
<string name="emergency_tone_silent">Silent</string>
<!-- Sound: Other sounds: Value for the emergency tone option with value 1: alert. [CHAR LIMIT=30] -->
<string name="emergency_tone_alert">Alert</string>
<!-- Sound: Other sounds: Value for the emergency tone option with value 2: vibrate. [CHAR LIMIT=30] -->
<string name="emergency_tone_vibrate">Vibrate</string>
<!-- Sound: Title for the Do not Disturb option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_settings_title" translatable="false">@*android:string/zen_mode_feature_name</string>
<!-- Do not disturb: Title for the Priority interruptions option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_priority_settings_title">Priority only allows</string>
<!-- Do not disturb: Title for the zen mode automation option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_automation_settings_title">Automatic rules</string>
<!-- Do not disturb: Zen mode option: Important interruptions [CHAR LIMIT=60] -->
<string name="zen_mode_option_important_interruptions">Priority only</string>
<!-- Do not disturb: Zen mode option: Alarms only [CHAR LIMIT=60] -->
<string name="zen_mode_option_alarms">Alarms only</string>
<!-- Do not disturb: Zen mode option: No interruptions [CHAR LIMIT=60] -->
<string name="zen_mode_option_no_interruptions">Total silence</string>
<!-- Do not disturb: Zen mode combined summary + condition line [CHAR LIMIT=60] -->
<string name="zen_mode_summary_combination"><xliff:g id="mode" example="Priority only">%1$s</xliff:g>: <xliff:g id="exit condition" example="Until you turn this off">%2$s</xliff:g></string>
<!-- Do not disturb: Title for the Visual interruptions option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_visual_interruptions_settings_title">Visual interruptions</string>
<!-- Configure Notifications Settings title. [CHAR LIMIT=30] -->
<string name="configure_notification_settings">Configure notifications</string>
<!-- Configure Notifications: Advanced section header [CHAR LIMIT=30] -->
<string name="advanced_section_header">Advanced</string> <string name="advanced_section_header">Advanced</string>
<!-- Sound & notification > Notification section: Title for the pulse notification light option. [CHAR LIMIT=30] --> <!-- Configure Notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
<string name="notification_pulse_title">Pulse notification light</string> <string name="notification_pulse_title">Pulse notification light</string>
<!-- Sound & notification > Notification section: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] --> <!-- Configure Notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
<string name="lock_screen_notifications_title">When device is locked</string> <string name="lock_screen_notifications_title">When device is locked</string>
<!-- Sound & notification > Notification section: Value for lockscreen notifications: all information will be <!-- Configure Notifications: Value for lockscreen notifications: all information will be
shown in notifications shown on a secure lock screen shown in notifications shown on a secure lock screen
[CHAR LIMIT=50] --> [CHAR LIMIT=50] -->
<string name="lock_screen_notifications_summary_show">Show all notification content</string> <string name="lock_screen_notifications_summary_show">Show all notification content</string>
<!-- Sound & notification > Notification section: Value for lockscreen notifications: sensitive information will be <!-- Configure Notifications: Value for lockscreen notifications: sensitive information will be
hidden or redacted from notifications shown on a secure lock screen hidden or redacted from notifications shown on a secure lock screen
[CHAR LIMIT=50] --> [CHAR LIMIT=50] -->
<string name="lock_screen_notifications_summary_hide">Hide sensitive notification content</string> <string name="lock_screen_notifications_summary_hide">Hide sensitive notification content</string>
<!-- Sound & notification > Notification section: Value for lockscreen notifications: notifications will not appear on a secure lock screen <!-- Configure Notifications: Value for lockscreen notifications: notifications will not appear on a secure lock screen
[CHAR LIMIT=50] --> [CHAR LIMIT=50] -->
<string name="lock_screen_notifications_summary_disable">Don\u2019t show notifications at all</string> <string name="lock_screen_notifications_summary_disable">Don\u2019t show notifications at all</string>
@@ -6010,50 +6049,13 @@
<!-- Security > Choose PIN/PW/Pattern > Notification redaction interstitial: Title for the screen asking the user how they want their notifications to appear when the device is locked [CHAR LIMIT=30] --> <!-- Security > Choose PIN/PW/Pattern > Notification redaction interstitial: Title for the screen asking the user how they want their notifications to appear when the device is locked [CHAR LIMIT=30] -->
<string name="lock_screen_notifications_interstitial_title">Notifications</string> <string name="lock_screen_notifications_interstitial_title">Notifications</string>
<!-- Sound & notification > Notification section: Title for the option managing notifications per application. [CHAR LIMIT=30] --> <!-- Notification Settings: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
<string name="app_notifications_title">App notifications</string> <string name="app_notifications_title">Notifications</string>
<!-- Sound & notification > Notification section: Title for the option managing notifications per topic. [CHAR LIMIT=30] --> <!-- Sound & notification > Notification section: Title for the option managing notifications per topic. [CHAR LIMIT=30] -->
<string name="topic_notifications_title">Topic notifications</string> <string name="topic_notifications_title">Topic notifications</string>
<!-- 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 & 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 & 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 & notification > Other sounds: Title for the option enabling charging sounds. [CHAR LIMIT=30] -->
<string name="charging_sounds_title">Charging sounds</string>
<!-- Sound & notification > Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
<string name="docking_sounds_title">Docking sounds</string>
<!-- Sound & notification > Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
<string name="touch_sounds_title">Touch sounds</string>
<!-- 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 & notification > Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=50] -->
<string name="dock_audio_media_title">Dock speaker plays</string>
<!-- 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 & 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 & notification > Other sounds: Value for the emergency tone option with value 0: silent. [CHAR LIMIT=30] -->
<string name="emergency_tone_silent">Silent</string>
<!-- 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 & notification > Other sounds: Value for the emergency tone option with value 2: vibrate. [CHAR LIMIT=30] -->
<string name="emergency_tone_vibrate">Vibrate</string>
<!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=30] --> <!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=30] -->
<string name="manage_notification_access_title">Notification access</string> <string name="manage_notification_access_title">Notification access</string>
@@ -6320,9 +6322,6 @@
<!-- [CHAR LIMIT=105] Zen mode settings: No notification light summary --> <!-- [CHAR LIMIT=105] Zen mode settings: No notification light summary -->
<string name="zen_mode_lights_summary">Prevent notifications silenced by Do Not Disturb from causing the light to pulse</string> <string name="zen_mode_lights_summary">Prevent notifications silenced by Do Not Disturb from causing the light to pulse</string>
<!-- [CHAR LIMIT=20] Notifications settings: Apps section header -->
<string name="notification_settings_apps_title">App notifications</string>
<!-- [CHAR LIMIT=NONE] Content description for per-app notification <!-- [CHAR LIMIT=NONE] Content description for per-app notification
settings button --> settings button -->
<string name="notification_app_settings_button">Notification settings</string> <string name="notification_app_settings_button">Notification settings</string>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/configure_notification_settings"
android:key="configure_notification_settings" >
<!-- Pulse notification light -->
<SwitchPreference
android:key="notification_pulse"
android:title="@string/notification_pulse_title"
android:persistent="false" />
<!-- When device is locked -->
<com.android.settings.DropDownPreference
android:key="lock_screen_notifications"
android:title="@string/lock_screen_notifications_title"
android:persistent="false" />
<PreferenceCategory
android:key="advanced"
android:title="@string/advanced_section_header" >
<!-- 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>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project <!-- Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -16,13 +16,9 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/notification_settings" android:title="@string/sound_settings"
android:key="notification_settings" android:key="sound_settings"
settings:keywords="@string/keywords_sounds_and_notifications"> settings:keywords="@string/keywords_sounds">
<PreferenceCategory
android:key="sound"
android:title="@string/sound_settings" >
<!-- Media volume --> <!-- Media volume -->
<com.android.settings.notification.VolumeSeekBarPreference <com.android.settings.notification.VolumeSeekBarPreference
@@ -77,6 +73,15 @@
android:persistent="false" android:persistent="false"
android:ringtoneType="notification" /> android:ringtoneType="notification" />
<PreferenceScreen
android:key="cell_broadcast_settings"
android:title="@string/cell_broadcast_settings" >
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.cellbroadcastreceiver"
android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings" />
</PreferenceScreen>
<!-- Other sounds --> <!-- Other sounds -->
<Preference <Preference
android:key="other_sounds" android:key="other_sounds"
@@ -90,54 +95,4 @@
android:title="@string/wifi_display_settings_title" android:title="@string/wifi_display_settings_title"
android:fragment="com.android.settings.wfd.WifiDisplaySettings" /> android:fragment="com.android.settings.wfd.WifiDisplaySettings" />
</PreferenceCategory>
<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:persistent="false" />
<!-- When device is locked -->
<com.android.settings.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.applications.ManageApplications">
<extra
android:name="classname"
android:value="com.android.settings.Settings$NotificationAppListActivity" />
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory
android:key="advanced"
android:title="@string/advanced_section_header" >
<!-- 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" />
<!-- Do Not Disturb access -->
<Preference
android:key="manage_zen_access"
android:title="@string/manage_zen_access_title"
android:persistent="false"
android:fragment="com.android.settings.notification.ZenAccessSettings" />
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -81,13 +81,4 @@
android:key="proxy_settings" android:key="proxy_settings"
android:title="@string/proxy_settings_title" /> android:title="@string/proxy_settings_title" />
<PreferenceScreen
android:key="cell_broadcast_settings"
android:title="@string/cell_broadcast_settings" >
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.cellbroadcastreceiver"
android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings" />
</PreferenceScreen>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -29,6 +29,8 @@ public abstract class InstrumentedFragment extends PreferenceFragment {
public static final int UNDECLARED = 100000; public static final int UNDECLARED = 100000;
public static final int ACCESSIBILITY_TOGGLE_AUTOCLICK = UNDECLARED + 1; public static final int ACCESSIBILITY_TOGGLE_AUTOCLICK = UNDECLARED + 1;
public static final int SOUND = UNDECLARED + 2;
public static final int CONFIGURE_NOTIFICATION = UNDECLARED + 3;
/** /**
* Declare the view of this category. * Declare the view of this category.

View File

@@ -105,7 +105,8 @@ public class Settings extends SettingsActivity {
public static class ZenModeEventRuleSettingsActivity extends SettingsActivity { /* empty */ } public static class ZenModeEventRuleSettingsActivity extends SettingsActivity { /* empty */ }
public static class ZenModeExternalRuleSettingsActivity extends SettingsActivity { /* empty */ } public static class ZenModeExternalRuleSettingsActivity extends SettingsActivity { /* empty */ }
public static class ZenModeVisualInterruptionSettingsActivity extends SettingsActivity { /* empty */} public static class ZenModeVisualInterruptionSettingsActivity extends SettingsActivity { /* empty */}
public static class NotificationSettingsActivity extends SettingsActivity { /* empty */ } public static class SoundSettingsActivity extends SettingsActivity { /* empty */ }
public static class ConfigureNotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class NotificationAppListActivity extends SettingsActivity { /* empty */ } public static class NotificationAppListActivity extends SettingsActivity { /* empty */ }
public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ } public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class OtherSoundSettingsActivity extends SettingsActivity { /* empty */ } public static class OtherSoundSettingsActivity extends SettingsActivity { /* empty */ }

View File

@@ -82,8 +82,9 @@ import com.android.settings.location.LocationSettings;
import com.android.settings.nfc.AndroidBeam; import com.android.settings.nfc.AndroidBeam;
import com.android.settings.nfc.PaymentSettings; import com.android.settings.nfc.PaymentSettings;
import com.android.settings.notification.AppNotificationSettings; import com.android.settings.notification.AppNotificationSettings;
import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.NotificationAccessSettings; import com.android.settings.notification.NotificationAccessSettings;
import com.android.settings.notification.NotificationSettings; import com.android.settings.notification.SoundSettings;
import com.android.settings.notification.NotificationStation; import com.android.settings.notification.NotificationStation;
import com.android.settings.notification.OtherSoundSettings; import com.android.settings.notification.OtherSoundSettings;
import com.android.settings.notification.ZenAccessSettings; import com.android.settings.notification.ZenAccessSettings;
@@ -211,7 +212,7 @@ public class SettingsActivity extends SettingsDrawerActivity
Settings.WirelessSettingsActivity.class.getName(), Settings.WirelessSettingsActivity.class.getName(),
//device_section //device_section
Settings.HomeSettingsActivity.class.getName(), Settings.HomeSettingsActivity.class.getName(),
Settings.NotificationSettingsActivity.class.getName(), Settings.SoundSettingsActivity.class.getName(),
Settings.DisplaySettingsActivity.class.getName(), Settings.DisplaySettingsActivity.class.getName(),
Settings.StorageSettingsActivity.class.getName(), Settings.StorageSettingsActivity.class.getName(),
Settings.ManageApplicationsActivity.class.getName(), Settings.ManageApplicationsActivity.class.getName(),
@@ -284,7 +285,8 @@ public class SettingsActivity extends SettingsDrawerActivity
PaymentSettings.class.getName(), PaymentSettings.class.getName(),
KeyboardLayoutPickerFragment.class.getName(), KeyboardLayoutPickerFragment.class.getName(),
ZenModeSettings.class.getName(), ZenModeSettings.class.getName(),
NotificationSettings.class.getName(), SoundSettings.class.getName(),
ConfigureNotificationSettings.class.getName(),
ChooseLockPassword.ChooseLockPasswordFragment.class.getName(), ChooseLockPassword.ChooseLockPasswordFragment.class.getName(),
ChooseLockPattern.ChooseLockPatternFragment.class.getName(), ChooseLockPattern.ChooseLockPatternFragment.class.getName(),
InstalledAppDetails.class.getName(), InstalledAppDetails.class.getName(),

View File

@@ -67,6 +67,7 @@ import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.fuelgauge.HighPowerDetail; import com.android.settings.fuelgauge.HighPowerDetail;
import com.android.settings.fuelgauge.PowerWhitelistBackend; import com.android.settings.fuelgauge.PowerWhitelistBackend;
import com.android.settings.notification.AppNotificationSettings; import com.android.settings.notification.AppNotificationSettings;
import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend;
import com.android.settings.notification.NotificationBackend.AppRow; import com.android.settings.notification.NotificationBackend.AppRow;
import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.applications.ApplicationsState;
@@ -523,7 +524,8 @@ public class ManageApplications extends InstrumentedFragment
if (mOptionsMenu == null) { if (mOptionsMenu == null) {
return; return;
} }
mOptionsMenu.findItem(R.id.advanced).setVisible(mListType == LIST_TYPE_MAIN); mOptionsMenu.findItem(R.id.advanced).setVisible(
mListType == LIST_TYPE_MAIN || mListType == LIST_TYPE_NOTIFICATION);
mOptionsMenu.findItem(R.id.sort_order_alpha).setVisible(mListType == LIST_TYPE_STORAGE mOptionsMenu.findItem(R.id.sort_order_alpha).setVisible(mListType == LIST_TYPE_STORAGE
&& mSortOrder != R.id.sort_order_alpha); && mSortOrder != R.id.sort_order_alpha);
@@ -556,9 +558,15 @@ public class ManageApplications extends InstrumentedFragment
mResetAppsHelper.buildResetDialog(); mResetAppsHelper.buildResetDialog();
return true; return true;
case R.id.advanced: case R.id.advanced:
((SettingsActivity) getActivity()).startPreferencePanel( if (mListType == LIST_TYPE_NOTIFICATION) {
AdvancedAppSettings.class.getName(), null, R.string.configure_apps, ((SettingsActivity) getActivity()).startPreferencePanel(
null, this, ADVANCED_SETTINGS); ConfigureNotificationSettings.class.getName(), null,
R.string.configure_notification_settings, null, this, ADVANCED_SETTINGS);
} else {
((SettingsActivity) getActivity()).startPreferencePanel(
AdvancedAppSettings.class.getName(), null, R.string.configure_apps,
null, this, ADVANCED_SETTINGS);
}
return true; return true;
default: default:
// Handle the home button // Handle the home button

View File

@@ -0,0 +1,250 @@
/**
* Copyright (C) 2015 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 com.android.internal.widget.LockPatternUtils;
import com.android.settings.DropDownPreference;
import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.provider.Settings;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.TwoStatePreference;
import android.util.Log;
import java.util.ArrayList;
public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
private static final String TAG = "ConfigNotiSettings";
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "lock_screen_notifications";
private final SettingsObserver mSettingsObserver = new SettingsObserver();
private Context mContext;
private TwoStatePreference mNotificationPulse;
private DropDownPreference mLockscreen;
private boolean mSecure;
private int mLockscreenSelectedValue;
@Override
protected int getMetricsCategory() {
return InstrumentedFragment.CONFIGURE_NOTIFICATION;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = getActivity();
mSecure = new LockPatternUtils(getActivity()).isSecure(UserHandle.myUserId());
addPreferencesFromResource(R.xml.configure_notification_settings);
initPulse();
initLockscreenNotifications();
}
@Override
public void onResume() {
super.onResume();
mSettingsObserver.register(true);
}
@Override
public void onPause() {
super.onPause();
mSettingsObserver.register(false);
}
// === Pulse notification light ===
private void initPulse() {
mNotificationPulse =
(TwoStatePreference) getPreferenceScreen().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)) {
getPreferenceScreen().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() {
mLockscreen = (DropDownPreference) getPreferenceScreen().findPreference(
KEY_LOCK_SCREEN_NOTIFICATIONS);
if (mLockscreen == null) {
Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_NOTIFICATIONS);
return;
}
boolean isSecureNotificationsDisabled = isSecureNotificationsDisabled();
boolean isUnredactedNotificationsDisabled = isUnredactedNotificationsDisabled();
ArrayList<CharSequence> entries = new ArrayList<>();
ArrayList<CharSequence> values = new ArrayList<>();
if (!isSecureNotificationsDisabled && !isUnredactedNotificationsDisabled) {
entries.add(getString(R.string.lock_screen_notifications_summary_show));
values.add(Integer.toString(R.string.lock_screen_notifications_summary_show));
}
if (mSecure && !isSecureNotificationsDisabled) {
entries.add(getString(R.string.lock_screen_notifications_summary_hide));
values.add(Integer.toString(R.string.lock_screen_notifications_summary_hide));
}
entries.add(getString(R.string.lock_screen_notifications_summary_disable));
values.add(Integer.toString(R.string.lock_screen_notifications_summary_disable));
mLockscreen.setEntries(entries.toArray(new CharSequence[entries.size()]));
mLockscreen.setEntryValues(values.toArray(new CharSequence[values.size()]));
updateLockscreenNotifications();
if (mLockscreen.getEntries().length > 1) {
mLockscreen.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final int val = Integer.parseInt((String) newValue);
if (val == mLockscreenSelectedValue) {
return false;
}
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.Secure.putInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0);
mLockscreenSelectedValue = val;
return true;
}
});
} else {
// There is one or less option for the user, disable the drop down.
mLockscreen.setEnabled(false);
}
}
private boolean isSecureNotificationsDisabled() {
final DevicePolicyManager dpm =
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
return dpm != null && (dpm.getKeyguardDisabledFeatures(null)
& DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS) != 0;
}
private boolean isUnredactedNotificationsDisabled() {
final DevicePolicyManager dpm =
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
return dpm != null && (dpm.getKeyguardDisabledFeatures(null)
& DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS) != 0;
}
private void updateLockscreenNotifications() {
if (mLockscreen == null) {
return;
}
final boolean enabled = getLockscreenNotificationsEnabled();
final boolean allowPrivate = !mSecure || getLockscreenAllowPrivateNotifications();
mLockscreenSelectedValue = !enabled ? R.string.lock_screen_notifications_summary_disable :
allowPrivate ? R.string.lock_screen_notifications_summary_show :
R.string.lock_screen_notifications_summary_hide;
mLockscreen.setValue(Integer.toString(mLockscreenSelectedValue));
}
private boolean getLockscreenNotificationsEnabled() {
return Settings.Secure.getInt(getContentResolver(),
Settings.Secure.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.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS);
public SettingsObserver() {
super(new Handler());
}
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();
}
}
}
}

View File

@@ -16,8 +16,8 @@
package com.android.settings.notification; package com.android.settings.notification;
import android.app.Activity;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
@@ -37,7 +37,6 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.os.Vibrator; import android.os.Vibrator;
import android.preference.SeekBarVolumizer; import android.preference.SeekBarVolumizer;
@@ -47,29 +46,27 @@ import android.provider.SearchIndexableResource;
import android.provider.Settings; import android.provider.Settings;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener; import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.TwoStatePreference; import android.support.v7.preference.TwoStatePreference;
import android.util.Log; import android.util.Log;
import com.android.internal.logging.MetricsLogger; import com.android.settings.InstrumentedFragment;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.DropDownPreference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.RingtonePreference; import com.android.settings.RingtonePreference;
import com.android.settings.SettingsPreferenceFragment; import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable; import com.android.settings.search.Indexable;
import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
public class NotificationSettings extends SettingsPreferenceFragment implements Indexable { public class SoundSettings extends SettingsPreferenceFragment implements Indexable {
private static final String TAG = "NotificationSettings"; private static final String TAG = "SoundSettings";
private static final String KEY_SOUND = "sound";
private static final String KEY_MEDIA_VOLUME = "media_volume"; private static final String KEY_MEDIA_VOLUME = "media_volume";
private static final String KEY_ALARM_VOLUME = "alarm_volume"; private static final String KEY_ALARM_VOLUME = "alarm_volume";
private static final String KEY_RING_VOLUME = "ring_volume"; private static final String KEY_RING_VOLUME = "ring_volume";
@@ -78,11 +75,6 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
private static final String KEY_NOTIFICATION_RINGTONE = "notification_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_VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
private static final String KEY_WIFI_DISPLAY = "wifi_display"; private static final String KEY_WIFI_DISPLAY = "wifi_display";
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 String KEY_ZEN_ACCESS = "manage_zen_access";
private static final String KEY_ZEN_MODE = "zen_mode"; private static final String KEY_ZEN_MODE = "zen_mode";
private static final String[] RESTRICTED_KEYS = { private static final String[] RESTRICTED_KEYS = {
@@ -90,7 +82,6 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
KEY_ALARM_VOLUME, KEY_ALARM_VOLUME,
KEY_RING_VOLUME, KEY_RING_VOLUME,
KEY_NOTIFICATION_VOLUME, KEY_NOTIFICATION_VOLUME,
KEY_ZEN_ACCESS,
KEY_ZEN_MODE, KEY_ZEN_MODE,
}; };
@@ -103,7 +94,6 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
private final ArrayList<VolumeSeekBarPreference> mVolumePrefs = new ArrayList<>(); private final ArrayList<VolumeSeekBarPreference> mVolumePrefs = new ArrayList<>();
private Context mContext; private Context mContext;
private PackageManager mPM;
private boolean mVoiceCapable; private boolean mVoiceCapable;
private Vibrator mVibrator; private Vibrator mVibrator;
private AudioManager mAudioManager; private AudioManager mAudioManager;
@@ -112,12 +102,6 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
private Preference mPhoneRingtonePreference; private Preference mPhoneRingtonePreference;
private Preference mNotificationRingtonePreference; private Preference mNotificationRingtonePreference;
private TwoStatePreference mVibrateWhenRinging; private TwoStatePreference mVibrateWhenRinging;
private TwoStatePreference mNotificationPulse;
private DropDownPreference mLockscreen;
private Preference mNotificationAccess;
private Preference mZenAccess;
private boolean mSecure;
private int mLockscreenSelectedValue;
private ComponentName mSuppressor; private ComponentName mSuppressor;
private int mRingerMode = -1; private int mRingerMode = -1;
@@ -126,17 +110,15 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
@Override @Override
protected int getMetricsCategory() { protected int getMetricsCategory() {
return MetricsLogger.NOTIFICATION; return InstrumentedFragment.SOUND;
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mContext = getActivity(); mContext = getActivity();
mPM = mContext.getPackageManager();
mUserManager = UserManager.get(getContext()); mUserManager = UserManager.get(getContext());
mVoiceCapable = Utils.isVoiceCapable(mContext); mVoiceCapable = Utils.isVoiceCapable(mContext);
mSecure = new LockPatternUtils(getActivity()).isSecure(UserHandle.myUserId());
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE); mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
@@ -144,9 +126,8 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
mVibrator = null; mVibrator = null;
} }
addPreferencesFromResource(R.xml.notification_settings); addPreferencesFromResource(R.xml.sound_settings);
final PreferenceCategory sound = (PreferenceCategory) findPreference(KEY_SOUND);
initVolumePreference(KEY_MEDIA_VOLUME, AudioManager.STREAM_MUSIC, initVolumePreference(KEY_MEDIA_VOLUME, AudioManager.STREAM_MUSIC,
com.android.internal.R.drawable.ic_audio_media_mute); com.android.internal.R.drawable.ic_audio_media_mute);
initVolumePreference(KEY_ALARM_VOLUME, AudioManager.STREAM_ALARM, initVolumePreference(KEY_ALARM_VOLUME, AudioManager.STREAM_ALARM,
@@ -155,25 +136,15 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
mRingOrNotificationPreference = mRingOrNotificationPreference =
initVolumePreference(KEY_RING_VOLUME, AudioManager.STREAM_RING, initVolumePreference(KEY_RING_VOLUME, AudioManager.STREAM_RING,
com.android.internal.R.drawable.ic_audio_ring_notif_mute); com.android.internal.R.drawable.ic_audio_ring_notif_mute);
sound.removePreference(sound.findPreference(KEY_NOTIFICATION_VOLUME)); removePreference(KEY_NOTIFICATION_VOLUME);
} else { } else {
mRingOrNotificationPreference = mRingOrNotificationPreference =
initVolumePreference(KEY_NOTIFICATION_VOLUME, AudioManager.STREAM_NOTIFICATION, initVolumePreference(KEY_NOTIFICATION_VOLUME, AudioManager.STREAM_NOTIFICATION,
com.android.internal.R.drawable.ic_audio_ring_notif_mute); com.android.internal.R.drawable.ic_audio_ring_notif_mute);
sound.removePreference(sound.findPreference(KEY_RING_VOLUME)); removePreference(KEY_RING_VOLUME);
} }
initRingtones(sound); initRingtones();
initVibrateWhenRinging(sound); initVibrateWhenRinging();
final PreferenceCategory notification = (PreferenceCategory)
findPreference(KEY_NOTIFICATION);
initPulse(notification);
initLockscreenNotifications(notification);
mNotificationAccess = findPreference(KEY_NOTIFICATION_ACCESS);
refreshNotificationListeners();
mZenAccess = findPreference(KEY_ZEN_ACCESS);
refreshZenAccess();
updateRingerMode(); updateRingerMode();
updateEffectsSuppressor(); updateEffectsSuppressor();
} }
@@ -181,8 +152,6 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
refreshNotificationListeners();
refreshZenAccess();
lookupRingtoneNames(); lookupRingtoneNames();
mSettingsObserver.register(true); mSettingsObserver.register(true);
mReceiver.register(true); mReceiver.register(true);
@@ -323,13 +292,14 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
// === Phone & notification ringtone === // === Phone & notification ringtone ===
private void initRingtones(PreferenceCategory root) { private void initRingtones() {
mPhoneRingtonePreference = root.findPreference(KEY_PHONE_RINGTONE); mPhoneRingtonePreference = getPreferenceScreen().findPreference(KEY_PHONE_RINGTONE);
if (mPhoneRingtonePreference != null && !mVoiceCapable) { if (mPhoneRingtonePreference != null && !mVoiceCapable) {
root.removePreference(mPhoneRingtonePreference); getPreferenceScreen().removePreference(mPhoneRingtonePreference);
mPhoneRingtonePreference = null; mPhoneRingtonePreference = null;
} }
mNotificationRingtonePreference = root.findPreference(KEY_NOTIFICATION_RINGTONE); mNotificationRingtonePreference =
getPreferenceScreen().findPreference(KEY_NOTIFICATION_RINGTONE);
} }
private void lookupRingtoneNames() { private void lookupRingtoneNames() {
@@ -397,14 +367,15 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
// === Vibrate when ringing === // === Vibrate when ringing ===
private void initVibrateWhenRinging(PreferenceCategory root) { private void initVibrateWhenRinging() {
mVibrateWhenRinging = (TwoStatePreference) root.findPreference(KEY_VIBRATE_WHEN_RINGING); mVibrateWhenRinging =
(TwoStatePreference) getPreferenceScreen().findPreference(KEY_VIBRATE_WHEN_RINGING);
if (mVibrateWhenRinging == null) { if (mVibrateWhenRinging == null) {
Log.i(TAG, "Preference not found: " + KEY_VIBRATE_WHEN_RINGING); Log.i(TAG, "Preference not found: " + KEY_VIBRATE_WHEN_RINGING);
return; return;
} }
if (!mVoiceCapable) { if (!mVoiceCapable) {
root.removePreference(mVibrateWhenRinging); getPreferenceScreen().removePreference(mVibrateWhenRinging);
mVibrateWhenRinging = null; mVibrateWhenRinging = null;
return; return;
} }
@@ -427,164 +398,11 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
Settings.System.VIBRATE_WHEN_RINGING, 0) != 0); 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;
}
boolean isSecureNotificationsDisabled = isSecureNotificationsDisabled();
boolean isUnredactedNotificationsDisabled = isUnredactedNotificationsDisabled();
ArrayList<CharSequence> entries = new ArrayList<>();
ArrayList<CharSequence> values = new ArrayList<>();
if (!isSecureNotificationsDisabled && !isUnredactedNotificationsDisabled) {
entries.add(getString(R.string.lock_screen_notifications_summary_show));
values.add(Integer.toString(R.string.lock_screen_notifications_summary_show));
}
if (mSecure && !isSecureNotificationsDisabled) {
entries.add(getString(R.string.lock_screen_notifications_summary_hide));
values.add(Integer.toString(R.string.lock_screen_notifications_summary_hide));
}
entries.add(getString(R.string.lock_screen_notifications_summary_disable));
values.add(Integer.toString(R.string.lock_screen_notifications_summary_disable));
mLockscreen.setEntries(entries.toArray(new CharSequence[entries.size()]));
mLockscreen.setEntryValues(values.toArray(new CharSequence[values.size()]));
updateLockscreenNotifications();
if (mLockscreen.getEntries().length > 1) {
mLockscreen.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final int val = Integer.parseInt((String) newValue);
if (val == mLockscreenSelectedValue) {
return false;
}
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.Secure.putInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0);
mLockscreenSelectedValue = val;
return true;
}
});
} else {
// There is one or less option for the user, disable the drop down.
mLockscreen.setEnabled(false);
}
}
private boolean isSecureNotificationsDisabled() {
final DevicePolicyManager dpm =
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
return dpm != null && (dpm.getKeyguardDisabledFeatures(null)
& DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS) != 0;
}
private boolean isUnredactedNotificationsDisabled() {
final DevicePolicyManager dpm =
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
return dpm != null && (dpm.getKeyguardDisabledFeatures(null)
& DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS) != 0;
}
private void updateLockscreenNotifications() {
if (mLockscreen == null) {
return;
}
final boolean enabled = getLockscreenNotificationsEnabled();
final boolean allowPrivate = !mSecure || getLockscreenAllowPrivateNotifications();
mLockscreenSelectedValue = !enabled ? R.string.lock_screen_notifications_summary_disable :
allowPrivate ? R.string.lock_screen_notifications_summary_show :
R.string.lock_screen_notifications_summary_hide;
mLockscreen.setValue(Integer.toString(mLockscreenSelectedValue));
}
private boolean getLockscreenNotificationsEnabled() {
return Settings.Secure.getInt(getContentResolver(),
Settings.Secure.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() {
if (mNotificationAccess != null) {
final int n = NotificationAccessSettings.getEnabledListenersCount(mContext);
if (n == 0) {
mNotificationAccess.setSummary(getResources().getString(
R.string.manage_notification_access_summary_zero));
} else {
mNotificationAccess.setSummary(String.format(getResources().getQuantityString(
R.plurals.manage_notification_access_summary_nonzero,
n, n)));
}
}
}
// === Zen access ===
private void refreshZenAccess() {
// noop for now
}
// === Callbacks === // === Callbacks ===
private final class SettingsObserver extends ContentObserver { private final class SettingsObserver extends ContentObserver {
private final Uri VIBRATE_WHEN_RINGING_URI = private final Uri VIBRATE_WHEN_RINGING_URI =
Settings.System.getUriFor(Settings.System.VIBRATE_WHEN_RINGING); 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.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS);
public SettingsObserver() { public SettingsObserver() {
super(mHandler); super(mHandler);
@@ -594,9 +412,6 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
final ContentResolver cr = getContentResolver(); final ContentResolver cr = getContentResolver();
if (register) { if (register) {
cr.registerContentObserver(VIBRATE_WHEN_RINGING_URI, false, this); 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 { } else {
cr.unregisterContentObserver(this); cr.unregisterContentObserver(this);
} }
@@ -608,12 +423,6 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
if (VIBRATE_WHEN_RINGING_URI.equals(uri)) { if (VIBRATE_WHEN_RINGING_URI.equals(uri)) {
updateVibrateWhenRinging(); updateVibrateWhenRinging();
} }
if (NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) {
updatePulse();
}
if (LOCK_SCREEN_PRIVATE_URI.equals(uri) || LOCK_SCREEN_SHOW_URI.equals(uri)) {
updateLockscreenNotifications();
}
} }
} }
@@ -677,6 +486,57 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
} }
} }
// === Summary ===
private static class SummaryProvider extends BroadcastReceiver
implements SummaryLoader.SummaryProvider {
private final Context mContext;
private final AudioManager mAudioManager;
private final SummaryLoader mSummaryLoader;
private final int maxVolume;
public SummaryProvider(Context context, SummaryLoader summaryLoader) {
mContext = context;
mSummaryLoader = summaryLoader;
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
maxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
}
@Override
public void setListening(boolean listening) {
if (listening) {
IntentFilter filter = new IntentFilter();
filter.addAction(AudioManager.VOLUME_CHANGED_ACTION);
filter.addAction(AudioManager.STREAM_DEVICES_CHANGED_ACTION);
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
filter.addAction(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION);
filter.addAction(AudioManager.STREAM_MUTE_CHANGED_ACTION);
filter.addAction(NotificationManager.ACTION_EFFECTS_SUPPRESSOR_CHANGED);
mContext.registerReceiver(this, filter);
} else {
mContext.unregisterReceiver(this);
}
}
@Override
public void onReceive(Context context, Intent intent) {
String percent = NumberFormat.getPercentInstance().format(
(double) mAudioManager.getStreamVolume(AudioManager.STREAM_RING) / maxVolume);
mSummaryLoader.setSummary(this,
mContext.getString(R.string.sound_settings_summary, percent));
}
}
public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
= new SummaryLoader.SummaryProviderFactory() {
@Override
public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
SummaryLoader summaryLoader) {
return new SummaryProvider(activity, summaryLoader);
}
};
// === Indexing === // === Indexing ===
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
@@ -685,7 +545,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
public List<SearchIndexableResource> getXmlResourcesToIndex( public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) { Context context, boolean enabled) {
final SearchIndexableResource sir = new SearchIndexableResource(context); final SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = R.xml.notification_settings; sir.xmlResId = R.xml.configure_notification_settings;
return Arrays.asList(sir); return Arrays.asList(sir);
} }

View File

@@ -18,26 +18,19 @@ package com.android.settings.notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.NotificationManager.Policy; import android.app.NotificationManager.Policy;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen; import android.support.v7.preference.PreferenceScreen;
import android.util.SparseArray; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsLogger;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.SettingsActivity;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
import java.util.ArrayList; public class ZenModeSettings extends ZenModeSettingsBase {
import java.util.List;
public class ZenModeSettings extends ZenModeSettingsBase implements Indexable {
private static final String KEY_PRIORITY_SETTINGS = "priority_settings"; private static final String KEY_PRIORITY_SETTINGS = "priority_settings";
private static final String KEY_AUTOMATION_SETTINGS = "automation_settings";
private static final String KEY_VISUAL_INTERRUPTIONS_SETTINGS = "visual_interruptions_settings";
private Preference mPrioritySettings; private Preference mPrioritySettings;
@@ -49,9 +42,6 @@ public class ZenModeSettings extends ZenModeSettingsBase implements Indexable {
final PreferenceScreen root = getPreferenceScreen(); final PreferenceScreen root = getPreferenceScreen();
mPrioritySettings = root.findPreference(KEY_PRIORITY_SETTINGS); mPrioritySettings = root.findPreference(KEY_PRIORITY_SETTINGS);
if (!isScheduleSupported(mContext)) {
removePreference(KEY_AUTOMATION_SETTINGS);
}
} }
@Override @Override
@@ -79,6 +69,23 @@ public class ZenModeSettings extends ZenModeSettingsBase implements Indexable {
updatePrioritySettingsSummary(); updatePrioritySettingsSummary();
} }
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.zen_settings_menu, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.zen_access:
((SettingsActivity) getActivity()).startPreferencePanel(
ZenAccessSettings.class.getCanonicalName(), null,
R.string.manage_zen_access_title, null, this, 0);
return true;
}
return super.onOptionsItemSelected(item);
}
private void updatePrioritySettingsSummary() { private void updatePrioritySettingsSummary() {
Policy policy = NotificationManager.from(mContext).getNotificationPolicy(); Policy policy = NotificationManager.from(mContext).getNotificationPolicy();
String s = getResources().getString(R.string.zen_mode_alarms); String s = getResources().getString(R.string.zen_mode_alarms);
@@ -117,47 +124,8 @@ public class ZenModeSettings extends ZenModeSettingsBase implements Indexable {
return s; return s;
} }
private static SparseArray<String> allKeyTitles() {
final SparseArray<String> rt = new SparseArray<String>();
rt.put(R.string.zen_mode_priority_settings_title, KEY_PRIORITY_SETTINGS);
rt.put(R.string.zen_mode_automation_settings_title, KEY_AUTOMATION_SETTINGS);
rt.put(R.string.zen_mode_visual_interruptions_settings_title,
KEY_VISUAL_INTERRUPTIONS_SETTINGS);
return rt;
}
@Override @Override
protected int getHelpResource() { protected int getHelpResource() {
return R.string.help_uri_interruptions; return R.string.help_uri_interruptions;
} }
// Enable indexing of searchable data
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
final SparseArray<String> keyTitles = allKeyTitles();
final int N = keyTitles.size();
final List<SearchIndexableRaw> result = new ArrayList<SearchIndexableRaw>(N);
final Resources res = context.getResources();
for (int i = 0; i < N; i++) {
final SearchIndexableRaw data = new SearchIndexableRaw(context);
data.key = keyTitles.valueAt(i);
data.title = res.getString(keyTitles.keyAt(i));
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
result.add(data);
}
return result;
}
@Override
public List<String> getNonIndexableKeys(Context context) {
final ArrayList<String> rt = new ArrayList<String>();
if (!isScheduleSupported(context)) {
rt.add(KEY_AUTOMATION_SETTINGS);
}
return rt;
}
};
} }

View File

@@ -122,11 +122,6 @@ abstract public class ZenModeSettingsBase extends RestrictedSettingsFragment {
NotificationManager.from(mContext).setZenMode(zenMode, conditionId, TAG); NotificationManager.from(mContext).setZenMode(zenMode, conditionId, TAG);
} }
protected static boolean isScheduleSupported(Context context) {
return NotificationManager.from(context)
.isSystemConditionProviderEnabled(ZenModeConfig.SCHEDULE_PATH);
}
private List<AutomaticZenRule> getZenModeRules() { private List<AutomaticZenRule> getZenModeRules() {
return NotificationManager.from(mContext).getAutomaticZenRules(); return NotificationManager.from(mContext).getAutomaticZenRules();
} }

View File

@@ -42,8 +42,9 @@ import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
import com.android.settings.location.LocationSettings; import com.android.settings.location.LocationSettings;
import com.android.settings.location.ScanningSettings; import com.android.settings.location.ScanningSettings;
import com.android.settings.net.DataUsageMeteredSettings; import com.android.settings.net.DataUsageMeteredSettings;
import com.android.settings.notification.NotificationSettings; import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.OtherSoundSettings; import com.android.settings.notification.OtherSoundSettings;
import com.android.settings.notification.SoundSettings;
import com.android.settings.notification.ZenModeAutomationSettings; import com.android.settings.notification.ZenModeAutomationSettings;
import com.android.settings.notification.ZenModePrioritySettings; import com.android.settings.notification.ZenModePrioritySettings;
import com.android.settings.notification.ZenModeSettings; import com.android.settings.notification.ZenModeSettings;
@@ -71,20 +72,21 @@ public final class Ranking {
public static final int RANK_DISPLAY = 7; public static final int RANK_DISPLAY = 7;
public static final int RANK_WALLPAPER = 8; public static final int RANK_WALLPAPER = 8;
public static final int RANK_NOTIFICATIONS = 9; public static final int RANK_NOTIFICATIONS = 9;
public static final int RANK_APPS = 10; public static final int RANK_SOUND = 10;
public static final int RANK_STORAGE = 11; public static final int RANK_APPS = 11;
public static final int RANK_POWER_USAGE = 12; public static final int RANK_STORAGE = 12;
public static final int RANK_USERS = 13; public static final int RANK_POWER_USAGE = 13;
public static final int RANK_LOCATION = 14; public static final int RANK_USERS = 14;
public static final int RANK_SECURITY = 15; public static final int RANK_LOCATION = 15;
public static final int RANK_ACCOUNT = 16; public static final int RANK_SECURITY = 16;
public static final int RANK_IME = 17; public static final int RANK_ACCOUNT = 17;
public static final int RANK_PRIVACY = 18; public static final int RANK_IME = 18;
public static final int RANK_DATE_TIME = 19; public static final int RANK_PRIVACY = 19;
public static final int RANK_ACCESSIBILITY = 20; public static final int RANK_DATE_TIME = 20;
public static final int RANK_PRINTING = 21; public static final int RANK_ACCESSIBILITY = 21;
public static final int RANK_DEVELOPEMENT = 22; public static final int RANK_PRINTING = 22;
public static final int RANK_DEVICE_INFO = 23; public static final int RANK_DEVELOPEMENT = 23;
public static final int RANK_DEVICE_INFO = 24;
public static final int RANK_UNDEFINED = -1; public static final int RANK_UNDEFINED = -1;
public static final int RANK_OTHERS = 1024; public static final int RANK_OTHERS = 1024;
@@ -124,8 +126,11 @@ public final class Ranking {
// Wallpapers // Wallpapers
sRankMap.put(WallpaperTypeSettings.class.getName(), RANK_WALLPAPER); sRankMap.put(WallpaperTypeSettings.class.getName(), RANK_WALLPAPER);
// Sound
sRankMap.put(SoundSettings.class.getName(), RANK_SOUND);
// Notifications // Notifications
sRankMap.put(NotificationSettings.class.getName(), RANK_NOTIFICATIONS); sRankMap.put(ConfigureNotificationSettings.class.getName(), RANK_NOTIFICATIONS);
sRankMap.put(OtherSoundSettings.class.getName(), RANK_NOTIFICATIONS); sRankMap.put(OtherSoundSettings.class.getName(), RANK_NOTIFICATIONS);
sRankMap.put(ZenModeSettings.class.getName(), RANK_NOTIFICATIONS); sRankMap.put(ZenModeSettings.class.getName(), RANK_NOTIFICATIONS);
sRankMap.put(ZenModePrioritySettings.class.getName(), RANK_NOTIFICATIONS); sRankMap.put(ZenModePrioritySettings.class.getName(), RANK_NOTIFICATIONS);

View File

@@ -44,8 +44,9 @@ import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
import com.android.settings.location.LocationSettings; import com.android.settings.location.LocationSettings;
import com.android.settings.location.ScanningSettings; import com.android.settings.location.ScanningSettings;
import com.android.settings.net.DataUsageMeteredSettings; import com.android.settings.net.DataUsageMeteredSettings;
import com.android.settings.notification.NotificationSettings; import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.OtherSoundSettings; import com.android.settings.notification.OtherSoundSettings;
import com.android.settings.notification.SoundSettings;
import com.android.settings.notification.ZenModePrioritySettings; import com.android.settings.notification.ZenModePrioritySettings;
import com.android.settings.notification.ZenModeSettings; import com.android.settings.notification.ZenModeSettings;
import com.android.settings.notification.ZenModeVisualInterruptionSettings; import com.android.settings.notification.ZenModeVisualInterruptionSettings;
@@ -144,24 +145,31 @@ public final class SearchIndexableResources {
WallpaperTypeSettings.class.getName(), WallpaperTypeSettings.class.getName(),
R.drawable.ic_settings_display)); R.drawable.ic_settings_display));
sResMap.put(NotificationSettings.class.getName(), sResMap.put(ConfigureNotificationSettings.class.getName(),
new SearchIndexableResource( new SearchIndexableResource(
Ranking.getRankForClassName(NotificationSettings.class.getName()), Ranking.getRankForClassName(ConfigureNotificationSettings.class.getName()),
NO_DATA_RES_ID, R.xml.configure_notification_settings,
NotificationSettings.class.getName(), ConfigureNotificationSettings.class.getName(),
R.drawable.ic_settings_notifications)); R.drawable.ic_settings_notifications));
sResMap.put(SoundSettings.class.getName(),
new SearchIndexableResource(
Ranking.getRankForClassName(SoundSettings.class.getName()),
R.xml.sound_settings,
SoundSettings.class.getName(),
R.drawable.ic_settings_sound));
sResMap.put(OtherSoundSettings.class.getName(), sResMap.put(OtherSoundSettings.class.getName(),
new SearchIndexableResource( new SearchIndexableResource(
Ranking.getRankForClassName(OtherSoundSettings.class.getName()), Ranking.getRankForClassName(OtherSoundSettings.class.getName()),
NO_DATA_RES_ID, NO_DATA_RES_ID,
OtherSoundSettings.class.getName(), OtherSoundSettings.class.getName(),
R.drawable.ic_settings_notifications)); R.drawable.ic_settings_sound));
sResMap.put(ZenModeSettings.class.getName(), sResMap.put(ZenModeSettings.class.getName(),
new SearchIndexableResource( new SearchIndexableResource(
Ranking.getRankForClassName(ZenModeSettings.class.getName()), Ranking.getRankForClassName(ZenModeSettings.class.getName()),
NO_DATA_RES_ID, R.xml.zen_mode_settings,
ZenModeSettings.class.getName(), ZenModeSettings.class.getName(),
R.drawable.ic_settings_notifications)); R.drawable.ic_settings_notifications));