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

Commit e1a00e34 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch Committed by android-build-merger
Browse files

Merge "Ensure removeForegroundService checks both lists under lock" into oc-dev am: c4ca1b56

am: aa8dcf37

Change-Id: Ic9780a11f1c3d3bbcbd8c5be350176507c62c685
parents 79418b63 aa8dcf37
Loading
Loading
Loading
Loading
+26 −24
Original line number Diff line number Diff line
@@ -3071,17 +3071,22 @@ public class NotificationManagerService extends SystemService {
        public void removeForegroundServiceFlagFromNotification(String pkg, int notificationId,
                int userId) {
            checkCallerIsSystem();
            synchronized (mNotificationLock) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    synchronized (mNotificationLock) {
                        removeForegroundServiceFlagByListLocked(mEnqueuedNotifications, pkg, notificationId, userId);
                        removeForegroundServiceFlagByListLocked(mNotificationList, pkg, notificationId, userId);
                    }
                }
            });
        }

        private void removeForegroundServiceFlagByListLocked(
                ArrayList<NotificationRecord> notificationList, String pkg, int notificationId, int userId) {
            NotificationRecord r =
                                findNotificationLocked(pkg, null, notificationId, userId);
                    findNotificationByListLocked(notificationList, pkg, null, notificationId, userId);
            if (r == null) {
                            Log.d(TAG,
                                    "stripForegroundServiceFlag: Could not find notification with "
                                    + "pkg=" + pkg + " / id=" + notificationId
                                    + " / userId=" + userId);
                return;
            }
            StatusBarNotification sbn = r.sbn;
@@ -3095,9 +3100,6 @@ public class NotificationManagerService extends SystemService {
            mListeners.notifyPostedLocked(sbn, sbn /* oldSbn */);
            mGroupHelper.onNotificationPosted(sbn);
        }
                });
            }
        }
    };

    void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid,