mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-29 16:26:18 +02:00
Update Do Not Disturb support to allow priority notifications to break through.
This commit is contained in:
parent
df2300777d
commit
5a9d1e23f5
|
@ -255,6 +255,11 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNotificationPosted(StatusBarNotification sbn) {
|
public void onNotificationPosted(StatusBarNotification sbn) {
|
||||||
|
onNotificationPosted(sbn, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap) {
|
||||||
logNotification(sbn, true);
|
logNotification(sbn, true);
|
||||||
|
|
||||||
notificationStack.remove(sbn.getPackageName());
|
notificationStack.remove(sbn.getPackageName());
|
||||||
|
@ -269,17 +274,15 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
|
|
||||||
if (handleMediaSessionNotification(sbn)) return;
|
if (handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
switch (GBApplication.getGrantedInterruptionFilter()) {
|
|
||||||
case NotificationManager.INTERRUPTION_FILTER_ALARMS:
|
|
||||||
case NotificationManager.INTERRUPTION_FILTER_NONE:
|
|
||||||
return;
|
|
||||||
case NotificationManager.INTERRUPTION_FILTER_PRIORITY:
|
|
||||||
// FIXME: Handle Reminders and Events if they are enabled in Do Not Disturb
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
if (GBApplication.isRunningLollipopOrLater()) {
|
||||||
|
if (prefs.getBoolean("notification_filter", false) && rankingMap != null) {
|
||||||
|
// Handle priority notifications for Do Not Disturb
|
||||||
|
Ranking ranking = new Ranking();
|
||||||
|
if (rankingMap.getRanking(sbn.getKey(), ranking)) {
|
||||||
|
if (!ranking.matchesInterruptionFilter()) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (NotificationCompat.CATEGORY_CALL.equals(sbn.getNotification().category)
|
if (NotificationCompat.CATEGORY_CALL.equals(sbn.getNotification().category)
|
||||||
&& prefs.getBoolean("notification_support_voip_calls", false)
|
&& prefs.getBoolean("notification_support_voip_calls", false)
|
||||||
&& sbn.isOngoing()) {
|
&& sbn.isOngoing()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user