Merge "Prevent oem locked and default apps from being blocked"

This commit is contained in:
Julia Reynolds
2019-03-29 15:25:58 +00:00
committed by Android (Google) Code Review
2 changed files with 29 additions and 0 deletions

View File

@@ -317,6 +317,30 @@ public class NotificationPreferenceControllerTest {
assertTrue(mController.isChannelGroupBlockable());
}
@Test
public void testIsChannelBlockable_oemLocked() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = false;
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.isImportanceLockedByOEM()).thenReturn(true);
when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
mController.onResume(appRow, channel, null, null);
assertFalse(mController.isChannelBlockable());
}
@Test
public void testIsChannelBlockable_criticalDeviceFunction() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = false;
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.isImportanceLockedByCriticalDeviceFunction()).thenReturn(true);
when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
mController.onResume(appRow, channel, null, null);
assertFalse(mController.isChannelBlockable());
}
@Test
public void testIsChannelGroupBlockable_SystemNotBlockable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();