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

Commit 50011ddc authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Protect against server crashes

In case of parceling errors

Test: atest
Fixes: 70181755
Change-Id: I18fe1421b2f6f28f6b8fff6001ea0d8d712fec7c
parent 374ba3fc
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;
        }

@@ -9010,6 +9010,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;
@@ -9017,7 +9018,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;
@@ -9064,6 +9066,9 @@ public class NotificationManagerService extends SystemService {
                        }
                    });
                }
            } catch (Exception e) {
                Slog.e(TAG, "Could not notify listeners for " + r.getKey(), e);
            }
        }

        /**