Android 12: notification ID

pull/200/head
M66B 4 years ago
parent e11c2dd1f1
commit fc2dc9a5e5

@ -313,7 +313,7 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
ServiceSynchronize.eval(context, "outbox/drafts"); ServiceSynchronize.eval(context, "outbox/drafts");
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel("send:" + id, 1); nm.cancel("send:" + id, 10);
return message.id; return message.id;
} }

@ -207,7 +207,7 @@ class Core {
if (EntityOperation.HEADERS.equals(op.name) || if (EntityOperation.HEADERS.equals(op.name) ||
EntityOperation.RAW.equals(op.name)) EntityOperation.RAW.equals(op.name))
nm.cancel(op.name + ":" + op.message, 1); nm.cancel(op.name + ":" + op.message, 10);
if (!Objects.equals(folder.id, op.folder)) if (!Objects.equals(folder.id, op.folder))
throw new IllegalArgumentException("Invalid folder=" + folder.id + "/" + op.folder); throw new IllegalArgumentException("Invalid folder=" + folder.id + "/" + op.folder);
@ -628,7 +628,7 @@ class Core {
if (title != null) { if (title != null) {
NotificationCompat.Builder builder = NotificationCompat.Builder builder =
getNotificationError(context, "warning", title, ex); getNotificationError(context, "warning", title, ex);
nm.notify(op.name + ":" + op.message, 1, builder.build()); nm.notify(op.name + ":" + op.message, 10, builder.build());
} }
} else { } else {
@ -4075,7 +4075,7 @@ 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, "Notify cancel tag=" + tag + " id=" + id);
nm.cancel(tag, 1); nm.cancel(tag, 10);
data.groupNotifying.get(group).remove(id); data.groupNotifying.get(group).remove(id);
db.message().setMessageNotifying(Math.abs(id), 0); db.message().setMessageNotifying(Math.abs(id), 0);
@ -4084,7 +4084,7 @@ 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, "Notify cancel tag=" + tag);
nm.cancel(tag, 1); nm.cancel(tag, 10);
} }
for (Long id : add) { for (Long id : add) {
@ -4114,7 +4114,7 @@ class Core {
: " channel=" + notification.getChannelId()) + : " channel=" + notification.getChannelId()) +
" sort=" + notification.getSortKey()); " sort=" + notification.getSortKey());
try { try {
nm.notify(tag, 1, notification); nm.notify(tag, 10, notification);
// https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support // https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support
if (id == 0 && badge && Helper.isXiaomi()) if (id == 0 && badge && Helper.isXiaomi())
ShortcutBadger.applyNotification(context, notification, current); ShortcutBadger.applyNotification(context, notification, current);

@ -1266,8 +1266,8 @@ public class FragmentAccount extends FragmentBase {
if (!synchronize) { if (!synchronize) {
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel("receive:" + account.id, 1); nm.cancel("receive:" + account.id, 10);
nm.cancel("alert:" + account.id, 1); nm.cancel("alert:" + account.id, 10);
} }
args.putBoolean("saved", true); args.putBoolean("saved", true);

@ -917,7 +917,7 @@ public class FragmentFolders extends FragmentBase {
if (now - last > EXPORT_PROGRESS_INTERVAL) { if (now - last > EXPORT_PROGRESS_INTERVAL) {
last = now; last = now;
builder.setProgress(ids.size(), i, false); builder.setProgress(ids.size(), i, false);
nm.notify("export", 1, builder.build()); nm.notify("export", 10, builder.build());
} }
long id = ids.get(i); long id = ids.get(i);
@ -990,7 +990,7 @@ public class FragmentFolders extends FragmentBase {
Log.e(ex); Log.e(ex);
} }
} finally { } finally {
nm.cancel("export", 1); nm.cancel("export", 10);
} }
return null; return null;

@ -7546,7 +7546,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ServiceSynchronize.eval(context, "delete"); ServiceSynchronize.eval(context, "delete");
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel("send:" + id, 1); nm.cancel("send:" + id, 10);
return null; return null;
} }

