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

Commit 570c6a49 authored by Julia Reynolds's avatar Julia Reynolds Committed by android-build-merger
Browse files

Merge "Foreground service notis must be correctly formed." into oc-mr1-dev

am: f2c00946

Change-Id: Idf833e388c4c2959f56ffa00befdda4e4a71001e
parents 875ecb48 f2c00946
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -517,11 +517,14 @@ final class ServiceRecord extends Binder {
                            } catch (PackageManager.NameNotFoundException e) {
                            }
                        }
                        if (localForegroundNoti.getSmallIcon() == null) {
                        if (localForegroundNoti.getSmallIcon() == null
                                || nm.getNotificationChannel(localPackageName, appUid,
                                localForegroundNoti.getChannelId()) == null) {
                            // 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.
                            // Also every notification needs a channel.
                            throw new RuntimeException("invalid service notification: "
                                    + foregroundNoti);
                        }
+2 −0
Original line number Diff line number Diff line
@@ -17,8 +17,10 @@
package com.android.server.notification;

import android.app.Notification;
import android.app.NotificationChannel;

public interface NotificationManagerInternal {
    NotificationChannel getNotificationChannel(String pkg, int uid, String channelId);
    void enqueueNotification(String pkg, String basePkg, int callingUid, int callingPid,
            String tag, int id, Notification notification, int userId);

+6 −0
Original line number Diff line number Diff line
@@ -3372,6 +3372,12 @@ public class NotificationManagerService extends SystemService {
     * The private API only accessible to the system process.
     */
    private final NotificationManagerInternal mInternalService = new NotificationManagerInternal() {
        @Override
        public NotificationChannel getNotificationChannel(String pkg, int uid, String
                channelId) {
            return mRankingHelper.getNotificationChannel(pkg, uid, channelId, false);
        }

        @Override
        public void enqueueNotification(String pkg, String opPkg, int callingUid, int callingPid,
                String tag, int id, Notification notification, int userId) {