Search in sources :

Example 76 with NotificationChannelGroup

use of android.app.NotificationChannelGroup in project android_packages_apps_Settings by omnirom.

the class DescriptionPreferenceControllerTest method testIsAvailable_channelGroup.

@Test
public void testIsAvailable_channelGroup() {
    NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
    NotificationChannelGroup group = mock(NotificationChannelGroup.class);
    when(group.getDescription()).thenReturn("something");
    when(group.isBlocked()).thenReturn(false);
    mController.onResume(appRow, null, group, null, null, null, null);
    assertTrue(mController.isAvailable());
}
Also used : NotificationChannelGroup(android.app.NotificationChannelGroup) NotificationBackend(com.android.settings.notification.NotificationBackend) Test(org.junit.Test)

Example 77 with NotificationChannelGroup

use of android.app.NotificationChannelGroup in project android_packages_apps_Settings by omnirom.

the class NotificationPreferenceControllerTest method testOnResume.

@Test
public void testOnResume() {
    NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
    NotificationChannel channel = mock(NotificationChannel.class);
    NotificationChannelGroup group = mock(NotificationChannelGroup.class);
    RestrictedLockUtils.EnforcedAdmin admin = mock(RestrictedLockUtils.EnforcedAdmin.class);
    mController.onResume(appRow, channel, group, null, null, admin, null);
    assertEquals(appRow, mController.mAppRow);
    assertEquals(channel, mController.mChannel);
    assertEquals(group, mController.mChannelGroup);
    assertEquals(admin, mController.mAdmin);
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) NotificationBackend(com.android.settings.notification.NotificationBackend) RestrictedLockUtils(com.android.settingslib.RestrictedLockUtils) Test(org.junit.Test)

Example 78 with NotificationChannelGroup

use of android.app.NotificationChannelGroup in project android_packages_apps_Settings by omnirom.

the class NotificationPreferenceControllerTest method isAvailable_notIfChannelGroupBlocked.

@Test
public void isAvailable_notIfChannelGroupBlocked() {
    NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
    NotificationChannel channel = mock(NotificationChannel.class);
    when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
    NotificationChannelGroup group = mock(NotificationChannelGroup.class);
    mController.onResume(appRow, channel, group, null, null, null, null);
    when(group.isBlocked()).thenReturn(true);
    assertFalse(mController.isAvailable());
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) NotificationBackend(com.android.settings.notification.NotificationBackend) Test(org.junit.Test)

Example 79 with NotificationChannelGroup

use of android.app.NotificationChannelGroup in project android_packages_apps_Settings by omnirom.

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, null, null, null);
    assertTrue(mController.isAvailable());
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) NotificationBackend(com.android.settings.notification.NotificationBackend) Test(org.junit.Test)

Example 80 with NotificationChannelGroup

use of android.app.NotificationChannelGroup in project android_packages_apps_Settings by omnirom.

the class NotificationPreferenceControllerTest method testIsChannelGroupBlockable_canUndoSystemBlock.

@Test
public void testIsChannelGroupBlockable_canUndoSystemBlock() {
    NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
    appRow.systemApp = true;
    NotificationChannelGroup group = mock(NotificationChannelGroup.class);
    when(group.isBlocked()).thenReturn(true);
    mController.onResume(appRow, null, group, null, null, null, null);
    assertTrue(mController.isChannelGroupBlockable());
}
Also used : NotificationChannelGroup(android.app.NotificationChannelGroup) NotificationBackend(com.android.settings.notification.NotificationBackend) Test(org.junit.Test)

Aggregations

NotificationChannelGroup (android.app.NotificationChannelGroup)80 NotificationChannel (android.app.NotificationChannel)54 Test (org.junit.Test)53 NotificationBackend (com.android.settings.notification.NotificationBackend)21 ArrayList (java.util.ArrayList)12 ConversationChannel (android.app.people.ConversationChannel)10 ShortcutInfo (android.content.pm.ShortcutInfo)10 PreferenceCategory (androidx.preference.PreferenceCategory)9 TargetApi (android.annotation.TargetApi)8 Preference (android.support.v7.preference.Preference)6 PreferenceCategory (android.support.v7.preference.PreferenceCategory)6 Preference (androidx.preference.Preference)6 LayoutPreference (com.android.settings.applications.LayoutPreference)6 MasterSwitchPreference (com.android.settings.widget.MasterSwitchPreference)6 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)6 FooterPreference (com.android.settingslib.widget.FooterPreference)6 NotificationManager (android.app.NotificationManager)5 Notification (android.app.Notification)4 AudioAttributes (android.media.AudioAttributes)4 PreferenceGroup (androidx.preference.PreferenceGroup)3