Loading res/values/strings.xml +4 −4 Original line number Diff line number Diff line Loading @@ -8191,10 +8191,10 @@ other {{effect_1}, {effect_2}, and # more} } </string> <!-- Modes: setting for whether the mode should filter (silence/hide) notifications/volume streams --> <string name="mode_notification_filter_title">Limit what can notify you</string> <!-- Modes: subtext when a mode is not filtering (silence/hide) notifications/volume streams --> <string name="mode_no_notification_filter">No interruptions are filtered</string> <!-- Modes: setting for a mode to allow all notifications and sounds through --> <string name="zen_mode_allow_all_notifications">Allow all notifications</string> <!-- Modes: subtext when a mode is allowing all notifications and sounds (i.e. no filtering) --> <string name="zen_mode_all_notifications_allowed">People, apps, and sounds can interrupt</string> <!-- Do not disturb: restrict notifications settings title [CHAR LIMIT=80] --> <string name="zen_mode_restrict_notifications_title">Display options for filtered res/xml/modes_rule_settings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -59,8 +59,8 @@ android:key="modes_filters"> <SwitchPreferenceCompat android:key="allow_filtering" android:title="@string/mode_notification_filter_title"/> android:key="allow_all" android:title="@string/zen_mode_allow_all_notifications"/> <com.android.settings.notification.modes.CircularIconsPreference android:key="zen_mode_people" Loading src/com/android/settings/notification/modes/InterruptionFilterPreferenceController.java +11 −10 Original line number Diff line number Diff line Loading @@ -45,20 +45,21 @@ class InterruptionFilterPreferenceController extends AbstractZenModePreferenceCo @Override public void updateState(Preference preference, @NonNull ZenMode zenMode) { preference.setEnabled(zenMode.isEnabled()); boolean filteringNotifications = zenMode.getRule().getInterruptionFilter() != INTERRUPTION_FILTER_ALL; ((TwoStatePreference) preference).setChecked(filteringNotifications); preference.setSummary(filteringNotifications ? "" : mContext.getResources().getString(R.string.mode_no_notification_filter)); boolean allowingAll = zenMode.getRule().getInterruptionFilter() == INTERRUPTION_FILTER_ALL; ((TwoStatePreference) preference).setChecked(allowingAll); preference.setSummary(allowingAll ? mContext.getString(R.string.zen_mode_all_notifications_allowed) : ""); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { final boolean filterNotifications = ((Boolean) newValue); public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) { final boolean allowAll = ((Boolean) newValue); return saveMode(zenMode -> { zenMode.getRule().setInterruptionFilter(filterNotifications ? INTERRUPTION_FILTER_PRIORITY : INTERRUPTION_FILTER_ALL); zenMode.getRule().setInterruptionFilter(allowAll ? INTERRUPTION_FILTER_ALL : INTERRUPTION_FILTER_PRIORITY); return zenMode; }); } Loading src/com/android/settings/notification/modes/ZenModeFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class ZenModeFragment extends ZenModeFragmentBase { new ZenModeTriggerAddPreferenceController(context, "zen_add_automatic_trigger", this, mBackend)); prefControllers.add(new InterruptionFilterPreferenceController( context, "allow_filtering", mBackend)); context, "allow_all", mBackend)); prefControllers.add(new ManualDurationPreferenceController( context, "mode_manual_duration", this, mBackend)); return prefControllers; Loading tests/robotests/src/com/android/settings/notification/modes/InterruptionFilterPreferenceControllerTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public final class InterruptionFilterPreferenceControllerTest { .build(); mController.updateZenMode(preference, zenMode); verify(preference).setChecked(false); verify(preference).setChecked(true); } @Test Loading @@ -99,7 +99,7 @@ public final class InterruptionFilterPreferenceControllerTest { mController.updateZenMode(preference, zenMode); mController.onPreferenceChange(preference, true); mController.onPreferenceChange(preference, false); ArgumentCaptor<ZenMode> captor = ArgumentCaptor.forClass(ZenMode.class); verify(mBackend).updateMode(captor.capture()); Loading @@ -118,7 +118,7 @@ public final class InterruptionFilterPreferenceControllerTest { .build(); mController.updateZenMode(preference, zenMode); verify(preference).setChecked(true); verify(preference).setChecked(false); } @Test Loading @@ -131,7 +131,7 @@ public final class InterruptionFilterPreferenceControllerTest { mController.updateZenMode(preference, zenMode); mController.onPreferenceChange(preference, false); mController.onPreferenceChange(preference, true); ArgumentCaptor<ZenMode> captor = ArgumentCaptor.forClass(ZenMode.class); verify(mBackend).updateMode(captor.capture()); Loading Loading
res/values/strings.xml +4 −4 Original line number Diff line number Diff line Loading @@ -8191,10 +8191,10 @@ other {{effect_1}, {effect_2}, and # more} } </string> <!-- Modes: setting for whether the mode should filter (silence/hide) notifications/volume streams --> <string name="mode_notification_filter_title">Limit what can notify you</string> <!-- Modes: subtext when a mode is not filtering (silence/hide) notifications/volume streams --> <string name="mode_no_notification_filter">No interruptions are filtered</string> <!-- Modes: setting for a mode to allow all notifications and sounds through --> <string name="zen_mode_allow_all_notifications">Allow all notifications</string> <!-- Modes: subtext when a mode is allowing all notifications and sounds (i.e. no filtering) --> <string name="zen_mode_all_notifications_allowed">People, apps, and sounds can interrupt</string> <!-- Do not disturb: restrict notifications settings title [CHAR LIMIT=80] --> <string name="zen_mode_restrict_notifications_title">Display options for filtered
res/xml/modes_rule_settings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -59,8 +59,8 @@ android:key="modes_filters"> <SwitchPreferenceCompat android:key="allow_filtering" android:title="@string/mode_notification_filter_title"/> android:key="allow_all" android:title="@string/zen_mode_allow_all_notifications"/> <com.android.settings.notification.modes.CircularIconsPreference android:key="zen_mode_people" Loading
src/com/android/settings/notification/modes/InterruptionFilterPreferenceController.java +11 −10 Original line number Diff line number Diff line Loading @@ -45,20 +45,21 @@ class InterruptionFilterPreferenceController extends AbstractZenModePreferenceCo @Override public void updateState(Preference preference, @NonNull ZenMode zenMode) { preference.setEnabled(zenMode.isEnabled()); boolean filteringNotifications = zenMode.getRule().getInterruptionFilter() != INTERRUPTION_FILTER_ALL; ((TwoStatePreference) preference).setChecked(filteringNotifications); preference.setSummary(filteringNotifications ? "" : mContext.getResources().getString(R.string.mode_no_notification_filter)); boolean allowingAll = zenMode.getRule().getInterruptionFilter() == INTERRUPTION_FILTER_ALL; ((TwoStatePreference) preference).setChecked(allowingAll); preference.setSummary(allowingAll ? mContext.getString(R.string.zen_mode_all_notifications_allowed) : ""); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { final boolean filterNotifications = ((Boolean) newValue); public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) { final boolean allowAll = ((Boolean) newValue); return saveMode(zenMode -> { zenMode.getRule().setInterruptionFilter(filterNotifications ? INTERRUPTION_FILTER_PRIORITY : INTERRUPTION_FILTER_ALL); zenMode.getRule().setInterruptionFilter(allowAll ? INTERRUPTION_FILTER_ALL : INTERRUPTION_FILTER_PRIORITY); return zenMode; }); } Loading
src/com/android/settings/notification/modes/ZenModeFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class ZenModeFragment extends ZenModeFragmentBase { new ZenModeTriggerAddPreferenceController(context, "zen_add_automatic_trigger", this, mBackend)); prefControllers.add(new InterruptionFilterPreferenceController( context, "allow_filtering", mBackend)); context, "allow_all", mBackend)); prefControllers.add(new ManualDurationPreferenceController( context, "mode_manual_duration", this, mBackend)); return prefControllers; Loading
tests/robotests/src/com/android/settings/notification/modes/InterruptionFilterPreferenceControllerTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public final class InterruptionFilterPreferenceControllerTest { .build(); mController.updateZenMode(preference, zenMode); verify(preference).setChecked(false); verify(preference).setChecked(true); } @Test Loading @@ -99,7 +99,7 @@ public final class InterruptionFilterPreferenceControllerTest { mController.updateZenMode(preference, zenMode); mController.onPreferenceChange(preference, true); mController.onPreferenceChange(preference, false); ArgumentCaptor<ZenMode> captor = ArgumentCaptor.forClass(ZenMode.class); verify(mBackend).updateMode(captor.capture()); Loading @@ -118,7 +118,7 @@ public final class InterruptionFilterPreferenceControllerTest { .build(); mController.updateZenMode(preference, zenMode); verify(preference).setChecked(true); verify(preference).setChecked(false); } @Test Loading @@ -131,7 +131,7 @@ public final class InterruptionFilterPreferenceControllerTest { mController.updateZenMode(preference, zenMode); mController.onPreferenceChange(preference, false); mController.onPreferenceChange(preference, true); ArgumentCaptor<ZenMode> captor = ArgumentCaptor.forClass(ZenMode.class); verify(mBackend).updateMode(captor.capture()); Loading