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

Commit f23b307b authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Protect against server crashes"

parents 82249e8f 50011ddc
Loading
Loading
Loading
Loading
+50 −45
Original line number Diff line number Diff line
@@ -5387,8 +5387,8 @@ public class NotificationManagerService extends SystemService {
        try {
            fixNotification(notification, pkg, tag, id, userId);

        } catch (NameNotFoundException e) {
            Slog.e(TAG, "Cannot create a context for sending app", e);
        } catch (Exception e) {
            Slog.e(TAG, "Cannot fix notification", e);
            return;
        }

@@ -9012,6 +9012,7 @@ public class NotificationManagerService extends SystemService {
        @GuardedBy("mNotificationLock")
        private void notifyPostedLocked(NotificationRecord r, NotificationRecord old,
                boolean notifyAllListeners) {
            try {
                // Lazily initialized snapshots of the notification.
                StatusBarNotification sbn = r.getSbn();
                StatusBarNotification oldSbn = (old != null) ? old.getSbn() : null;
@@ -9019,7 +9020,8 @@ public class NotificationManagerService extends SystemService {

                for (final ManagedServiceInfo info : getServices()) {
                    boolean sbnVisible = isVisibleToListener(sbn, info);
                boolean oldSbnVisible = oldSbn != null ? isVisibleToListener(oldSbn, info) : false;
                    boolean oldSbnVisible = oldSbn != null ? isVisibleToListener(oldSbn, info)
                            : false;
                    // This notification hasn't been and still isn't visible -> ignore.
                    if (!oldSbnVisible && !sbnVisible) {
                        continue;
@@ -9066,6 +9068,9 @@ public class NotificationManagerService extends SystemService {
                        }
                    });
                }
            } catch (Exception e) {
                Slog.e(TAG, "Could not notify listeners for " + r.getKey(), e);
            }
        }

        /**