use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DescriptionPreferenceControllerTest method testIsAvailable_notIfChannelGroupBlocked.
@Test
public void testIsAvailable_notIfChannelGroupBlocked() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
mController.onResume(appRow, null, group, null);
assertFalse(mController.isAvailable());
}
use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HeaderPreferenceControllerTest method testGetLabel.
@Test
public void testGetLabel() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.label = "bananas";
mController.onResume(appRow, null, null, null);
assertEquals(appRow.label, mController.getLabel());
NotificationChannelGroup group = new NotificationChannelGroup("id", "name");
mController.onResume(appRow, null, group, null);
assertEquals(group.getName(), mController.getLabel());
NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
mController.onResume(appRow, channel, group, null);
assertEquals(channel.getName(), mController.getLabel());
NotificationChannel defaultChannel = new NotificationChannel(NotificationChannel.DEFAULT_CHANNEL_ID, "", IMPORTANCE_NONE);
mController.onResume(appRow, defaultChannel, null, null);
assertEquals(appRow.label, mController.getLabel());
}
use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ImportancePreferenceControllerTest method testIsAvailable_isGroupBlocked.
@Test
public void testIsAvailable_isGroupBlocked() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
when(group.isBlocked()).thenReturn(true);
mController.onResume(appRow, channel, group, null);
assertFalse(mController.isAvailable());
}
use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationPreferenceControllerTest method isAvailable.
@Test
public void isAvailable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
when(group.isBlocked()).thenReturn(false);
mController.onResume(appRow, channel, group, null);
assertTrue(mController.isAvailable());
}
use of android.app.NotificationChannelGroup in project Signal-Android by signalapp.
the class NotificationChannels method isMessagesChannelGroupEnabled.
/**
* Whether or not the notification category for messages is enabled. Note that even if it is,
* a user could have blocked the specific channel, or notifications overall, and it'd still be
* true. See {@link #isMessageChannelEnabled(Context)} and {@link #areNotificationsEnabled(Context)}.
*/
public static synchronized boolean isMessagesChannelGroupEnabled(@NonNull Context context) {
if (Build.VERSION.SDK_INT < 28) {
return true;
}
NotificationManager notificationManager = ServiceUtil.getNotificationManager(context);
NotificationChannelGroup group = notificationManager.getNotificationChannelGroup(CATEGORY_MESSAGES);
return group != null && !group.isBlocked();
}
Aggregations