Update channel DND setting

... to reflect DND changes elsewhere in the system. Update the summary
and make the setting always available.

Test: make -j RunSettingsRoboTests
Change-Id: Ia51c349d863e1470e8a043293fa60f22632fa2df
Fixes: 76137346
This commit is contained in:
Julia Reynolds
2018-03-29 11:16:36 -04:00
parent 5506097efd
commit cb78269637
3 changed files with 9 additions and 50 deletions

View File

@@ -80,50 +80,19 @@ public class DndPreferenceControllerTest {
}
@Test
public void testNoCrashIfNoOnResume() {
mController.isAvailable();
mController.updateState(mock(RestrictedSwitchPreference.class));
mController.onPreferenceChange(mock(RestrictedSwitchPreference.class), true);
mController.onResume();
}
@Test
public void testIsAvailable_notIfNotImportant_noVisEffects() {
public void testIsAvailable_app() {
when(mNm.getNotificationPolicy()).thenReturn(new NotificationManager.Policy(0, 0, 0, 0));
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_LOW);
mController.onResume();
mController.onResume(appRow, channel, null, null);
mController.onResume(appRow, null, null, null);
assertFalse(mController.isAvailable());
}
@Test
public void testIsAvailable_notIfNotImportant_visEffects() {
public void testIsAvailable_channel() {
when(mNm.getNotificationPolicy()).thenReturn(new NotificationManager.Policy(0, 0, 0, 1));
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_MIN);
mController.onResume();
mController.onResume(appRow, channel, null, null);
assertFalse(mController.isAvailable());
}
@Test
public void testIsAvailable_importance_noVisEffects() {
when(mNm.getNotificationPolicy()).thenReturn(new NotificationManager.Policy(0, 0, 0, 0));
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_DEFAULT);
mController.onResume();
mController.onResume(appRow, channel, null, null);
assertTrue(mController.isAvailable());
}
@Test
public void testIsAvailable_important_visEffects() {
when(mNm.getNotificationPolicy()).thenReturn(new NotificationManager.Policy(0, 0, 0, 1));
assertTrue(mNm.getNotificationPolicy().suppressedVisualEffects != 0);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_LOW);
mController.onResume();
NotificationChannel channel =
new NotificationChannel(DEFAULT_CHANNEL_ID, "", IMPORTANCE_MIN);
mController.onResume(appRow, channel, null, null);
assertTrue(mController.isAvailable());
}