Added notification log type

pull/204/head
M66B 4 years ago
parent 0b3b3e6d2a
commit e1557dc040

@ -4190,7 +4190,9 @@ class Core {
for (Long id : remove) { for (Long id : remove) {
String tag = "unseen." + group + "." + Math.abs(id); String tag = "unseen." + group + "." + Math.abs(id);
EntityLog.log(context, "Notify cancel tag=" + tag + " id=" + id); EntityLog.log(context, EntityLog.Type.Notification,
null, null, id == 0 ? null : Math.abs(id),
"Notify cancel tag=" + tag + " id=" + id);
nm.cancel(tag, NotificationHelper.NOTIFICATION_TAGGED); nm.cancel(tag, NotificationHelper.NOTIFICATION_TAGGED);
data.groupNotifying.get(group).remove(id); data.groupNotifying.get(group).remove(id);
@ -4199,7 +4201,8 @@ class Core {
if (notifications.size() == 0) { if (notifications.size() == 0) {
String tag = "unseen." + group + "." + 0; String tag = "unseen." + group + "." + 0;
EntityLog.log(context, "Notify cancel tag=" + tag); EntityLog.log(context, EntityLog.Type.Notification,
"Notify cancel tag=" + tag);
nm.cancel(tag, NotificationHelper.NOTIFICATION_TAGGED); nm.cancel(tag, NotificationHelper.NOTIFICATION_TAGGED);
} }
@ -4223,12 +4226,14 @@ class Core {
String tag = "unseen." + group + "." + Math.abs(id); String tag = "unseen." + group + "." + Math.abs(id);
Notification notification = builder.build(); Notification notification = builder.build();
EntityLog.log(context, "Notifying tag=" + tag + EntityLog.log(context, EntityLog.Type.Notification,
" id=" + id + " group=" + notification.getGroup() + null, null, id == 0 ? null : Math.abs(id),
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O "Notifying tag=" + tag +
? " sdk=" + Build.VERSION.SDK_INT " id=" + id + " group=" + notification.getGroup() +
: " channel=" + notification.getChannelId()) + (Build.VERSION.SDK_INT < Build.VERSION_CODES.O
" sort=" + notification.getSortKey()); ? " sdk=" + Build.VERSION.SDK_INT
: " channel=" + notification.getChannelId()) +
" sort=" + notification.getSortKey());
try { try {
nm.notify(tag, NotificationHelper.NOTIFICATION_TAGGED, notification); nm.notify(tag, NotificationHelper.NOTIFICATION_TAGGED, notification);
// https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support // https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support
@ -5266,7 +5271,8 @@ class Core {
groupNotifying.put(group, new ArrayList<>()); groupNotifying.put(group, new ArrayList<>());
if (id > 0) { if (id > 0) {
EntityLog.log(context, "Notify restore " + tag + " id=" + id); EntityLog.log(context, null, null, null, id,
"Notify restore " + tag + " id=" + id);
groupNotifying.get(group).add(id); groupNotifying.get(group).add(id);
} }
} }

@ -62,7 +62,7 @@ public class EntityLog {
@NonNull @NonNull
public String data; public String data;
enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification} enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification, Notification}
private static final ExecutorService executor = private static final ExecutorService executor =
Helper.getBackgroundExecutor(1, "log"); Helper.getBackgroundExecutor(1, "log");

Loading…
Cancel
Save