From 9450d49b0b42de9e6e93babf544582c51c5a85fc Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 24 Feb 2021 10:35:33 +0100 Subject: [PATCH] do not vibrate when in DND mode --- .../conversations/services/NotificationService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index c478e4ccd..1d01b0bd9 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -399,6 +399,17 @@ public class NotificationService { public void startRinging(final AbstractJingleConnection.Id id, final Set media) { showIncomingCallNotification(id, media); + final NotificationManager notificationManager = (NotificationManager) mXmppConnectionService.getSystemService(Context.NOTIFICATION_SERVICE); + final int currentInterruptionFilter; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && notificationManager != null) { + currentInterruptionFilter = notificationManager.getCurrentInterruptionFilter(); + } else { + currentInterruptionFilter = 1; //INTERRUPTION_FILTER_ALL + } + if (currentInterruptionFilter != 1) { + Log.d(Config.LOGTAG,"do not ring or vibrate because interruption filter has been set to "+currentInterruptionFilter); + return; + } this.vibrationFuture = SCHEDULED_EXECUTOR_SERVICE.scheduleAtFixedRate( new VibrationRunnable(), 0,