Loading src/com/android/settings/notification/NotificationPreferenceController.java +5 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,11 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc return mChannel.getImportance() == IMPORTANCE_NONE; } if (mChannel.isImportanceLockedByOEM() || mChannel.isImportanceLockedByCriticalDeviceFunction()) { return false; } return mChannel.isBlockableSystem() || !mAppRow.systemApp || mChannel.getImportance() == IMPORTANCE_NONE; } Loading tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading
src/com/android/settings/notification/NotificationPreferenceController.java +5 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,11 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc return mChannel.getImportance() == IMPORTANCE_NONE; } if (mChannel.isImportanceLockedByOEM() || mChannel.isImportanceLockedByCriticalDeviceFunction()) { return false; } return mChannel.isBlockableSystem() || !mAppRow.systemApp || mChannel.getImportance() == IMPORTANCE_NONE; } Loading
tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading