mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Improve exception stack traces in OptimizedMessageNotifier.
This commit is contained in:
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.LeakyBucketLimiter;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.concurrent.SignalExecutors;
|
||||
|
||||
/**
|
||||
@@ -51,26 +52,37 @@ public class OptimizedMessageNotifier implements MessageNotifier {
|
||||
|
||||
@Override
|
||||
public void updateNotification(@NonNull Context context) {
|
||||
limiter.run(() -> wrapped.updateNotification(context));
|
||||
runOnLimiter(() -> wrapped.updateNotification(context));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNotification(@NonNull Context context, long threadId) {
|
||||
limiter.run(() -> wrapped.updateNotification(context, threadId));
|
||||
runOnLimiter(() -> wrapped.updateNotification(context, threadId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNotification(@NonNull Context context, long threadId, boolean signal) {
|
||||
limiter.run(() -> wrapped.updateNotification(context, threadId, signal));
|
||||
runOnLimiter(() -> wrapped.updateNotification(context, threadId, signal));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNotification(@NonNull Context context, long threadId, boolean signal, int reminderCount) {
|
||||
limiter.run(() -> wrapped.updateNotification(context, threadId, signal, reminderCount));
|
||||
runOnLimiter(() -> wrapped.updateNotification(context, threadId, signal, reminderCount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearReminder(@NonNull Context context) {
|
||||
wrapped.clearReminder(context);
|
||||
}
|
||||
|
||||
private void runOnLimiter(@NonNull Runnable runnable) {
|
||||
Throwable prettyException = new Throwable();
|
||||
limiter.run(() -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (RuntimeException e) {
|
||||
throw Util.appendStackTrace(e, prettyException);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user