Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6fae6335 authored by Valentin Iftime's avatar Valentin Iftime
Browse files

Fix getConversations NPE

Fix NPE when getting conversations with deleted parent channel.

Flag: EXEMPT bugfix
Test: atest PreferencesHelperTest

Bug: 433748610
Change-Id: Ic2d40d63ef078f9222bc9e81d9ea9e9dacf55c9c
parent ca506fc7
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1927,8 +1927,10 @@ public class PreferencesHelper implements RankingConfig {
                    conversation.setPkg(r.pkg);
                    conversation.setUid(r.uid);
                    conversation.setNotificationChannel(nc);
                    conversation.setParentChannelLabel(
                            r.channels.get(nc.getParentChannelId()).getName());
                    NotificationChannel parent = r.channels.get(nc.getParentChannelId());
                    conversation.setParentChannelLabel(parent == null
                            ? null
                            : parent.getName());
                    boolean blockedByGroup = false;
                    if (nc.getGroup() != null) {
                        NotificationChannelGroup group = r.groups.get(nc.getGroup());
+5 −0
Original line number Diff line number Diff line
@@ -5495,6 +5495,11 @@ public class PreferencesHelperTest extends UiServiceTestCase {

        assertEquals(1, convos.size());
        assertTrue(conversationWrapperContainsChannel(convos, channel));

        // Also test the getConversations(pkg, uid) API
        List<ConversationChannelWrapper> convosByPkgUid = mHelper.getConversations(PKG_O, UID_O);
        assertEquals(1, convos.size());
        assertTrue(conversationWrapperContainsChannel(convos, channel));
    }

    private boolean conversationWrapperContainsChannel(List<ConversationChannelWrapper> list,