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

Commit 06545136 authored by Beth Thibodeau's avatar Beth Thibodeau Committed by android-build-merger
Browse files

Merge "Synchronize block in onNotificationPosted" into qt-dev

am: 37683017

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