Search in sources :

Example 16 with NotificationChannelGroup

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

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);
    when(group.isBlocked()).thenReturn(true);
    assertFalse(mController.isAvailable());
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) Test(org.junit.Test)

Example 17 with NotificationChannelGroup

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

the class AppNotificationSettingsTest method setUp.

@Before
public void setUp() throws Exception {
    mInstrumentation = InstrumentationRegistry.getInstrumentation();
    mTargetContext = mInstrumentation.getTargetContext();
    mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    mUiDevice.wakeUp();
    mUiDevice.executeShellCommand(WM_DISMISS_KEYGUARD_COMMAND);
    mNm = (NotificationManager) mTargetContext.getSystemService(Context.NOTIFICATION_SERVICE);
    mGroup1 = new NotificationChannelGroup(this.getClass().getName() + "1", "group1");
    mGroup2 = new NotificationChannelGroup(this.getClass().getName() + "2", "group2");
    mNm.createNotificationChannelGroup(mGroup1);
    mNm.createNotificationChannelGroup(mGroup2);
    mGroup1Channel1 = createChannel(mGroup1, this.getClass().getName() + "c1-1");
    mGroup1Channel2 = createChannel(mGroup1, this.getClass().getName() + "c1-2");
    mGroup2Channel1 = createChannel(mGroup2, this.getClass().getName() + "c2-1");
    mUngroupedChannel = createChannel(null, this.getClass().getName() + "c");
}
Also used : NotificationChannelGroup(android.app.NotificationChannelGroup) Before(org.junit.Before)

Example 18 with NotificationChannelGroup

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

the class NotificationChannelSliceTest method buildNotificationChannelGroups.

private ParceledListSlice<NotificationChannelGroup> buildNotificationChannelGroups(List<NotificationChannel> channels) {
    final NotificationChannelGroup notificationChannelGroup = new NotificationChannelGroup("group", "group");
    notificationChannelGroup.setBlocked(false);
    notificationChannelGroup.setChannels(channels);
    return new ParceledListSlice(Arrays.asList(notificationChannelGroup));
}
Also used : NotificationChannelGroup(android.app.NotificationChannelGroup) ParceledListSlice(android.content.pm.ParceledListSlice)

Example 19 with NotificationChannelGroup

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

the class DescriptionPreferenceControllerTest method testUpdateState_channelGroup.

@Test
public void testUpdateState_channelGroup() {
    NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
    NotificationChannelGroup group = mock(NotificationChannelGroup.class);
    when(group.getDescription()).thenReturn("something");
    mController.onResume(appRow, null, group, null);
    Preference pref = new Preference(RuntimeEnvironment.application);
    mController.updateState(pref);
    assertEquals("something", pref.getTitle());
    assertFalse(pref.isEnabled());
    assertFalse(pref.isSelectable());
}
Also used : NotificationChannelGroup(android.app.NotificationChannelGroup) Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 20 with NotificationChannelGroup

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

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

Aggregations

NotificationChannelGroup (android.app.NotificationChannelGroup)46 NotificationChannel (android.app.NotificationChannel)31 Test (org.junit.Test)20 TargetApi (android.annotation.TargetApi)8 Preference (android.support.v7.preference.Preference)6 PreferenceCategory (android.support.v7.preference.PreferenceCategory)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 ArrayList (java.util.ArrayList)4 Context (android.content.Context)2 Uri (android.net.Uri)2 RequiresApi (androidx.annotation.RequiresApi)2 Preference (androidx.preference.Preference)2 JSONObject (org.json.JSONObject)2 Application (android.app.Application)1