@ -624,8 +624,8 @@ public class FragmentPop extends FragmentBase {
if (!synchronize) { if (!synchronize) {
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel("receive:" + account.id, 1); nm.cancel("receive:" + account.id, 10);
nm.cancel("alert:" + account.id, 1); nm.cancel("alert:" + account.id, 10);
} }
args.putBoolean("saved", true); args.putBoolean("saved", true);

@ -419,7 +419,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
try { try {
int tries_left = (unrecoverable ? 0 : RETRY_MAX - op.tries); int tries_left = (unrecoverable ? 0 : RETRY_MAX - op.tries);
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify("send:" + message.id, 1, getNotificationError( nm.notify("send:" + message.id, 10, getNotificationError(
MessageHelper.formatAddressesShort(message.to), ex, tries_left).build()); MessageHelper.formatAddressesShort(message.to), ex, tries_left).build());
} catch (Throwable ex1) { } catch (Throwable ex1) {
Log.w(ex1); Log.w(ex1);
@ -473,7 +473,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
} }
db.message().setMessageError(message.id, null); db.message().setMessageError(message.id, null);
nm.cancel("send:" + message.id, 1); nm.cancel("send:" + message.id, 10);
if (message.ui_snoozed == null) if (message.ui_snoozed == null)
EntityOperation.queue(this, message, EntityOperation.SEND); EntityOperation.queue(this, message, EntityOperation.SEND);
@ -735,7 +735,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
} }
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel("send:" + message.id, 1); nm.cancel("send:" + message.id, 10);
// Check sent message // Check sent message
if (sid != null) { if (sid != null) {

@ -1240,7 +1240,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
if (!ConnectionHelper.isMaxConnections(message)) if (!ConnectionHelper.isMaxConnections(message))
try { try {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify("alert:" + account.id, 1, nm.notify("alert:" + account.id, 10,
getNotificationAlert(account.name, message).build()); getNotificationAlert(account.name, message).build());
} catch (Throwable ex) { } catch (Throwable ex) {
Log.w(ex); Log.w(ex);
@ -1272,7 +1272,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
try { try {
state.setBackoff(2 * CONNECT_BACKOFF_ALARM_MAX * 60); state.setBackoff(2 * CONNECT_BACKOFF_ALARM_MAX * 60);
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify("receive:" + account.id, 1, nm.notify("receive:" + account.id, 10,
Core.getNotificationError(this, "error", account.name, ex) Core.getNotificationError(this, "error", account.name, ex)
.build()); .build());
} catch (Throwable ex1) { } catch (Throwable ex1) {
@ -1933,8 +1933,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
db.account().setAccountWarning(account.id, capIdle ? null : getString(R.string.title_no_idle)); db.account().setAccountWarning(account.id, capIdle ? null : getString(R.string.title_no_idle));
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel("receive:" + account.id, 1); nm.cancel("receive:" + account.id, 10);
nm.cancel("alert:" + account.id, 1); nm.cancel("alert:" + account.id, 10);
// Schedule keep alive alarm // Schedule keep alive alarm
Intent intent = new Intent(this, ServiceSynchronize.class); Intent intent = new Intent(this, ServiceSynchronize.class);
@ -1992,7 +1992,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
.format(account.last_connected)), ex); .format(account.last_connected)), ex);
try { try {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify("receive:" + account.id, 1, nm.notify("receive:" + account.id, 10,
Core.getNotificationError(this, "warning", account.name, warning) Core.getNotificationError(this, "warning", account.name, warning)
.build()); .build());
} catch (Throwable ex1) { } catch (Throwable ex1) {

@ -194,7 +194,7 @@ public class ServiceUI extends IntentService {
String tag = "unseen." + group + ":" + id; String tag = "unseen." + group + ":" + id;
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel(tag, 1); nm.cancel(tag, 10);
} }
private void onMove(long id, String folderType) { private void onMove(long id, String folderType) {

Loading…
Cancel
Save