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

Commit b6ec17e3 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Don't iterate channel list in bgthread"

parents e9d44254 857dfe13
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre

    private RestrictedSwitchPreference mAllNotificationsToggle;
    private PreferenceCategory mPreferenceCategory;
    private final List<NotificationChannel> mChannels = new ArrayList<>();
    private List<NotificationChannel> mChannels = new ArrayList<>();

    public AppChannelsBypassingDndPreferenceController(
            Context context,
@@ -126,17 +126,18 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... unused) {
                List<NotificationChannel> newChannelList = new ArrayList<>();
                List<NotificationChannelGroup> mChannelGroupList = mBackend.getGroups(mAppRow.pkg,
                        mAppRow.uid).getList();
                mChannels.clear();
                for (NotificationChannelGroup channelGroup : mChannelGroupList) {
                    for (NotificationChannel channel : channelGroup.getChannels()) {
                        if (!isConversation(channel)) {
                            mChannels.add(channel);
                            newChannelList.add(channel);
                        }
                    }
                }
                Collections.sort(mChannels, CHANNEL_COMPARATOR);
                Collections.sort(newChannelList, CHANNEL_COMPARATOR);
                mChannels = newChannelList;
                return null;
            }