diff --git a/res/values/strings.xml b/res/values/strings.xml
index 79faf9b013e..52bcdbfbee7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6824,10 +6824,10 @@
Add
- TURN ON NOW
+ Turn on now
- TURN OFF NOW
+ Turn off now
Do Not Disturb is on until %s
diff --git a/res/xml/zen_mode_behavior_settings.xml b/res/xml/zen_mode_behavior_settings.xml
index 31d429bb409..57bc4fd436d 100644
--- a/res/xml/zen_mode_behavior_settings.xml
+++ b/res/xml/zen_mode_behavior_settings.xml
@@ -61,7 +61,7 @@
+ android:title="@string/zen_mode_repeat_callers" />
diff --git a/src/com/android/settings/notification/ZenModeBehaviorSettings.java b/src/com/android/settings/notification/ZenModeBehaviorSettings.java
index bfa95a75703..e2e85f3b691 100644
--- a/src/com/android/settings/notification/ZenModeBehaviorSettings.java
+++ b/src/com/android/settings/notification/ZenModeBehaviorSettings.java
@@ -45,7 +45,9 @@ public class ZenModeBehaviorSettings extends ZenModeSettingsBase implements Inde
controllers.add(new ZenModeRemindersPreferenceController(context, lifecycle));
controllers.add(new ZenModeMessagesPreferenceController(context, lifecycle));
controllers.add(new ZenModeCallsPreferenceController(context, lifecycle));
- controllers.add(new ZenModeRepeatCallersPreferenceController(context, lifecycle));
+ controllers.add(new ZenModeRepeatCallersPreferenceController(context, lifecycle,
+ context.getResources().getInteger(com.android.internal.R.integer
+ .config_zen_repeat_callers_threshold)));
controllers.add(new ZenModeScreenOnPreferenceController(context, lifecycle));
controllers.add(new ZenModeScreenOffPreferenceController(context, lifecycle));
controllers.add(new ZenModeBehaviorFooterPreferenceController(context, lifecycle));
diff --git a/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceController.java b/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceController.java
index d5c0a007119..765d407df97 100644
--- a/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceController.java
+++ b/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceController.java
@@ -21,9 +21,11 @@ import android.content.Context;
import android.provider.Settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePreferenceController
@@ -31,8 +33,15 @@ public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePre
protected static final String KEY = "zen_mode_repeat_callers";
- public ZenModeRepeatCallersPreferenceController(Context context, Lifecycle lifecycle) {
+ private final ZenModeBackend mBackend;
+ private final int mRepeatCallersThreshold;
+
+ public ZenModeRepeatCallersPreferenceController(Context context, Lifecycle lifecycle,
+ int repeatCallersThreshold) {
super(context, KEY, lifecycle);
+
+ mRepeatCallersThreshold = repeatCallersThreshold;
+ mBackend = ZenModeBackend.getInstance(context);
}
@Override
@@ -45,12 +54,17 @@ public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePre
return true;
}
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ setRepeatCallerSummary(screen.findPreference(KEY));
+ }
+
@Override
public void updateState(Preference preference) {
super.updateState(preference);
SwitchPreference pref = (SwitchPreference) preference;
-
switch (getZenMode()) {
case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS:
case Settings.Global.ZEN_MODE_ALARMS:
@@ -84,4 +98,9 @@ public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePre
mBackend.saveSoundPolicy(Policy.PRIORITY_CATEGORY_REPEAT_CALLERS, allowRepeatCallers);
return true;
}
+
+ private void setRepeatCallerSummary(Preference preference) {
+ preference.setSummary(mContext.getString(R.string.zen_mode_repeat_callers_summary,
+ mRepeatCallersThreshold));
+ }
}
diff --git a/tests/robotests/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceControllerTest.java
index ba52ce2133f..a7ea4c917ad 100644
--- a/tests/robotests/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/ZenModeRepeatCallersPreferenceControllerTest.java
@@ -78,7 +78,8 @@ public class ZenModeRepeatCallersPreferenceControllerTest {
mContentResolver = RuntimeEnvironment.application.getContentResolver();
when(mNotificationManager.getNotificationPolicy()).thenReturn(mPolicy);
- mController = new ZenModeRepeatCallersPreferenceController(mContext, mock(Lifecycle.class));
+ mController = new ZenModeRepeatCallersPreferenceController(mContext, mock(Lifecycle.class),
+ 15);
ReflectionHelpers.setField(mController, "mBackend", mBackend);
when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(