diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0a6c309f69a..fd405242bff 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5060,46 +5060,52 @@
Sounds & Notifications
-
+
Media volume
-
+
Alarm volume
-
+
Ring volume
-
+
+ Notification volume
+
+
Do not disturb
-
+
When calls and notifications arrive
-
+
+ When notifications arrive
+
+
Ring
-
+
Vibrate instead of ringing
-
+
Don\'t ring or vibrate
-
+
Phone ringtone
-
+
Default notification ringtone
-
+
Vibrate when ringing
-
+
Showing notifications
-
+
Pulse notification light
-
+
When device is locked
Don\'t show notifications at all
-
+
When do not disturb is on
@@ -5125,25 +5131,25 @@
Show all notifications in the list
-
+
App notifications
-
+
Touch sounds
-
+
Dial pad tones
-
+
Screen locking & unlocking
-
+
Other touch sounds
-
+
Vibrate on touch
-
+
Notification access
diff --git a/res/xml/notification_settings.xml b/res/xml/notification_settings.xml
index 633c1330694..865138fbc3c 100644
--- a/res/xml/notification_settings.xml
+++ b/res/xml/notification_settings.xml
@@ -37,6 +37,12 @@
android:icon="@*android:drawable/ic_audio_ring_notif"
android:title="@string/ring_volume_option_title" />
+
+
+
getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.notification_settings;
+ return Arrays.asList(sir);
+ }
+
+ public List getNonIndexableKeys(Context context) {
+ final ArrayList rt = new ArrayList();
+ if (Utils.isVoiceCapable(context)) {
+ rt.add(KEY_NOTIFICATION_VOLUME);
+ } else {
+ rt.add(KEY_RING_VOLUME);
+ rt.add(KEY_PHONE_RINGTONE);
+ rt.add(KEY_VIBRATE_WHEN_RINGING);
+ }
+ return rt;
+ }
+ };
}
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index b5651f40eab..8a66d1b29bd 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -55,6 +55,7 @@ import android.widget.TimePicker;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
@@ -83,12 +84,12 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index
private static final String KEY_ENTRY = "entry";
private static final String KEY_CONDITION_PROVIDERS = "manage_condition_providers";
- private static final SparseArray ALL_KEY_TITLES = allKeyTitles();
-
- private static SparseArray allKeyTitles() {
+ private static SparseArray allKeyTitles(Context context) {
final SparseArray rt = new SparseArray();
rt.put(R.string.zen_mode_general_category, KEY_GENERAL);
- rt.put(R.string.zen_mode_phone_calls, KEY_CALLS);
+ if (Utils.isVoiceCapable(context)) {
+ rt.put(R.string.zen_mode_phone_calls, KEY_CALLS);
+ }
rt.put(R.string.zen_mode_messages, KEY_MESSAGES);
rt.put(R.string.zen_mode_automatic_category, KEY_AUTOMATIC);
rt.put(R.string.zen_mode_when, KEY_WHEN);
@@ -159,21 +160,26 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index
final PreferenceCategory general = (PreferenceCategory) root.findPreference(KEY_GENERAL);
- 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);
- }
- });
+ mCalls = (SwitchPreference) general.findPreference(KEY_CALLS);
+ if (Utils.isVoiceCapable(mContext)) {
+ 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);
+ }
+ });
+ } else {
+ general.removePreference(mCalls);
+ mCalls = null;
+ }
- mMessages = (SwitchPreference) root.findPreference(KEY_MESSAGES);
+ mMessages = (SwitchPreference) general.findPreference(KEY_MESSAGES);
mMessages.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -307,7 +313,9 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index
private void updateControls() {
mDisableListeners = true;
- mCalls.setChecked(mConfig.allowCalls);
+ if (mCalls != null) {
+ mCalls.setChecked(mConfig.allowCalls);
+ }
mMessages.setChecked(mConfig.allowMessages);
mStarred.setSelectedItem(0);
mWhen.setSelectedValue(mConfig.sleepMode);
@@ -470,18 +478,27 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index
new BaseSearchIndexProvider() {
@Override
public List getRawDataToIndex(Context context, boolean enabled) {
- final int N = ALL_KEY_TITLES.size();
+ final SparseArray keyTitles = allKeyTitles(context);
+ final int N = keyTitles.size();
final List result = new ArrayList(N);
final Resources res = context.getResources();
for (int i = 0; i < N; i++) {
final SearchIndexableRaw data = new SearchIndexableRaw(context);
- data.key = ALL_KEY_TITLES.valueAt(i);
- data.title = res.getString(ALL_KEY_TITLES.keyAt(i));
+ 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;
}
+
+ public List getNonIndexableKeys(Context context) {
+ final ArrayList rt = new ArrayList();
+ if (!Utils.isVoiceCapable(context)) {
+ rt.add(KEY_CALLS);
+ }
+ return rt;
+ }
};
private final class SettingsObserver extends ContentObserver {
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index 7b87be26bca..0c8616d6ef9 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -135,7 +135,7 @@ public final class SearchIndexableResources {
sResMap.put(NotificationSettings.class.getName(),
new SearchIndexableResource(RANK_NOTIFICATIONS,
- R.xml.notification_settings,
+ NO_DATA_RES_ID,
NotificationSettings.class.getName(),
R.drawable.ic_settings_notifications));