diff --git a/res/values/strings.xml b/res/values/strings.xml index 2bd821b721d..6c8ab0c57a5 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7931,6 +7931,9 @@ Calls + + Allow calls + When Do Not Disturb is on, incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you. @@ -7946,6 +7949,9 @@ Messages + + Allow messages + Messages @@ -7985,9 +7991,15 @@ Reminders + + Allow reminders + Events + + Allow events + anyone @@ -8000,8 +8012,11 @@ Repeat callers + + Allow repeat callers + - From %1$s only + From %1$s From %1$s and %2$s diff --git a/res/xml/zen_mode_calls_settings.xml b/res/xml/zen_mode_calls_settings.xml index dd6fcc50c0b..2da022c56a1 100644 --- a/res/xml/zen_mode_calls_settings.xml +++ b/res/xml/zen_mode_calls_settings.xml @@ -26,7 +26,7 @@ @@ -37,7 +37,7 @@ + android:title="@string/zen_mode_repeat_callers_title" /> diff --git a/res/xml/zen_mode_msg_event_reminder_settings.xml b/res/xml/zen_mode_msg_event_reminder_settings.xml index d12fc624461..8fc6b4717be 100644 --- a/res/xml/zen_mode_msg_event_reminder_settings.xml +++ b/res/xml/zen_mode_msg_event_reminder_settings.xml @@ -26,7 +26,7 @@ @@ -37,12 +37,12 @@ + android:title="@string/zen_mode_reminders_title"/> + android:title="@string/zen_mode_events_title"/> diff --git a/src/com/android/settings/notification/ZenModeRestrictNotificationsSettings.java b/src/com/android/settings/notification/ZenModeRestrictNotificationsSettings.java index a2a0ba7f008..737c646f929 100644 --- a/src/com/android/settings/notification/ZenModeRestrictNotificationsSettings.java +++ b/src/com/android/settings/notification/ZenModeRestrictNotificationsSettings.java @@ -16,22 +16,15 @@ package com.android.settings.notification; -import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_ZEN_SHOW_CUSTOM; - import android.content.Context; import android.os.Bundle; import android.provider.SearchIndexableResource; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settings.R; -import com.android.settings.overlay.FeatureFactory; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; import com.android.settingslib.core.AbstractPreferenceController; -import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.FooterPreference; @@ -42,67 +35,21 @@ import java.util.List; @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC) public class ZenModeRestrictNotificationsSettings extends ZenModeSettingsBase implements Indexable { - protected static final int APP_MENU_SHOW_CUSTOM = 1; - protected boolean mShowMenuSelected; - @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); } - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - menu.add(0, APP_MENU_SHOW_CUSTOM, 0, R.string.zen_mode_restrict_notifications_enable_custom) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - } - - @Override - public boolean onOptionsItemSelected(MenuItem menuItem) { - if (menuItem.getItemId() == APP_MENU_SHOW_CUSTOM) { - final FeatureFactory featureFactory = FeatureFactory.getFactory(mContext); - MetricsFeatureProvider metrics = featureFactory.getMetricsFeatureProvider(); - - mShowMenuSelected = !mShowMenuSelected; - - ZenModeVisEffectsCustomPreferenceController custom = - use(ZenModeVisEffectsCustomPreferenceController.class); - custom.setShownByMenu(mShowMenuSelected); - custom.displayPreference(getPreferenceScreen()); - - if (mShowMenuSelected) { - metrics.action(mContext, ACTION_ZEN_SHOW_CUSTOM, true); - } else { - metrics.action(mContext, ACTION_ZEN_SHOW_CUSTOM, false); - } - - return true; - } - return false; - } - - @Override - public void onPrepareOptionsMenu(Menu menu) { - if (mShowMenuSelected) { - menu.findItem(APP_MENU_SHOW_CUSTOM) - .setTitle(R.string.zen_mode_restrict_notifications_disable_custom); - } else { - menu.findItem(APP_MENU_SHOW_CUSTOM) - .setTitle(R.string.zen_mode_restrict_notifications_enable_custom); - } - - if (mShowMenuSelected && use(ZenModeVisEffectsCustomPreferenceController.class) - .areCustomOptionsSelected()) { - menu.findItem(APP_MENU_SHOW_CUSTOM).setEnabled(false); - } else { - menu.findItem(APP_MENU_SHOW_CUSTOM).setEnabled(true); - } - } - @Override protected List createPreferenceControllers(Context context) { return buildPreferenceControllers(context, getLifecycle()); } + @Override + public int getHelpResource() { + return R.string.help_uri_interruptions; + } + private static List buildPreferenceControllers(Context context, Lifecycle lifecycle) { List controllers = new ArrayList<>(); diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java index 3fb5a4b9be6..240ab68c93a 100644 --- a/src/com/android/settings/notification/ZenModeSettings.java +++ b/src/com/android/settings/notification/ZenModeSettings.java @@ -170,7 +170,7 @@ public class ZenModeSettings extends ZenModeSettingsBase { } else if (numCategories == 2) { return mContext.getString(R.string.join_two_items, enabledCategories.get(0), enabledCategories.get(1).toLowerCase()); - } else if (numCategories == 3) { + } else if (numCategories == 3){ final List summaries = new ArrayList<>(); summaries.add(enabledCategories.get(0)); summaries.add(enabledCategories.get(1).toLowerCase()); diff --git a/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceController.java b/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceController.java index 5baf0fac11d..5dd99f61568 100644 --- a/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceController.java +++ b/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceController.java @@ -30,7 +30,6 @@ import com.android.settingslib.core.lifecycle.Lifecycle; public class ZenModeVisEffectsCustomPreferenceController extends AbstractZenModePreferenceController { - protected boolean mShowMenuSelected; protected static final int INTERRUPTIVE_EFFECTS = Policy.SUPPRESSED_EFFECT_AMBIENT | Policy.SUPPRESSED_EFFECT_PEEK | Policy.SUPPRESSED_EFFECT_LIGHTS @@ -43,11 +42,7 @@ public class ZenModeVisEffectsCustomPreferenceController @Override public boolean isAvailable() { - if (mShowMenuSelected) { - return true; - } - - return areCustomOptionsSelected(); + return true; } @Override @@ -67,10 +62,6 @@ public class ZenModeVisEffectsCustomPreferenceController }); } - protected void setShownByMenu(boolean shown) { - mShowMenuSelected = shown; - } - protected boolean areCustomOptionsSelected() { boolean allEffectsSuppressed = Policy.areAllVisualEffectsSuppressed(mBackend.mPolicy.suppressedVisualEffects); diff --git a/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java b/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java index 5b2782fb6b7..39e9271fa2f 100644 --- a/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java +++ b/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java @@ -134,13 +134,13 @@ public class ZenModeSettingsTest { public void testGetCallsSettingSummary_contacts() { Policy policy = new Policy(Policy.PRIORITY_CATEGORY_ALARMS | Policy.PRIORITY_CATEGORY_CALLS, Policy.PRIORITY_SENDERS_CONTACTS, 0, 0); - assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("From contacts only"); + assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("From contacts"); } @Test public void testGetCallsSettingSummary_repeatCallers() { Policy policy = new Policy(Policy.PRIORITY_CATEGORY_REPEAT_CALLERS, 0, 0, 0); - assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("From repeat callers only"); + assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("From repeat callers"); } @Test diff --git a/tests/robotests/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceControllerTest.java index f3d92d17d21..45446229930 100644 --- a/tests/robotests/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/ZenModeVisEffectsCustomPreferenceControllerTest.java @@ -88,23 +88,14 @@ public class ZenModeVisEffectsCustomPreferenceControllerTest { } @Test - public void isAvailable_menuOff_noVisEffects() { + public void isAvailable_noVisEffects() { mBackend.mPolicy = new NotificationManager.Policy(0, 0, 0, 0); - mController.mShowMenuSelected = false; - assertThat(mController.isAvailable()).isFalse(); - } - - @Test - public void isAvailable_menuOn_noVisEffects() { - mBackend.mPolicy = new NotificationManager.Policy(0, 0, 0, 0); - mController.mShowMenuSelected = true; assertThat(mController.isAvailable()).isTrue(); } @Test - public void isAvailable_menuOn_visEffects() { + public void isAvailable_visEffects() { mBackend.mPolicy = new NotificationManager.Policy(0, 0, 0, 1); - mController.mShowMenuSelected = false; assertThat(mController.isAvailable()).isTrue(); }