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

Commit 37683017 authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Android (Google) Code Review
Browse files

Merge "Synchronize block in onNotificationPosted" into qt-dev

parents dad4026a 7c72b5e6
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -301,13 +301,17 @@ public class Assistant extends NotificationAssistantService {
                        sbn, ranking.getChannel(), mSmsHelper);
                String key = getKey(
                        sbn.getPackageName(), sbn.getUserId(), ranking.getChannel().getId());
                boolean shouldTriggerBlock;
                synchronized (mkeyToImpressions) {
                    ChannelImpressions ci = mkeyToImpressions.getOrDefault(key,
                            createChannelImpressionsWithThresholds());
                if (ranking.getImportance() > IMPORTANCE_MIN && ci.shouldTriggerBlock()) {
                    mkeyToImpressions.put(key, ci);
                    shouldTriggerBlock = ci.shouldTriggerBlock();
                }
                if (ranking.getImportance() > IMPORTANCE_MIN && shouldTriggerBlock) {
                    adjustNotification(createNegativeAdjustment(
                            sbn.getPackageName(), sbn.getKey(), sbn.getUserId()));
                }
                mkeyToImpressions.put(key, ci);
                mLiveNotifications.put(sbn.getKey(), entry);
                mAgingHelper.onNotificationPosted(entry);
            }