Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f93ee6ad authored by Amit Kumar's avatar Amit Kumar
Browse files

Prevent notification badges for ongoing and foreground notifications

parent c870f788
Loading
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
package org.indin.blisslaunchero.features.notification;

import android.app.Notification;
import android.service.notification.StatusBarNotification;
import android.util.Log;

import com.jakewharton.rxrelay2.BehaviorRelay;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.jakewharton.rxrelay2.BehaviorRelay;

import android.service.notification.StatusBarNotification;
import android.util.Log;

/**
 * Created by Amit Kumar
 * Email : mr.doc10jl96@gmail.com
@@ -37,6 +38,13 @@ public class NotificationRepository {
        Log.d(TAG, "updateNotification() called with: list = [" + list.size() + "]");
        Set<String> notificationSet = new HashSet<>();
        for (StatusBarNotification statusBarNotification : list) {
            Notification notification = statusBarNotification.getNotification();
            if ((notification.flags & Notification.FLAG_ONGOING_EVENT)
                    == Notification.FLAG_ONGOING_EVENT
                    || (notification.flags & Notification.FLAG_FOREGROUND_SERVICE)
                    == Notification.FLAG_FOREGROUND_SERVICE) {
                continue;
            }
            notificationSet.add(statusBarNotification.getPackageName());
        }
        this.notificationRelay.accept(notificationSet);