Merge "Don't iterate channel list in bgthread"
This commit is contained in:
@@ -59,7 +59,7 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
|
|||||||
|
|
||||||
private RestrictedSwitchPreference mAllNotificationsToggle;
|
private RestrictedSwitchPreference mAllNotificationsToggle;
|
||||||
private PreferenceCategory mPreferenceCategory;
|
private PreferenceCategory mPreferenceCategory;
|
||||||
private final List<NotificationChannel> mChannels = new ArrayList<>();
|
private List<NotificationChannel> mChannels = new ArrayList<>();
|
||||||
|
|
||||||
public AppChannelsBypassingDndPreferenceController(
|
public AppChannelsBypassingDndPreferenceController(
|
||||||
Context context,
|
Context context,
|
||||||
@@ -126,17 +126,18 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
|
|||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... unused) {
|
protected Void doInBackground(Void... unused) {
|
||||||
|
List<NotificationChannel> newChannelList = new ArrayList<>();
|
||||||
List<NotificationChannelGroup> mChannelGroupList = mBackend.getGroups(mAppRow.pkg,
|
List<NotificationChannelGroup> mChannelGroupList = mBackend.getGroups(mAppRow.pkg,
|
||||||
mAppRow.uid).getList();
|
mAppRow.uid).getList();
|
||||||
mChannels.clear();
|
|
||||||
for (NotificationChannelGroup channelGroup : mChannelGroupList) {
|
for (NotificationChannelGroup channelGroup : mChannelGroupList) {
|
||||||
for (NotificationChannel channel : channelGroup.getChannels()) {
|
for (NotificationChannel channel : channelGroup.getChannels()) {
|
||||||
if (!isConversation(channel)) {
|
if (!isConversation(channel)) {
|
||||||
mChannels.add(channel);
|
newChannelList.add(channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(mChannels, CHANNEL_COMPARATOR);
|
Collections.sort(newChannelList, CHANNEL_COMPARATOR);
|
||||||
|
mChannels = newChannelList;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user