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

Commit 074f8320 authored by Steven Ng's avatar Steven Ng
Browse files

Filter out potential null widget item from recommended widgets

There is a likely a race condition which the recommended widgets
contain widget that have not been added to mAllWidgets. Instead
of introducing a lock mechanism, let's simply filter null widgets.

Test: manual

Bug: 183619699
Change-Id: Ia82778b8ac8c42265bdf6838e059f81022a0d4ef
parent 59230c3c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -224,6 +225,7 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
                .map(recommendedWidget -> allWidgetItems.get(
                        new ComponentKey(recommendedWidget.getTargetComponent(),
                                recommendedWidget.user)))
                .filter(Objects::nonNull)
                .collect(Collectors.toList());
    }