Merge "Synchronize block in onNotificationPosted" into qt-dev

am: 376830178b

Change-Id: I074da77675a278ce34148d9ded1b923da5cdf759
This commit is contained in:
Beth Thibodeau
2019-05-21 21:33:47 -07:00
committed by android-build-merger

View File

@@ -301,13 +301,17 @@ public class Assistant extends NotificationAssistantService {
sbn, ranking.getChannel(), mSmsHelper);
String key = getKey(
sbn.getPackageName(), sbn.getUserId(), ranking.getChannel().getId());
ChannelImpressions ci = mkeyToImpressions.getOrDefault(key,
createChannelImpressionsWithThresholds());
if (ranking.getImportance() > IMPORTANCE_MIN && ci.shouldTriggerBlock()) {
boolean shouldTriggerBlock;
synchronized (mkeyToImpressions) {
ChannelImpressions ci = mkeyToImpressions.getOrDefault(key,
createChannelImpressionsWithThresholds());
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);
}