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

Commit 050ccb13 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Do not pulse when there's not text to show

Test: Send empty notification
Change-Id: I3770de3d8fbb6df5fb0c184bae4408105e752f23
parent 8750eebf
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -37,6 +38,7 @@ import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationStats;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.EventLog;
@@ -979,6 +981,16 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
            return false;
        }

        Bundle extras = sbn.getNotification().extras;
        CharSequence title = extras.getCharSequence(Notification.EXTRA_TITLE);
        CharSequence text = extras.getCharSequence(Notification.EXTRA_TEXT);
        if (TextUtils.isEmpty(title) && TextUtils.isEmpty(text)) {
            if (DEBUG) {
                Log.d(TAG, "No pulsing: title and text are empty: " + sbn.getKey());
            }
            return false;
        }

        return true;
    }