Merge "Support (non-editable) display of DND with a filter != PRIORITY" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
c43be041f5
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE;
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY;
|
||||
import static android.service.notification.ZenPolicy.STATE_DISALLOW;
|
||||
|
||||
@@ -67,6 +68,26 @@ public final class InterruptionFilterPreferenceControllerTest {
|
||||
mController = new InterruptionFilterPreferenceController(mContext, "something", mBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_dnd_enabled() {
|
||||
TwoStatePreference preference = mock(TwoStatePreference.class);
|
||||
ZenMode dnd = TestModeBuilder.MANUAL_DND_ACTIVE;
|
||||
|
||||
mController.updateState(preference, dnd);
|
||||
|
||||
verify(preference).setEnabled(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_specialDnd_disabled() {
|
||||
TwoStatePreference preference = mock(TwoStatePreference.class);
|
||||
ZenMode specialDnd = TestModeBuilder.manualDnd(INTERRUPTION_FILTER_NONE, true);
|
||||
|
||||
mController.updateState(preference, specialDnd);
|
||||
|
||||
verify(preference).setEnabled(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_disabled() {
|
||||
TwoStatePreference preference = mock(TwoStatePreference.class);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE;
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY;
|
||||
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||
|
||||
@@ -149,6 +150,20 @@ public final class ZenModeAppsLinkPreferenceControllerTest {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_dnd_enabled() {
|
||||
ZenMode dnd = TestModeBuilder.MANUAL_DND_ACTIVE;
|
||||
mController.updateState(mPreference, dnd);
|
||||
assertThat(mPreference.isEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_specialDnd_disabled() {
|
||||
ZenMode specialDnd = TestModeBuilder.manualDnd(INTERRUPTION_FILTER_NONE, true);
|
||||
mController.updateState(mPreference, specialDnd);
|
||||
assertThat(mPreference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_disabled() {
|
||||
ZenMode zenMode = new TestModeBuilder()
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -63,6 +65,26 @@ public final class ZenModeDisplayLinkPreferenceControllerTest {
|
||||
mContext, "something", mBackend, mHelperBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_dnd_enabled() {
|
||||
Preference preference = mock(Preference.class);
|
||||
ZenMode dnd = TestModeBuilder.MANUAL_DND_ACTIVE;
|
||||
|
||||
mController.updateState(preference, dnd);
|
||||
|
||||
verify(preference).setEnabled(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_specialDnd_disabled() {
|
||||
Preference preference = mock(Preference.class);
|
||||
ZenMode specialDnd = TestModeBuilder.manualDnd(INTERRUPTION_FILTER_NONE, true);
|
||||
|
||||
mController.updateState(preference, specialDnd);
|
||||
|
||||
verify(preference).setEnabled(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_disabled() {
|
||||
Preference preference = mock(Preference.class);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import static android.service.notification.SystemZenRules.PACKAGE_ANDROID;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -77,6 +79,7 @@ public class ZenModeExitAtAlarmPreferenceControllerTest {
|
||||
scheduleInfo.exitAtAlarm = false;
|
||||
|
||||
ZenMode mode = new TestModeBuilder()
|
||||
.setPackage(PACKAGE_ANDROID)
|
||||
.setConditionId(ZenModeConfig.toScheduleConditionId(scheduleInfo))
|
||||
.build();
|
||||
|
||||
@@ -105,6 +108,7 @@ public class ZenModeExitAtAlarmPreferenceControllerTest {
|
||||
scheduleInfo.exitAtAlarm = true;
|
||||
|
||||
ZenMode mode = new TestModeBuilder()
|
||||
.setPackage(PACKAGE_ANDROID)
|
||||
.setConditionId(ZenModeConfig.toScheduleConditionId(scheduleInfo))
|
||||
.build();
|
||||
mPrefController.updateZenMode(preference, mode);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -61,6 +63,26 @@ public final class ZenModeOtherLinkPreferenceControllerTest {
|
||||
mContext, "something", mHelperBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_dnd_enabled() {
|
||||
CircularIconsPreference preference = mock(CircularIconsPreference.class);
|
||||
ZenMode dnd = TestModeBuilder.MANUAL_DND_ACTIVE;
|
||||
|
||||
mController.updateState(preference, dnd);
|
||||
|
||||
verify(preference).setEnabled(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_specialDnd_disabled() {
|
||||
CircularIconsPreference preference = mock(CircularIconsPreference.class);
|
||||
ZenMode specialDnd = TestModeBuilder.manualDnd(INTERRUPTION_FILTER_NONE, true);
|
||||
|
||||
mController.updateState(preference, specialDnd);
|
||||
|
||||
verify(preference).setEnabled(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_disabled() {
|
||||
CircularIconsPreference pref = mock(CircularIconsPreference.class);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE;
|
||||
import static android.service.notification.ZenPolicy.CONVERSATION_SENDERS_IMPORTANT;
|
||||
import static android.service.notification.ZenPolicy.PEOPLE_TYPE_ANYONE;
|
||||
import static android.service.notification.ZenPolicy.PEOPLE_TYPE_CONTACTS;
|
||||
@@ -116,6 +117,20 @@ public final class ZenModePeopleLinkPreferenceControllerTest {
|
||||
anyBoolean())).thenReturn(new ColorDrawable(Color.BLACK));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_dnd_enabled() {
|
||||
ZenMode dnd = TestModeBuilder.MANUAL_DND_ACTIVE;
|
||||
mController.updateState(mPreference, dnd);
|
||||
assertThat(mPreference.isEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_specialDnd_disabled() {
|
||||
ZenMode specialDnd = TestModeBuilder.manualDnd(INTERRUPTION_FILTER_NONE, true);
|
||||
mController.updateState(mPreference, specialDnd);
|
||||
assertThat(mPreference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_disabled() {
|
||||
ZenMode zenMode = new TestModeBuilder()
|
||||
|
||||
Reference in New Issue
Block a user