Merge "Fix NPE" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5846da7a7b
@@ -1419,8 +1419,10 @@ public class PreferencesHelper implements RankingConfig {
|
|||||||
conversation.setPkg(p.pkg);
|
conversation.setPkg(p.pkg);
|
||||||
conversation.setUid(p.uid);
|
conversation.setUid(p.uid);
|
||||||
conversation.setNotificationChannel(nc);
|
conversation.setNotificationChannel(nc);
|
||||||
conversation.setParentChannelLabel(
|
NotificationChannel parent = p.channels.get(nc.getParentChannelId());
|
||||||
p.channels.get(nc.getParentChannelId()).getName());
|
conversation.setParentChannelLabel(parent == null
|
||||||
|
? null
|
||||||
|
: parent.getName());
|
||||||
boolean blockedByGroup = false;
|
boolean blockedByGroup = false;
|
||||||
if (nc.getGroup() != null) {
|
if (nc.getGroup() != null) {
|
||||||
NotificationChannelGroup group = p.groups.get(nc.getGroup());
|
NotificationChannelGroup group = p.groups.get(nc.getGroup());
|
||||||
|
|||||||
@@ -3536,6 +3536,28 @@ public class PreferencesHelperTest extends UiServiceTestCase {
|
|||||||
assertFalse(conversationWrapperContainsChannel(convos, channel2));
|
assertFalse(conversationWrapperContainsChannel(convos, channel2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetConversations_parentDeleted() {
|
||||||
|
String convoId = "convo";
|
||||||
|
NotificationChannel messages =
|
||||||
|
new NotificationChannel("messages", "Messages", IMPORTANCE_DEFAULT);
|
||||||
|
mHelper.createNotificationChannel(PKG_O, UID_O, messages, true, false);
|
||||||
|
|
||||||
|
NotificationChannel channel =
|
||||||
|
new NotificationChannel("A person msgs", "messages from A", IMPORTANCE_DEFAULT);
|
||||||
|
channel.setConversationId(messages.getId(), convoId);
|
||||||
|
channel.setImportantConversation(true);
|
||||||
|
mHelper.createNotificationChannel(PKG_O, UID_O, channel, true, false);
|
||||||
|
|
||||||
|
mHelper.permanentlyDeleteNotificationChannel(PKG_O, UID_O, "messages");
|
||||||
|
|
||||||
|
List<ConversationChannelWrapper> convos =
|
||||||
|
mHelper.getConversations(IntArray.wrap(new int[] {0}), true);
|
||||||
|
|
||||||
|
assertEquals(1, convos.size());
|
||||||
|
assertTrue(conversationWrapperContainsChannel(convos, channel));
|
||||||
|
}
|
||||||
|
|
||||||
private boolean conversationWrapperContainsChannel(List<ConversationChannelWrapper> list,
|
private boolean conversationWrapperContainsChannel(List<ConversationChannelWrapper> list,
|
||||||
NotificationChannel expected) {
|
NotificationChannel expected) {
|
||||||
for (ConversationChannelWrapper ccw : list) {
|
for (ConversationChannelWrapper ccw : list) {
|
||||||
|
|||||||
Reference in New Issue
Block a user