diff options
author | John Spurlock <jspurlock@google.com> | 2015-04-03 20:07:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-03 20:07:58 +0000 |
commit | 851532f37fa01930300bdbc951dcc311d066de02 (patch) | |
tree | d042cd2ab6f9bc699cc3f178d3603ff3d713268a /src/com/android | |
parent | bca21083a3f511bca0369deaf8684b145c281044 (diff) | |
parent | 48bbd5d1e414abfa7efe21d10f6848f4916d8162 (diff) | |
download | packages_apps_Settings-851532f37fa01930300bdbc951dcc311d066de02.tar.gz packages_apps_Settings-851532f37fa01930300bdbc951dcc311d066de02.tar.bz2 packages_apps_Settings-851532f37fa01930300bdbc951dcc311d066de02.zip |
Merge "Settings: Move priority configuration to its own sub-settings page."
Diffstat (limited to 'src/com/android')
6 files changed, 329 insertions, 187 deletions
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index 20ce116e6..4ed10268b 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -94,6 +94,7 @@ public class Settings extends SettingsActivity { public static class PrintSettingsActivity extends SettingsActivity { /* empty */ } public static class PrintJobSettingsActivity extends SettingsActivity { /* empty */ } public static class ZenModeSettingsActivity extends SettingsActivity { /* empty */ } + public static class ZenModePrioritySettingsActivity extends SettingsActivity { /* empty */ } public static class NotificationSettingsActivity extends SettingsActivity { /* empty */ } public static class NotificationAppListActivity extends SettingsActivity { /* empty */ } public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ } diff --git a/src/com/android/settings/notification/ZenModePrioritySettings.java b/src/com/android/settings/notification/ZenModePrioritySettings.java new file mode 100644 index 000000000..062c12a26 --- /dev/null +++ b/src/com/android/settings/notification/ZenModePrioritySettings.java @@ -0,0 +1,157 @@ +/* + * 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 android.os.Bundle; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceScreen; +import android.preference.SwitchPreference; +import android.service.notification.ZenModeConfig; +import android.util.Log; + +import com.android.internal.logging.MetricsLogger; +import com.android.settings.DropDownPreference; +import com.android.settings.R; +import com.android.settings.search.Indexable; + +public class ZenModePrioritySettings extends ZenModeSettingsBase implements Indexable { + private static final String KEY_REMINDERS = "reminders"; + private static final String KEY_EVENTS = "events"; + private static final String KEY_MESSAGES = "messages"; + private static final String KEY_CALLS = "calls"; + private static final String KEY_STARRED = "starred"; + + private boolean mDisableListeners; + private SwitchPreference mReminders; + private SwitchPreference mEvents; + private SwitchPreference mMessages; + private SwitchPreference mCalls; + private DropDownPreference mStarred; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.zen_mode_priority_settings); + final PreferenceScreen root = getPreferenceScreen(); + + mReminders = (SwitchPreference) root.findPreference(KEY_REMINDERS); + mReminders.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (mDisableListeners) return true; + final boolean val = (Boolean) newValue; + if (val == mConfig.allowReminders) return true; + if (DEBUG) Log.d(TAG, "onPrefChange allowReminders=" + val); + final ZenModeConfig newConfig = mConfig.copy(); + newConfig.allowReminders = val; + return setZenModeConfig(newConfig); + } + }); + + mEvents = (SwitchPreference) root.findPreference(KEY_EVENTS); + mEvents.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (mDisableListeners) return true; + final boolean val = (Boolean) newValue; + if (val == mConfig.allowEvents) return true; + if (DEBUG) Log.d(TAG, "onPrefChange allowEvents=" + val); + final ZenModeConfig newConfig = mConfig.copy(); + newConfig.allowEvents = val; + return setZenModeConfig(newConfig); + } + }); + + mMessages = (SwitchPreference) root.findPreference(KEY_MESSAGES); + mMessages.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (mDisableListeners) return true; + final boolean val = (Boolean) newValue; + if (val == mConfig.allowMessages) return true; + if (DEBUG) Log.d(TAG, "onPrefChange allowMessages=" + val); + final ZenModeConfig newConfig = mConfig.copy(); + newConfig.allowMessages = val; + return setZenModeConfig(newConfig); + } + }); + + mCalls = (SwitchPreference) root.findPreference(KEY_CALLS); + mCalls.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (mDisableListeners) return true; + final boolean val = (Boolean) newValue; + if (val == mConfig.allowCalls) return true; + if (DEBUG) Log.d(TAG, "onPrefChange allowCalls=" + val); + final ZenModeConfig newConfig = mConfig.copy(); + newConfig.allowCalls = val; + return setZenModeConfig(newConfig); + } + }); + + mStarred = (DropDownPreference) root.findPreference(KEY_STARRED); + mStarred.addItem(R.string.zen_mode_from_anyone, ZenModeConfig.SOURCE_ANYONE); + mStarred.addItem(R.string.zen_mode_from_contacts, ZenModeConfig.SOURCE_CONTACT); + mStarred.addItem(R.string.zen_mode_from_starred, ZenModeConfig.SOURCE_STAR); + mStarred.setCallback(new DropDownPreference.Callback() { + @Override + public boolean onItemSelected(int pos, Object newValue) { + if (mDisableListeners) return true; + final int val = (Integer) newValue; + if (val == mConfig.allowFrom) return true; + if (DEBUG) Log.d(TAG, "onPrefChange allowFrom=" + + ZenModeConfig.sourceToString(val)); + final ZenModeConfig newConfig = mConfig.copy(); + newConfig.allowFrom = val; + return setZenModeConfig(newConfig); + } + }); + + updateControls(); + } + + @Override + protected void onZenModeChanged() { + // don't care + } + + @Override + protected void updateControls() { + mDisableListeners = true; + if (mCalls != null) { + mCalls.setChecked(mConfig.allowCalls); + } + mMessages.setChecked(mConfig.allowMessages); + mStarred.setSelectedValue(mConfig.allowFrom); + mReminders.setChecked(mConfig.allowReminders); + mEvents.setChecked(mConfig.allowEvents); + updateStarredEnabled(); + mDisableListeners = false; + } + + @Override + protected int getMetricsCategory() { + return MetricsLogger.NOTIFICATION_ZEN_MODE_PRIORITY; + } + + private void updateStarredEnabled() { + mStarred.setEnabled(mConfig.allowCalls || mConfig.allowMessages); + } + +} diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java index 93e5c4a2c..053d2ef12 100644 --- a/src/com/android/settings/notification/ZenModeSettings.java +++ b/src/com/android/settings/notification/ZenModeSettings.java @@ -30,17 +30,12 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnDismissListener; import android.content.pm.PackageManager; import android.content.res.Resources; -import android.database.ContentObserver; -import android.net.Uri; import android.os.Bundle; -import android.os.Handler; import android.os.ServiceManager; import android.preference.Preference; -import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; -import android.preference.SwitchPreference; import android.provider.Settings.Global; import android.service.notification.Condition; import android.service.notification.ZenModeConfig; @@ -64,18 +59,9 @@ import java.util.Calendar; import java.util.List; import java.util.Objects; -public class ZenModeSettings extends SettingsPreferenceFragment implements Indexable { - private static final String TAG = "ZenModeSettings"; - private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - +public class ZenModeSettings extends ZenModeSettingsBase implements Indexable { private static final String KEY_ZEN_MODE = "zen_mode"; - private static final String KEY_IMPORTANT = "important"; - private static final String KEY_CALLS = "calls"; - private static final String KEY_MESSAGES = "messages"; - private static final String KEY_STARRED = "starred"; - private static final String KEY_EVENTS = "events"; - private static final String KEY_ALARM_INFO = "alarm_info"; - + private static final String KEY_PRIORITY_SETTINGS = "priority_settings"; private static final String KEY_DOWNTIME = "downtime"; private static final String KEY_DAYS = "days"; private static final String KEY_START_TIME = "start_time"; @@ -108,13 +94,8 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index private static SparseArray<String> allKeyTitles(Context context) { final SparseArray<String> rt = new SparseArray<String>(); - rt.put(R.string.zen_mode_important_category, KEY_IMPORTANT); - rt.put(R.string.zen_mode_calls, KEY_CALLS); rt.put(R.string.zen_mode_option_title, 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_events, KEY_EVENTS); - rt.put(R.string.zen_mode_alarm_info, KEY_ALARM_INFO); + rt.put(R.string.zen_mode_priority_settings_title, KEY_PRIORITY_SETTINGS); 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); @@ -125,18 +106,10 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index return rt; } - private final Handler mHandler = new Handler(); - private final SettingsObserver mSettingsObserver = new SettingsObserver(); - - private Context mContext; private PackageManager mPM; - private ZenModeConfig mConfig; private boolean mDisableListeners; - private SwitchPreference mCalls; - private SwitchPreference mMessages; - private DropDownPreference mStarred; - private SwitchPreference mEvents; private boolean mDowntimeSupported; + private Preference mPrioritySettings; private Preference mDays; private TimePickerPreference mStart; private TimePickerPreference mEnd; @@ -152,17 +125,18 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index } @Override + protected void onZenModeChanged() { + PREF_ZEN_MODE.update(mContext); + } + + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mContext = getActivity(); mPM = mContext.getPackageManager(); addPreferencesFromResource(R.xml.zen_mode_settings); final PreferenceScreen root = getPreferenceScreen(); - mConfig = getZenModeConfig(); - if (DEBUG) Log.d(TAG, "Loaded mConfig=" + mConfig); - PREF_ZEN_MODE.init(this); PREF_ZEN_MODE.setCallback(new SettingPrefWithCallback.Callback() { @Override @@ -173,69 +147,7 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index } }); - final PreferenceCategory important = - (PreferenceCategory) root.findPreference(KEY_IMPORTANT); - - mCalls = (SwitchPreference) important.findPreference(KEY_CALLS); - mCalls.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (mDisableListeners) return true; - final boolean val = (Boolean) newValue; - if (val == mConfig.allowCalls) return true; - if (DEBUG) Log.d(TAG, "onPrefChange allowCalls=" + val); - final ZenModeConfig newConfig = mConfig.copy(); - newConfig.allowCalls = val; - return setZenModeConfig(newConfig); - } - }); - - mMessages = (SwitchPreference) important.findPreference(KEY_MESSAGES); - mMessages.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (mDisableListeners) return true; - final boolean val = (Boolean) newValue; - if (val == mConfig.allowMessages) return true; - if (DEBUG) Log.d(TAG, "onPrefChange allowMessages=" + val); - final ZenModeConfig newConfig = mConfig.copy(); - newConfig.allowMessages = val; - return setZenModeConfig(newConfig); - } - }); - - mStarred = (DropDownPreference) important.findPreference(KEY_STARRED); - mStarred.addItem(R.string.zen_mode_from_anyone, ZenModeConfig.SOURCE_ANYONE); - mStarred.addItem(R.string.zen_mode_from_contacts, ZenModeConfig.SOURCE_CONTACT); - mStarred.addItem(R.string.zen_mode_from_starred, ZenModeConfig.SOURCE_STAR); - mStarred.setCallback(new DropDownPreference.Callback() { - @Override - public boolean onItemSelected(int pos, Object newValue) { - if (mDisableListeners) return true; - final int val = (Integer) newValue; - if (val == mConfig.allowFrom) return true; - if (DEBUG) Log.d(TAG, "onPrefChange allowFrom=" + - ZenModeConfig.sourceToString(val)); - final ZenModeConfig newConfig = mConfig.copy(); - newConfig.allowFrom = val; - return setZenModeConfig(newConfig); - } - }); - important.addPreference(mStarred); - - mEvents = (SwitchPreference) important.findPreference(KEY_EVENTS); - mEvents.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (mDisableListeners) return true; - final boolean val = (Boolean) newValue; - if (val == mConfig.allowEvents) return true; - if (DEBUG) Log.d(TAG, "onPrefChange allowEvents=" + val); - final ZenModeConfig newConfig = mConfig.copy(); - newConfig.allowEvents = val; - return setZenModeConfig(newConfig); - } - }); + mPrioritySettings = root.findPreference(KEY_PRIORITY_SETTINGS); final PreferenceCategory downtime = (PreferenceCategory) root.findPreference(KEY_DOWNTIME); mDowntimeSupported = isDowntimeSupported(mContext); @@ -406,15 +318,9 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index mEnd.setSummaryFormat(summaryFormat); } - private void updateControls() { + @Override + protected void updateControls() { mDisableListeners = true; - if (mCalls != null) { - mCalls.setChecked(mConfig.allowCalls); - } - mMessages.setChecked(mConfig.allowMessages); - mStarred.setSelectedValue(mConfig.allowFrom); - mEvents.setChecked(mConfig.allowEvents); - updateStarredEnabled(); if (mDowntimeSupported) { updateDays(); mStart.setTime(mConfig.sleepStartHour, mConfig.sleepStartMinute); @@ -424,10 +330,24 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index mDisableListeners = false; refreshAutomationSection(); updateEndSummary(); + updatePrioritySettingsSummary(); } - private void updateStarredEnabled() { - mStarred.setEnabled(mConfig.allowCalls || mConfig.allowMessages); + private void updatePrioritySettingsSummary() { + String s = getResources().getString(R.string.zen_mode_alarms); + s = appendLowercase(s, mConfig.allowReminders, R.string.zen_mode_reminders); + s = appendLowercase(s, mConfig.allowEvents, R.string.zen_mode_events); + s = appendLowercase(s, mConfig.allowCalls, R.string.zen_mode_calls); + s = appendLowercase(s, mConfig.allowMessages, R.string.zen_mode_messages); + mPrioritySettings.setSummary(s); + } + + private String appendLowercase(String s, boolean condition, int resId) { + if (condition) { + return getResources().getString(R.string.join_many_items_middle, s, + getResources().getString(resId).toLowerCase()); + } + return s; } private void refreshAutomationSection() { @@ -476,56 +396,6 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index } } - @Override - public void onResume() { - super.onResume(); - updateControls(); - mSettingsObserver.register(); - } - - @Override - public void onPause() { - super.onPause(); - mSettingsObserver.unregister(); - } - - private void updateZenModeConfig() { - final ZenModeConfig config = getZenModeConfig(); - if (Objects.equals(config, mConfig)) return; - mConfig = config; - if (DEBUG) Log.d(TAG, "updateZenModeConfig mConfig=" + mConfig); - updateControls(); - } - - private ZenModeConfig getZenModeConfig() { - final INotificationManager nm = INotificationManager.Stub.asInterface( - ServiceManager.getService(Context.NOTIFICATION_SERVICE)); - try { - return nm.getZenModeConfig(); - } catch (Exception e) { - Log.w(TAG, "Error calling NoMan", e); - return new ZenModeConfig(); - } - } - - private boolean setZenModeConfig(ZenModeConfig config) { - final INotificationManager nm = INotificationManager.Stub.asInterface( - ServiceManager.getService(Context.NOTIFICATION_SERVICE)); - try { - final boolean success = nm.setZenModeConfig(config); - if (success) { - mConfig = config; - if (DEBUG) Log.d(TAG, "Saved mConfig=" + mConfig); - updateEndSummary(); - updateStarredEnabled(); - } - return success; - } catch (Exception e) { - Log.w(TAG, "Error calling NoMan", e); - return false; - } - } - protected void putZenModeSetting(int value) { Global.putInt(getContentResolver(), Global.ZEN_MODE, value); } @@ -663,35 +533,6 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index } } - private final class SettingsObserver extends ContentObserver { - private final Uri ZEN_MODE_URI = Global.getUriFor(Global.ZEN_MODE); - private final Uri ZEN_MODE_CONFIG_ETAG_URI = Global.getUriFor(Global.ZEN_MODE_CONFIG_ETAG); - - public SettingsObserver() { - super(mHandler); - } - - public void register() { - getContentResolver().registerContentObserver(ZEN_MODE_URI, false, this); - getContentResolver().registerContentObserver(ZEN_MODE_CONFIG_ETAG_URI, false, this); - } - - public void unregister() { - getContentResolver().unregisterContentObserver(this); - } - - @Override - public void onChange(boolean selfChange, Uri uri) { - super.onChange(selfChange, uri); - if (ZEN_MODE_URI.equals(uri)) { - PREF_ZEN_MODE.update(mContext); - } - if (ZEN_MODE_CONFIG_ETAG_URI.equals(uri)) { - updateZenModeConfig(); - } - } - } - private static class TimePickerPreference extends Preference { private final Context mContext; diff --git a/src/com/android/settings/notification/ZenModeSettingsBase.java b/src/com/android/settings/notification/ZenModeSettingsBase.java new file mode 100644 index 000000000..d4369650e --- /dev/null +++ b/src/com/android/settings/notification/ZenModeSettingsBase.java @@ -0,0 +1,133 @@ +/* + * 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 android.app.INotificationManager; +import android.content.Context; +import android.database.ContentObserver; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.ServiceManager; +import android.provider.Settings.Global; +import android.service.notification.ZenModeConfig; +import android.util.Log; + +import com.android.settings.SettingsPreferenceFragment; + +import java.util.Objects; + +abstract public class ZenModeSettingsBase extends SettingsPreferenceFragment { + protected static final String TAG = "ZenModeSettings"; + protected static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); + + private final Handler mHandler = new Handler(); + private final SettingsObserver mSettingsObserver = new SettingsObserver(); + + protected Context mContext; + protected ZenModeConfig mConfig; + + abstract protected void onZenModeChanged(); + abstract protected void updateControls(); + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + mContext = getActivity(); + mConfig = getZenModeConfig(); + if (DEBUG) Log.d(TAG, "Loaded mConfig=" + mConfig); + } + + @Override + public void onResume() { + super.onResume(); + mConfig = getZenModeConfig(); + updateControls(); + mSettingsObserver.register(); + } + + @Override + public void onPause() { + super.onPause(); + mSettingsObserver.unregister(); + } + + protected boolean setZenModeConfig(ZenModeConfig config) { + final INotificationManager nm = INotificationManager.Stub.asInterface( + ServiceManager.getService(Context.NOTIFICATION_SERVICE)); + try { + final boolean success = nm.setZenModeConfig(config); + if (success) { + mConfig = config; + if (DEBUG) Log.d(TAG, "Saved mConfig=" + mConfig); + updateControls(); + } + return success; + } catch (Exception e) { + Log.w(TAG, "Error calling NoMan", e); + return false; + } + } + + private void updateZenModeConfig() { + final ZenModeConfig config = getZenModeConfig(); + if (Objects.equals(config, mConfig)) return; + mConfig = config; + if (DEBUG) Log.d(TAG, "updateZenModeConfig mConfig=" + mConfig); + updateControls(); + } + + private ZenModeConfig getZenModeConfig() { + final INotificationManager nm = INotificationManager.Stub.asInterface( + ServiceManager.getService(Context.NOTIFICATION_SERVICE)); + try { + return nm.getZenModeConfig(); + } catch (Exception e) { + Log.w(TAG, "Error calling NoMan", e); + return new ZenModeConfig(); + } + } + + private final class SettingsObserver extends ContentObserver { + private final Uri ZEN_MODE_URI = Global.getUriFor(Global.ZEN_MODE); + private final Uri ZEN_MODE_CONFIG_ETAG_URI = Global.getUriFor(Global.ZEN_MODE_CONFIG_ETAG); + + private SettingsObserver() { + super(mHandler); + } + + public void register() { + getContentResolver().registerContentObserver(ZEN_MODE_URI, false, this); + getContentResolver().registerContentObserver(ZEN_MODE_CONFIG_ETAG_URI, false, this); + } + + public void unregister() { + getContentResolver().unregisterContentObserver(this); + } + + @Override + public void onChange(boolean selfChange, Uri uri) { + super.onChange(selfChange, uri); + if (ZEN_MODE_URI.equals(uri)) { + onZenModeChanged(); + } + 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 c96ce09fe..e4e5d129a 100644 --- a/src/com/android/settings/search/Ranking.java +++ b/src/com/android/settings/search/Ranking.java @@ -42,6 +42,7 @@ import com.android.settings.location.ScanningSettings; import com.android.settings.net.DataUsageMeteredSettings; import com.android.settings.notification.NotificationSettings; import com.android.settings.notification.OtherSoundSettings; +import com.android.settings.notification.ZenModePrioritySettings; import com.android.settings.notification.ZenModeSettings; import com.android.settings.print.PrintSettingsFragment; import com.android.settings.sim.SimSettings; @@ -123,6 +124,7 @@ public final class Ranking { sRankMap.put(NotificationSettings.class.getName(), RANK_NOTIFICATIONS); sRankMap.put(OtherSoundSettings.class.getName(), RANK_NOTIFICATIONS); sRankMap.put(ZenModeSettings.class.getName(), RANK_NOTIFICATIONS); + sRankMap.put(ZenModePrioritySettings.class.getName(), RANK_NOTIFICATIONS); // Storage sRankMap.put(Memory.class.getName(), RANK_STORAGE); diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java index 102e0bf2a..d57a1f149 100644 --- a/src/com/android/settings/search/SearchIndexableResources.java +++ b/src/com/android/settings/search/SearchIndexableResources.java @@ -43,6 +43,7 @@ import com.android.settings.location.ScanningSettings; import com.android.settings.net.DataUsageMeteredSettings; import com.android.settings.notification.NotificationSettings; import com.android.settings.notification.OtherSoundSettings; +import com.android.settings.notification.ZenModePrioritySettings; import com.android.settings.notification.ZenModeSettings; import com.android.settings.print.PrintSettingsFragment; import com.android.settings.sim.SimSettings; @@ -162,6 +163,13 @@ public final class SearchIndexableResources { ZenModeSettings.class.getName(), R.drawable.ic_settings_notifications)); + sResMap.put(ZenModePrioritySettings.class.getName(), + new SearchIndexableResource( + Ranking.getRankForClassName(ZenModePrioritySettings.class.getName()), + R.xml.zen_mode_priority_settings, + ZenModePrioritySettings.class.getName(), + R.drawable.ic_settings_notifications)); + sResMap.put(Memory.class.getName(), new SearchIndexableResource( Ranking.getRankForClassName(Memory.class.getName()), |