use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class AppBubbleListPreferenceControllerTest method clickConversationPref_updatesChannel.
@Test
public void clickConversationPref_updatesChannel() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.bubblePreference = BUBBLE_PREFERENCE_ALL;
appRow.pkg = "PKG";
mController.onResume(appRow, null, null, null, null, null, null);
mController.mPreference = new PreferenceCategory(mContext);
ConversationChannelWrapper ccw = mConvoList.getList().get(0);
AppBubbleListPreferenceController.ConversationPreference pref = (AppBubbleListPreferenceController.ConversationPreference) mController.createConversationPref(ccw);
pref.onClick(null);
verify(ccw.getNotificationChannel()).setAllowBubbles(DEFAULT_ALLOW_BUBBLE);
verify(mBackend).updateChannel(anyString(), anyInt(), any(NotificationChannel.class));
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class AppBubbleListPreferenceControllerTest method getConvo.
ConversationChannelWrapper getConvo(int bubbleChannelPref, String channelId) {
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getId()).thenReturn(channelId);
when(channel.getAllowBubbles()).thenReturn(bubbleChannelPref);
when(channel.canBubble()).thenReturn(bubbleChannelPref == 1);
ccw.setNotificationChannel(channel);
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setShortcutInfo(mock(ShortcutInfo.class));
return ccw;
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class AppBubbleListPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
ShadowApplication shadowApplication = ShadowApplication.getInstance();
shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
mContext = RuntimeEnvironment.application;
List<ConversationChannelWrapper> convoList = new ArrayList<>();
convoList.add(getConvo(-1, "default"));
convoList.add(getConvo(1, "selected"));
convoList.add(getConvo(0, "excluded"));
mConvoList = new ParceledListSlice<>(convoList);
when(mBackend.getConversations(anyString(), anyInt())).thenReturn(mConvoList);
mController = new AppBubbleListPreferenceController(mContext, mBackend);
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method testGetSubSettingLauncher.
@Test
public void testGetSubSettingLauncher() {
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
NotificationChannel channel = new NotificationChannel("a", "child", 2);
channel.setConversationId("parent", "convo id");
ccw.setNotificationChannel(channel);
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setParentChannelLabel("parent label");
Intent intent = mController.getSubSettingLauncher(ccw, "title").toIntent();
Bundle extras = intent.getExtras();
assertThat(extras.getString(AppInfoBase.ARG_PACKAGE_NAME)).isEqualTo(ccw.getPkg());
assertThat(extras.getInt(AppInfoBase.ARG_PACKAGE_UID)).isEqualTo(ccw.getUid());
assertThat(extras.getString(Settings.EXTRA_CHANNEL_ID)).isEqualTo(ccw.getNotificationChannel().getId());
assertThat(extras.getString(Settings.EXTRA_CONVERSATION_ID)).isEqualTo(ccw.getNotificationChannel().getConversationId());
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method getSummary_withGroup.
@Test
public void getSummary_withGroup() {
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
NotificationChannel channel = new NotificationChannel("a", "child", 2);
ccw.setNotificationChannel(channel);
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setShortcutInfo(mock(ShortcutInfo.class));
ccw.setGroupLabel("group");
ccw.setParentChannelLabel("parent");
assertThat(mController.getSummary(ccw).toString()).contains(ccw.getGroupLabel());
assertThat(mController.getSummary(ccw).toString()).contains(ccw.getParentChannelLabel());
}
Aggregations