mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 02:46:50 +01:00
Fix VoIP call handling during "Do Not Disturb" mode
Also honor notification blacklist for such calls.
This commit is contained in:
parent
082c23b922
commit
94683a863d
@ -253,15 +253,6 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
notificationStack.remove(sbn.getPackageName());
|
notificationStack.remove(sbn.getPackageName());
|
||||||
notificationStack.add(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 (shouldIgnoreNotifications()) return;
|
||||||
|
|
||||||
if (shouldIgnoreSource(sbn)) {
|
if (shouldIgnoreSource(sbn)) {
|
||||||
@ -271,14 +262,7 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
|
|
||||||
if (handleMediaSessionNotification(sbn)) return;
|
if (handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
if (shouldIgnoreNotification(sbn)) {
|
|
||||||
LOG.info("Ignoring notification");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (GBApplication.getGrantedInterruptionFilter()) {
|
switch (GBApplication.getGrantedInterruptionFilter()) {
|
||||||
case NotificationManager.INTERRUPTION_FILTER_ALL:
|
|
||||||
break;
|
|
||||||
case NotificationManager.INTERRUPTION_FILTER_ALARMS:
|
case NotificationManager.INTERRUPTION_FILTER_ALARMS:
|
||||||
case NotificationManager.INTERRUPTION_FILTER_NONE:
|
case NotificationManager.INTERRUPTION_FILTER_NONE:
|
||||||
return;
|
return;
|
||||||
@ -287,6 +271,20 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
return;
|
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();
|
String source = sbn.getPackageName().toLowerCase();
|
||||||
Notification notification = sbn.getNotification();
|
Notification notification = sbn.getNotification();
|
||||||
if (notificationOldRepeatPrevention.containsKey(source)) {
|
if (notificationOldRepeatPrevention.containsKey(source)) {
|
||||||
@ -672,6 +670,11 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
|
|
||||||
notificationStack.remove(sbn.getPackageName());
|
notificationStack.remove(sbn.getPackageName());
|
||||||
|
|
||||||
|
if (shouldIgnoreNotifications()) return;
|
||||||
|
if (shouldIgnoreSource(sbn)) return;
|
||||||
|
|
||||||
|
if (handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
if (GBApplication.isRunningLollipopOrLater()) {
|
||||||
if(Notification.CATEGORY_CALL.equals(sbn.getNotification().category)
|
if(Notification.CATEGORY_CALL.equals(sbn.getNotification().category)
|
||||||
&& activeCallPostTime == sbn.getPostTime()) {
|
&& activeCallPostTime == sbn.getPostTime()) {
|
||||||
@ -684,9 +687,6 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
}
|
}
|
||||||
// FIXME: DISABLED for now
|
// FIXME: DISABLED for now
|
||||||
|
|
||||||
if (shouldIgnoreNotifications()) return;
|
|
||||||
if (shouldIgnoreSource(sbn)) return;
|
|
||||||
if (handleMediaSessionNotification(sbn)) return;
|
|
||||||
if (shouldIgnoreNotification(sbn)) return;
|
if (shouldIgnoreNotification(sbn)) return;
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
Loading…
Reference in New Issue
Block a user