Search in sources :

Example 56 with NotificationChannelGroup

use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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, admin);
    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) RestrictedLockUtils(com.android.settingslib.RestrictedLockUtils) Test(org.junit.Test)

Example 57 with NotificationChannelGroup

use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NotificationPreferenceControllerTest method testIsChannelGroupBlockable_nonSystemBlockable.

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

Example 58 with NotificationChannelGroup

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());
}
Also used : NotificationChannelGroup(android.app.NotificationChannelGroup) Test(org.junit.Test)

Example 59 with NotificationChannelGroup

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());
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) Test(org.junit.Test)

Example 60 with NotificationChannelGroup

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());
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) 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