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

Commit c936ea39 authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

Merge "Apply Zen Mode later, after we've found the old record." into lmp-preview-dev

parents a52c6877 52eba54e
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -1486,6 +1486,11 @@ public class NotificationManagerService extends SystemService {
                        pkg, opPkg, id, tag, callingUid, callingPid, score, notification,
                        user);
                NotificationRecord r = new NotificationRecord(n);
                NotificationRecord old = mNotificationsByKey.get(n.getKey());
                if (old != null) {
                    // Retain ranking information from previous record
                    r.copyRankingInformation(old);
                }
                if (!mSignalExtractors.isEmpty()) {
                    for (NotificationSignalExtractor extractor : mSignalExtractors) {
                        try {
@@ -1514,15 +1519,6 @@ public class NotificationManagerService extends SystemService {
                }

                synchronized (mNotificationList) {
                    applyZenModeLocked(r);

                    // Should this notification make noise, vibe, or use the LED?
                    final boolean canInterrupt = (score >= SCORE_INTERRUPTION_THRESHOLD) &&
                            !r.isIntercepted();
                    if (DBG || r.isIntercepted()) Slog.v(TAG,
                            "pkg=" + pkg + " canInterrupt=" + canInterrupt +
                                    " intercept=" + r.isIntercepted());
                    NotificationRecord old = null;
                    int index = indexOfNotificationLocked(n.getKey());
                    if (index < 0) {
                        mNotificationList.add(r);
@@ -1534,12 +1530,18 @@ public class NotificationManagerService extends SystemService {
                        // Make sure we don't lose the foreground service state.
                        notification.flags |=
                            old.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE;
                        // Retain ranking information from previous record
                        r.copyRankingInformation(old);
                        mNotificationsByKey.remove(old.sbn.getKey());
                    }
                    mNotificationsByKey.put(n.getKey(), r);

                    applyZenModeLocked(r);
                    // Should this notification make noise, vibe, or use the LED?
                    final boolean canInterrupt = (score >= SCORE_INTERRUPTION_THRESHOLD) &&
                            !r.isIntercepted();
                    if (DBG || r.isIntercepted()) Slog.v(TAG,
                            "pkg=" + pkg + " canInterrupt=" + canInterrupt +
                                    " intercept=" + r.isIntercepted());

                    Collections.sort(mNotificationList, mRankingComparator);

                    // Ensure if this is a foreground service that the proper additional