1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-14 22:19:29 +01:00

Fix VoIP call handling during "Do Not Disturb" mode

Also honor notification blacklist for such calls.
This commit is contained in:
Dmitriy Bogdanov 2020-03-11 13:53:25 +04:00 committed by Gitea
parent 082c23b922
commit 94683a863d

View File

@ -253,15 +253,6 @@ public class NotificationListener extends NotificationListenerService {
notificationStack.remove(sbn.getPackageName());
notificationStack.add(sbn.getPackageName());
Prefs prefs = GBApplication.getPrefs();
if (GBApplication.isRunningLollipopOrLater()) {
if (NotificationCompat.CATEGORY_CALL.equals(sbn.getNotification().category)
&& prefs.getBoolean("notification_support_voip_calls", false)) {
handleCallNotification(sbn);
return;
}
}
if (shouldIgnoreNotifications()) return;
if (shouldIgnoreSource(sbn)) {
@ -271,14 +262,7 @@ public class NotificationListener extends NotificationListenerService {
if (handleMediaSessionNotification(sbn)) return;
if (shouldIgnoreNotification(sbn)) {
LOG.info("Ignoring notification");
return;
}
switch (GBApplication.getGrantedInterruptionFilter()) {
case NotificationManager.INTERRUPTION_FILTER_ALL:
break;
case NotificationManager.INTERRUPTION_FILTER_ALARMS:
case NotificationManager.INTERRUPTION_FILTER_NONE:
return;
@ -287,6 +271,20 @@ public class NotificationListener extends NotificationListenerService {
return;
}
Prefs prefs = GBApplication.getPrefs();
if (GBApplication.isRunningLollipopOrLater()) {
if (NotificationCompat.CATEGORY_CALL.equals(sbn.getNotification().category)
&& prefs.getBoolean("notification_support_voip_calls", false)) {
handleCallNotification(sbn);
return;
}
}
if (shouldIgnoreNotification(sbn)) {
LOG.info("Ignoring notification");
return;
}
String source = sbn.getPackageName().toLowerCase();
Notification notification = sbn.getNotification();
if (notificationOldRepeatPrevention.containsKey(source)) {
@ -672,6 +670,11 @@ public class NotificationListener extends NotificationListenerService {
notificationStack.remove(sbn.getPackageName());
if (shouldIgnoreNotifications()) return;
if (shouldIgnoreSource(sbn)) return;
if (handleMediaSessionNotification(sbn)) return;
if (GBApplication.isRunningLollipopOrLater()) {
if(Notification.CATEGORY_CALL.equals(sbn.getNotification().category)
&& activeCallPostTime == sbn.getPostTime()) {
@ -684,9 +687,6 @@ public class NotificationListener extends NotificationListenerService {
}
// FIXME: DISABLED for now
if (shouldIgnoreNotifications()) return;
if (shouldIgnoreSource(sbn)) return;
if (handleMediaSessionNotification(sbn)) return;
if (shouldIgnoreNotification(sbn)) return;
Prefs prefs = GBApplication.getPrefs();