Limit notification group size early

To prevent looking up contact info
pull/156/head
M66B 6 years ago
parent f736f15fbb
commit 5eb67064dd

@ -112,7 +112,7 @@ import me.leolin.shortcutbadger.ShortcutBadger;
import static android.os.Process.THREAD_PRIORITY_BACKGROUND; import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
class Core { class Core {
private static final int MAX_NOTIFICATION_COUNT = 20; // per group private static final int MAX_NOTIFICATION_COUNT = 10; // per group
private static final int SYNC_BATCH_SIZE = 20; private static final int SYNC_BATCH_SIZE = 20;
private static final int DOWNLOAD_BATCH_SIZE = 20; private static final int DOWNLOAD_BATCH_SIZE = 20;
private static final long YIELD_DURATION = 200L; // milliseconds private static final long YIELD_DURATION = 200L; // milliseconds
@ -1741,6 +1741,8 @@ class Core {
groupNotifying.put(group, new ArrayList<Long>()); groupNotifying.put(group, new ArrayList<Long>());
} }
// This assumes the messages are properly ordered
if (groupMessages.get(group).size() < MAX_NOTIFICATION_COUNT)
groupMessages.get(group).add(message); groupMessages.get(group).add(message);
} }
@ -1760,7 +1762,6 @@ class Core {
Log.i("Notify existing=" + id); Log.i("Notify existing=" + id);
} else { } else {
remove.remove(-id); remove.remove(-id);
if (add.size() < MAX_NOTIFICATION_COUNT)
add.add(id); add.add(id);
Log.i("Notify adding=" + id); Log.i("Notify adding=" + id);
} }

Loading…
Cancel
Save