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

Commit c2ce6f7c authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Annotate locks" into oc-dev am: 373ab721 am: 27c2b724"

parents f7bf933d 7d7bb779
Loading
Loading
Loading
Loading
+55 −14
Original line number Original line Diff line number Diff line
@@ -149,6 +149,7 @@ import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;
import android.widget.Toast;


import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.nano.MetricsProto;
@@ -688,6 +689,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    };
    };


    @GuardedBy("mNotificationLock")
    private void clearSoundLocked() {
    private void clearSoundLocked() {
        mSoundNotificationKey = null;
        mSoundNotificationKey = null;
        long identity = Binder.clearCallingIdentity();
        long identity = Binder.clearCallingIdentity();
@@ -702,6 +704,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mNotificationLock")
    private void clearVibrateLocked() {
    private void clearVibrateLocked() {
        mVibrateNotificationKey = null;
        mVibrateNotificationKey = null;
        long identity = Binder.clearCallingIdentity();
        long identity = Binder.clearCallingIdentity();
@@ -712,6 +715,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mNotificationLock")
    private void clearLightsLocked() {
    private void clearLightsLocked() {
        // light
        // light
        mLights.clear();
        mLights.clear();
@@ -1274,6 +1278,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mNotificationLock")
    private void updateListenerHintsLocked() {
    private void updateListenerHintsLocked() {
        final int hints = calculateHints();
        final int hints = calculateHints();
        if (hints == mListenerHints) return;
        if (hints == mListenerHints) return;
@@ -1282,6 +1287,7 @@ public class NotificationManagerService extends SystemService {
        scheduleListenerHintsChanged(hints);
        scheduleListenerHintsChanged(hints);
    }
    }


    @GuardedBy("mNotificationLock")
    private void updateEffectsSuppressorLocked() {
    private void updateEffectsSuppressorLocked() {
        final long updatedSuppressedEffects = calculateSuppressedEffects();
        final long updatedSuppressedEffects = calculateSuppressedEffects();
        if (updatedSuppressedEffects == mZenModeHelper.getSuppressedEffects()) return;
        if (updatedSuppressedEffects == mZenModeHelper.getSuppressedEffects()) return;
@@ -1416,6 +1422,7 @@ public class NotificationManagerService extends SystemService {
        return suppressedEffects;
        return suppressedEffects;
    }
    }


    @GuardedBy("mNotificationLock")
    private void updateInterruptionFilterLocked() {
    private void updateInterruptionFilterLocked() {
        int interruptionFilter = mZenModeHelper.getZenModeListenerInterruptionFilter();
        int interruptionFilter = mZenModeHelper.getZenModeListenerInterruptionFilter();
        if (interruptionFilter == mInterruptionFilter) return;
        if (interruptionFilter == mInterruptionFilter) return;
@@ -2074,6 +2081,7 @@ public class NotificationManagerService extends SystemService {
         *
         *
         * @param info The binder for the listener, to check that the caller is allowed
         * @param info The binder for the listener, to check that the caller is allowed
         */
         */
        @GuardedBy("mNotificationLock")
        private void cancelNotificationFromListenerLocked(ManagedServiceInfo info,
        private void cancelNotificationFromListenerLocked(ManagedServiceInfo info,
                int callingUid, int callingPid, String pkg, String tag, int id, int userId) {
                int callingUid, int callingPid, String pkg, String tag, int id, int userId) {
            cancelNotification(callingUid, callingPid, pkg, tag, id, 0,
            cancelNotification(callingUid, callingPid, pkg, tag, id, 0,
@@ -2770,6 +2778,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mNotificationLock")
    private void addAutogroupKeyLocked(String key) {
    private void addAutogroupKeyLocked(String key) {
        NotificationRecord n = mNotificationsByKey.get(key);
        NotificationRecord n = mNotificationsByKey.get(key);
        if (n == null) {
        if (n == null) {
@@ -2779,6 +2788,7 @@ public class NotificationManagerService extends SystemService {
        EventLogTags.writeNotificationAutogrouped(key);
        EventLogTags.writeNotificationAutogrouped(key);
    }
    }


    @GuardedBy("mNotificationLock")
    private void removeAutogroupKeyLocked(String key) {
    private void removeAutogroupKeyLocked(String key) {
        NotificationRecord n = mNotificationsByKey.get(key);
        NotificationRecord n = mNotificationsByKey.get(key);
        if (n == null) {
        if (n == null) {
@@ -2789,6 +2799,7 @@ public class NotificationManagerService extends SystemService {
    }
    }


    // Clears the 'fake' auto-group summary.
    // Clears the 'fake' auto-group summary.
    @GuardedBy("mNotificationLock")
    private void clearAutogroupSummaryLocked(int userId, String pkg) {
    private void clearAutogroupSummaryLocked(int userId, String pkg) {
        ArrayMap<String, String> summaries = mAutobundledSummaries.get(userId);
        ArrayMap<String, String> summaries = mAutobundledSummaries.get(userId);
        if (summaries != null && summaries.containsKey(pkg)) {
        if (summaries != null && summaries.containsKey(pkg)) {
@@ -3109,10 +3120,12 @@ public class NotificationManagerService extends SystemService {
            });
            });
        }
        }


        @GuardedBy("mNotificationLock")
        private void removeForegroundServiceFlagByListLocked(
        private void removeForegroundServiceFlagByListLocked(
                ArrayList<NotificationRecord> notificationList, String pkg, int notificationId, int userId) {
                ArrayList<NotificationRecord> notificationList, String pkg, int notificationId,
            NotificationRecord r =
                int userId) {
                    findNotificationByListLocked(notificationList, pkg, null, notificationId, userId);
            NotificationRecord r = findNotificationByListLocked(
                    notificationList, pkg, null, notificationId, userId);
            if (r == null) {
            if (r == null) {
                return;
                return;
            }
            }
@@ -3368,6 +3381,7 @@ public class NotificationManagerService extends SystemService {
            }
            }
        }
        }


        @GuardedBy("mNotificationLock")
        void snoozeLocked(NotificationRecord r) {
        void snoozeLocked(NotificationRecord r) {
            if (r.sbn.isGroup()) {
            if (r.sbn.isGroup()) {
                final List<NotificationRecord> groupNotifications = findGroupNotificationsLocked(
                final List<NotificationRecord> groupNotifications = findGroupNotificationsLocked(
@@ -3399,6 +3413,7 @@ public class NotificationManagerService extends SystemService {
            }
            }
        }
        }


        @GuardedBy("mNotificationLock")
        void snoozeNotificationLocked(NotificationRecord r) {
        void snoozeNotificationLocked(NotificationRecord r) {
            MetricsLogger.action(r.getLogMaker()
            MetricsLogger.action(r.getLogMaker()
                    .setCategory(MetricsEvent.NOTIFICATION_SNOOZED)
                    .setCategory(MetricsEvent.NOTIFICATION_SNOOZED)
@@ -3587,6 +3602,7 @@ public class NotificationManagerService extends SystemService {
     *
     *
     * <p>Updates mSummaryByGroupKey.</p>
     * <p>Updates mSummaryByGroupKey.</p>
     */
     */
    @GuardedBy("mNotificationLock")
    private void handleGroupedNotificationLocked(NotificationRecord r, NotificationRecord old,
    private void handleGroupedNotificationLocked(NotificationRecord r, NotificationRecord old,
            int callingUid, int callingPid) {
            int callingUid, int callingPid) {
        StatusBarNotification sbn = r.sbn;
        StatusBarNotification sbn = r.sbn;
@@ -3627,6 +3643,7 @@ public class NotificationManagerService extends SystemService {
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    @GuardedBy("mNotificationLock")
    void scheduleTimeoutLocked(NotificationRecord record) {
    void scheduleTimeoutLocked(NotificationRecord record) {
        if (record.getNotification().getTimeoutAfter() > 0) {
        if (record.getNotification().getTimeoutAfter() > 0) {
            final PendingIntent pi = PendingIntent.getBroadcast(getContext(),
            final PendingIntent pi = PendingIntent.getBroadcast(getContext(),
@@ -3643,6 +3660,7 @@ public class NotificationManagerService extends SystemService {
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    @GuardedBy("mNotificationLock")
    void buzzBeepBlinkLocked(NotificationRecord record) {
    void buzzBeepBlinkLocked(NotificationRecord record) {
        boolean buzz = false;
        boolean buzz = false;
        boolean beep = false;
        boolean beep = false;
@@ -3753,6 +3771,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mNotificationLock")
    boolean shouldMuteNotificationLocked(final NotificationRecord record) {
    boolean shouldMuteNotificationLocked(final NotificationRecord record) {
        final Notification notification = record.getNotification();
        final Notification notification = record.getNotification();
        if(record.isUpdate
        if(record.isUpdate
@@ -3862,6 +3881,7 @@ public class NotificationManagerService extends SystemService {
        }.start();
        }.start();
    }
    }


    @GuardedBy("mToastQueue")
    void showNextToastLocked() {
    void showNextToastLocked() {
        ToastRecord record = mToastQueue.get(0);
        ToastRecord record = mToastQueue.get(0);
        while (record != null) {
        while (record != null) {
@@ -3888,6 +3908,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mToastQueue")
    void cancelToastLocked(int index) {
    void cancelToastLocked(int index) {
        ToastRecord record = mToastQueue.get(index);
        ToastRecord record = mToastQueue.get(index);
        try {
        try {
@@ -3911,6 +3932,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mToastQueue")
    private void scheduleTimeoutLocked(ToastRecord r)
    private void scheduleTimeoutLocked(ToastRecord r)
    {
    {
        mHandler.removeCallbacksAndMessages(r);
        mHandler.removeCallbacksAndMessages(r);
@@ -3930,7 +3952,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    // lock on mToastQueue
    @GuardedBy("mToastQueue")
    int indexOfToastLocked(String pkg, ITransientNotification callback)
    int indexOfToastLocked(String pkg, ITransientNotification callback)
    {
    {
        IBinder cbak = callback.asBinder();
        IBinder cbak = callback.asBinder();
@@ -3945,7 +3967,7 @@ public class NotificationManagerService extends SystemService {
        return -1;
        return -1;
    }
    }


    // lock on mToastQueue
    @GuardedBy("mToastQueue")
    void keepProcessAliveIfNeededLocked(int pid)
    void keepProcessAliveIfNeededLocked(int pid)
    {
    {
        int toastCount = 0; // toasts from this pid
        int toastCount = 0; // toasts from this pid
@@ -4029,6 +4051,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mNotificationLock")
    private void recordCallerLocked(NotificationRecord record) {
    private void recordCallerLocked(NotificationRecord record) {
        if (mZenModeHelper.isCall(record)) {
        if (mZenModeHelper.isCall(record)) {
            mZenModeHelper.recordCaller(record);
            mZenModeHelper.recordCaller(record);
@@ -4036,6 +4059,7 @@ public class NotificationManagerService extends SystemService {
    }
    }


    // let zen mode evaluate this record
    // let zen mode evaluate this record
    @GuardedBy("mNotificationLock")
    private void applyZenModeLocked(NotificationRecord record) {
    private void applyZenModeLocked(NotificationRecord record) {
        record.setIntercepted(mZenModeHelper.shouldIntercept(record));
        record.setIntercepted(mZenModeHelper.shouldIntercept(record));
        if (record.isIntercepted()) {
        if (record.isIntercepted()) {
@@ -4049,7 +4073,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    // lock on mNotificationList
    @GuardedBy("mNotificationLock")
    private int findNotificationRecordIndexLocked(NotificationRecord target) {
    private int findNotificationRecordIndexLocked(NotificationRecord target) {
        return mRankingHelper.indexOf(mNotificationList, target);
        return mRankingHelper.indexOf(mNotificationList, target);
    }
    }
@@ -4182,6 +4206,7 @@ public class NotificationManagerService extends SystemService {
        manager.sendAccessibilityEvent(event);
        manager.sendAccessibilityEvent(event);
    }
    }


    @GuardedBy("mNotificationLock")
    private void cancelNotificationLocked(NotificationRecord r, boolean sendDelete, int reason) {
    private void cancelNotificationLocked(NotificationRecord r, boolean sendDelete, int reason) {
        final String canceledKey = r.getKey();
        final String canceledKey = r.getKey();


@@ -4431,6 +4456,7 @@ public class NotificationManagerService extends SystemService {
        public boolean apply(int flags);
        public boolean apply(int flags);
    }
    }


    @GuardedBy("mNotificationLock")
    private void cancelAllNotificationsByListLocked(ArrayList<NotificationRecord> notificationList,
    private void cancelAllNotificationsByListLocked(ArrayList<NotificationRecord> notificationList,
            int callingUid, int callingPid, String pkg, boolean nullPkgIndicatesUserSwitch,
            int callingUid, int callingPid, String pkg, boolean nullPkgIndicatesUserSwitch,
            String channelId, FlagChecker flagChecker, boolean includeCurrentProfiles, int userId,
            String channelId, FlagChecker flagChecker, boolean includeCurrentProfiles, int userId,
@@ -4499,6 +4525,7 @@ public class NotificationManagerService extends SystemService {
        savePolicyFile();
        savePolicyFile();
    }
    }


    @GuardedBy("mNotificationLock")
    void cancelAllLocked(int callingUid, int callingPid, int userId, int reason,
    void cancelAllLocked(int callingUid, int callingPid, int userId, int reason,
            ManagedServiceInfo listener, boolean includeCurrentProfiles) {
            ManagedServiceInfo listener, boolean includeCurrentProfiles) {
        mHandler.post(new Runnable() {
        mHandler.post(new Runnable() {
@@ -4533,6 +4560,7 @@ public class NotificationManagerService extends SystemService {
    }
    }


    // Warning: The caller is responsible for invoking updateLightsLocked().
    // Warning: The caller is responsible for invoking updateLightsLocked().
    @GuardedBy("mNotificationLock")
    private void cancelGroupChildrenLocked(NotificationRecord r, int callingUid, int callingPid,
    private void cancelGroupChildrenLocked(NotificationRecord r, int callingUid, int callingPid,
            String listenerName, boolean sendDelete) {
            String listenerName, boolean sendDelete) {
        Notification n = r.getNotification();
        Notification n = r.getNotification();
@@ -4554,6 +4582,7 @@ public class NotificationManagerService extends SystemService {
                listenerName, sendDelete);
                listenerName, sendDelete);
    }
    }


    @GuardedBy("mNotificationLock")
    private void cancelGroupChildrenByListLocked(ArrayList<NotificationRecord> notificationList,
    private void cancelGroupChildrenByListLocked(ArrayList<NotificationRecord> notificationList,
            NotificationRecord parentNotification, int callingUid, int callingPid,
            NotificationRecord parentNotification, int callingUid, int callingPid,
            String listenerName, boolean sendDelete) {
            String listenerName, boolean sendDelete) {
@@ -4573,7 +4602,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    // lock on mNotificationList
    @GuardedBy("mNotificationLock")
    void updateLightsLocked()
    void updateLightsLocked()
    {
    {
        // handle notification lights
        // handle notification lights
@@ -4600,6 +4629,7 @@ public class NotificationManagerService extends SystemService {
        }
        }
    }
    }


    @GuardedBy("mNotificationLock")
    @NonNull List<NotificationRecord> findGroupNotificationsLocked(String pkg,
    @NonNull List<NotificationRecord> findGroupNotificationsLocked(String pkg,
            String groupKey, int userId) {
            String groupKey, int userId) {
        List<NotificationRecord> records = new ArrayList<>();
        List<NotificationRecord> records = new ArrayList<>();
@@ -4610,6 +4640,7 @@ public class NotificationManagerService extends SystemService {
    }
    }




    @GuardedBy("mNotificationLock")
    private @NonNull List<NotificationRecord> findGroupNotificationByListLocked(
    private @NonNull List<NotificationRecord> findGroupNotificationByListLocked(
            ArrayList<NotificationRecord> list, String pkg, String groupKey, int userId) {
            ArrayList<NotificationRecord> list, String pkg, String groupKey, int userId) {
        List<NotificationRecord> records = new ArrayList<>();
        List<NotificationRecord> records = new ArrayList<>();
@@ -4627,6 +4658,7 @@ public class NotificationManagerService extends SystemService {
    // Searches both enqueued and posted notifications by key.
    // Searches both enqueued and posted notifications by key.
    // TODO: need to combine a bunch of these getters with slightly different behavior.
    // TODO: need to combine a bunch of these getters with slightly different behavior.
    // TODO: Should enqueuing just add to mNotificationsByKey instead?
    // TODO: Should enqueuing just add to mNotificationsByKey instead?
    @GuardedBy("mNotificationLock")
    private NotificationRecord findNotificationByKeyLocked(String key) {
    private NotificationRecord findNotificationByKeyLocked(String key) {
        NotificationRecord r;
        NotificationRecord r;
        if ((r = findNotificationByListLocked(mNotificationList, key)) != null) {
        if ((r = findNotificationByListLocked(mNotificationList, key)) != null) {
@@ -4638,6 +4670,7 @@ public class NotificationManagerService extends SystemService {
        return null;
        return null;
    }
    }


    @GuardedBy("mNotificationLock")
    NotificationRecord findNotificationLocked(String pkg, String tag, int id, int userId) {
    NotificationRecord findNotificationLocked(String pkg, String tag, int id, int userId) {
        NotificationRecord r;
        NotificationRecord r;
        if ((r = findNotificationByListLocked(mNotificationList, pkg, tag, id, userId)) != null) {
        if ((r = findNotificationByListLocked(mNotificationList, pkg, tag, id, userId)) != null) {
@@ -4650,6 +4683,7 @@ public class NotificationManagerService extends SystemService {
        return null;
        return null;
    }
    }


    @GuardedBy("mNotificationLock")
    private NotificationRecord findNotificationByListLocked(ArrayList<NotificationRecord> list,
    private NotificationRecord findNotificationByListLocked(ArrayList<NotificationRecord> list,
            String pkg, String tag, int id, int userId) {
            String pkg, String tag, int id, int userId) {
        final int len = list.size();
        final int len = list.size();
@@ -4663,9 +4697,9 @@ public class NotificationManagerService extends SystemService {
        return null;
        return null;
    }
    }


    @GuardedBy("mNotificationLock")
    private NotificationRecord findNotificationByListLocked(ArrayList<NotificationRecord> list,
    private NotificationRecord findNotificationByListLocked(ArrayList<NotificationRecord> list,
            String key)
            String key) {
    {
        final int N = list.size();
        final int N = list.size();
        for (int i = 0; i < N; i++) {
        for (int i = 0; i < N; i++) {
            if (key.equals(list.get(i).getKey())) {
            if (key.equals(list.get(i).getKey())) {
@@ -4675,7 +4709,7 @@ public class NotificationManagerService extends SystemService {
        return null;
        return null;
    }
    }


    // lock on mNotificationList
    @GuardedBy("mNotificationLock")
    int indexOfNotificationLocked(String key) {
    int indexOfNotificationLocked(String key) {
        final int N = mNotificationList.size();
        final int N = mNotificationList.size();
        for (int i = 0; i < N; i++) {
        for (int i = 0; i < N; i++) {
@@ -4782,9 +4816,8 @@ public class NotificationManagerService extends SystemService {
    /**
    /**
     * Generates a NotificationRankingUpdate from 'sbns', considering only
     * Generates a NotificationRankingUpdate from 'sbns', considering only
     * notifications visible to the given listener.
     * notifications visible to the given listener.
     *
     * <p>Caller must hold a lock on mNotificationList.</p>
     */
     */
    @GuardedBy("mNotificationLock")
    private NotificationRankingUpdate makeRankingUpdateLocked(ManagedServiceInfo info) {
    private NotificationRankingUpdate makeRankingUpdateLocked(ManagedServiceInfo info) {
        final int N = mNotificationList.size();
        final int N = mNotificationList.size();
        ArrayList<String> keys = new ArrayList<String>(N);
        ArrayList<String> keys = new ArrayList<String>(N);
@@ -4915,7 +4948,7 @@ public class NotificationManagerService extends SystemService {
    public class NotificationAssistants extends ManagedServices {
    public class NotificationAssistants extends ManagedServices {


        public NotificationAssistants() {
        public NotificationAssistants() {
            super(getContext(), mHandler, mNotificationList, mUserProfiles);
            super(getContext(), mHandler, mNotificationLock, mUserProfiles);
        }
        }


        @Override
        @Override
@@ -4946,6 +4979,7 @@ public class NotificationManagerService extends SystemService {
        }
        }


        @Override
        @Override
        @GuardedBy("mNotificationLock")
        protected void onServiceRemovedLocked(ManagedServiceInfo removed) {
        protected void onServiceRemovedLocked(ManagedServiceInfo removed) {
            mListeners.unregisterService(removed.service, removed.userid);
            mListeners.unregisterService(removed.service, removed.userid);
        }
        }
@@ -4989,6 +5023,7 @@ public class NotificationManagerService extends SystemService {
         * asynchronously notify the assistant that a notification has been snoozed until a
         * asynchronously notify the assistant that a notification has been snoozed until a
         * context
         * context
         */
         */
        @GuardedBy("mNotificationLock")
        public void notifyAssistantSnoozedLocked(final StatusBarNotification sbn,
        public void notifyAssistantSnoozedLocked(final StatusBarNotification sbn,
                final String snoozeCriterionId) {
                final String snoozeCriterionId) {
            TrimCache trimCache = new TrimCache(sbn);
            TrimCache trimCache = new TrimCache(sbn);
@@ -5022,7 +5057,7 @@ public class NotificationManagerService extends SystemService {
        private final ArraySet<ManagedServiceInfo> mLightTrimListeners = new ArraySet<>();
        private final ArraySet<ManagedServiceInfo> mLightTrimListeners = new ArraySet<>();


        public NotificationListeners() {
        public NotificationListeners() {
            super(getContext(), mHandler, mNotificationList, mUserProfiles);
            super(getContext(), mHandler, mNotificationLock, mUserProfiles);
        }
        }


        @Override
        @Override
@@ -5062,6 +5097,7 @@ public class NotificationManagerService extends SystemService {
        }
        }


        @Override
        @Override
        @GuardedBy("mNotificationLock")
        protected void onServiceRemovedLocked(ManagedServiceInfo removed) {
        protected void onServiceRemovedLocked(ManagedServiceInfo removed) {
            if (removeDisabledHints(removed)) {
            if (removeDisabledHints(removed)) {
                updateListenerHintsLocked();
                updateListenerHintsLocked();
@@ -5070,6 +5106,7 @@ public class NotificationManagerService extends SystemService {
            mLightTrimListeners.remove(removed);
            mLightTrimListeners.remove(removed);
        }
        }


        @GuardedBy("mNotificationLock")
        public void setOnNotificationPostedTrimLocked(ManagedServiceInfo info, int trim) {
        public void setOnNotificationPostedTrimLocked(ManagedServiceInfo info, int trim) {
            if (trim == TRIM_LIGHT) {
            if (trim == TRIM_LIGHT) {
                mLightTrimListeners.add(info);
                mLightTrimListeners.add(info);
@@ -5089,6 +5126,7 @@ public class NotificationManagerService extends SystemService {
         * Also takes care of removing a notification that has been visible to a listener before,
         * Also takes care of removing a notification that has been visible to a listener before,
         * but isn't anymore.
         * but isn't anymore.
         */
         */
        @GuardedBy("mNotificationLock")
        public void notifyPostedLocked(StatusBarNotification sbn, StatusBarNotification oldSbn) {
        public void notifyPostedLocked(StatusBarNotification sbn, StatusBarNotification oldSbn) {
            // Lazily initialized snapshots of the notification.
            // Lazily initialized snapshots of the notification.
            TrimCache trimCache = new TrimCache(sbn);
            TrimCache trimCache = new TrimCache(sbn);
@@ -5127,6 +5165,7 @@ public class NotificationManagerService extends SystemService {
        /**
        /**
         * asynchronously notify all listeners about a removed notification
         * asynchronously notify all listeners about a removed notification
         */
         */
        @GuardedBy("mNotificationLock")
        public void notifyRemovedLocked(StatusBarNotification sbn, int reason) {
        public void notifyRemovedLocked(StatusBarNotification sbn, int reason) {
            // make a copy in case changes are made to the underlying Notification object
            // make a copy in case changes are made to the underlying Notification object
            // NOTE: this copy is lightweight: it doesn't include heavyweight parts of the
            // NOTE: this copy is lightweight: it doesn't include heavyweight parts of the
@@ -5149,6 +5188,7 @@ public class NotificationManagerService extends SystemService {
        /**
        /**
         * asynchronously notify all listeners about a reordering of notifications
         * asynchronously notify all listeners about a reordering of notifications
         */
         */
        @GuardedBy("mNotificationLock")
        public void notifyRankingUpdateLocked() {
        public void notifyRankingUpdateLocked() {
            for (final ManagedServiceInfo serviceInfo : getServices()) {
            for (final ManagedServiceInfo serviceInfo : getServices()) {
                if (!serviceInfo.isEnabledForCurrentProfiles()) {
                if (!serviceInfo.isEnabledForCurrentProfiles()) {
@@ -5164,6 +5204,7 @@ public class NotificationManagerService extends SystemService {
            }
            }
        }
        }


        @GuardedBy("mNotificationLock")
        public void notifyListenerHintsChangedLocked(final int hints) {
        public void notifyListenerHintsChangedLocked(final int hints) {
            for (final ManagedServiceInfo serviceInfo : getServices()) {
            for (final ManagedServiceInfo serviceInfo : getServices()) {
                if (!serviceInfo.isEnabledForCurrentProfiles()) {
                if (!serviceInfo.isEnabledForCurrentProfiles()) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ import java.util.Objects;
 * {@link android.service.notification.NotificationListenerService}s.
 * {@link android.service.notification.NotificationListenerService}s.
 *
 *
 * <p>These objects should not be mutated unless the code is synchronized
 * <p>These objects should not be mutated unless the code is synchronized
 * on {@link NotificationManagerService#mNotificationList}, and any
 * on {@link NotificationManagerService#mNotificationLock}, and any
 * modification should be followed by a sorting of that list.</p>
 * modification should be followed by a sorting of that list.</p>
 *
 *
 * <p>Is sortable by {@link NotificationComparator}.</p>
 * <p>Is sortable by {@link NotificationComparator}.</p>