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

Commit 282add7b authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix issue #8401553: It's possible to startForeground()...

...with no visible Notification

Don't allow a 0 icon resource.

Change-Id: I52e93533e6c45c6027ff3c185060cd54d087d077
parent 5d122d96
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -368,6 +368,13 @@ class ServiceRecord extends Binder {
                        return;
                    }
                    try {
                        if (foregroundNoti.icon == 0) {
                            // Notifications whose icon is 0 are defined to not show
                            // a notification, silently ignoring it.  We don't want to
                            // just ignore it, we want to prevent the service from
                            // being foreground.
                            throw new RuntimeException("icon must be non-zero");
                        }
                        int[] outId = new int[1];
                        nm.enqueueNotificationInternal(localPackageName, localPackageName,
                                appUid, appPid, null, localForegroundId, localForegroundNoti,