From 47047d4df8d7096fcfdd7dcb116b15cef3887d4b Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 15 Apr 2019 10:55:56 -0400 Subject: [PATCH] Show correct text for old zen modes When the device is in total silence or alarms only dnd modes, DND settings for messages and calls should say that no callers and no messages are allowed through. Test: atest Fixes: 130152926 Change-Id: I980dea46ef29e736ada41755bf0ea395c198f851 --- .../ZenModeCallsPreferenceController.java | 14 +++++++++++++- .../ZenModeMessagesPreferenceController.java | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/notification/ZenModeCallsPreferenceController.java b/src/com/android/settings/notification/ZenModeCallsPreferenceController.java index 0a8b931122f..d931f6c6fe2 100644 --- a/src/com/android/settings/notification/ZenModeCallsPreferenceController.java +++ b/src/com/android/settings/notification/ZenModeCallsPreferenceController.java @@ -16,7 +16,9 @@ package com.android.settings.notification; +import android.app.NotificationManager; import android.content.Context; +import android.provider.Settings; import androidx.preference.Preference; @@ -50,6 +52,16 @@ public class ZenModeCallsPreferenceController extends public void updateState(Preference preference) { super.updateState(preference); - preference.setSummary(mSummaryBuilder.getCallsSettingSummary(getPolicy())); + switch (getZenMode()) { + case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS: + case Settings.Global.ZEN_MODE_ALARMS: + preference.setEnabled(false); + preference.setSummary(mBackend.getAlarmsTotalSilenceCallsMessagesSummary( + NotificationManager.Policy.PRIORITY_CATEGORY_CALLS)); + break; + default: + preference.setEnabled(true); + preference.setSummary(mSummaryBuilder.getCallsSettingSummary(getPolicy())); + } } } diff --git a/src/com/android/settings/notification/ZenModeMessagesPreferenceController.java b/src/com/android/settings/notification/ZenModeMessagesPreferenceController.java index 2e41f205f58..d51be27a206 100644 --- a/src/com/android/settings/notification/ZenModeMessagesPreferenceController.java +++ b/src/com/android/settings/notification/ZenModeMessagesPreferenceController.java @@ -16,7 +16,9 @@ package com.android.settings.notification; +import android.app.NotificationManager; import android.content.Context; +import android.provider.Settings; import androidx.preference.Preference; @@ -49,6 +51,16 @@ public class ZenModeMessagesPreferenceController extends public void updateState(Preference preference) { super.updateState(preference); - preference.setSummary(mSummaryBuilder.getMessagesSettingSummary(getPolicy())); + switch (getZenMode()) { + case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS: + case Settings.Global.ZEN_MODE_ALARMS: + preference.setEnabled(false); + preference.setSummary(mBackend.getAlarmsTotalSilenceCallsMessagesSummary( + NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES)); + break; + default: + preference.setEnabled(true); + preference.setSummary(mSummaryBuilder.getMessagesSettingSummary(getPolicy())); + } } }