Merge "Fixed a bug where the summary could become visible even if it was suppressed" into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-08-16 18:36:24 +00:00
committed by Android (Google) Code Review

View File

@@ -42,7 +42,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
private int mBarState = -1; private int mBarState = -1;
private HashMap<String, StatusBarNotification> mIsolatedEntries = new HashMap<>(); private HashMap<String, StatusBarNotification> mIsolatedEntries = new HashMap<>();
private HeadsUpManager mHeadsUpManager; private HeadsUpManager mHeadsUpManager;
private boolean mUpdatingSuppressionBlocked; private boolean mIsUpdatingUnchangedGroup;
public void setOnGroupChangeListener(OnGroupChangeListener listener) { public void setOnGroupChangeListener(OnGroupChangeListener listener) {
mListener = listener; mListener = listener;
@@ -141,7 +141,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
} }
private void updateSuppression(NotificationGroup group) { private void updateSuppression(NotificationGroup group) {
if (group == null || mUpdatingSuppressionBlocked) { if (group == null) {
return; return;
} }
boolean prevSuppressed = group.suppressed; boolean prevSuppressed = group.suppressed;
@@ -154,7 +154,9 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
if (group.suppressed) { if (group.suppressed) {
handleSuppressedSummaryHeadsUpped(group.summary); handleSuppressedSummaryHeadsUpped(group.summary);
} }
mListener.onGroupsChanged(); if (!mIsUpdatingUnchangedGroup) {
mListener.onGroupsChanged();
}
} }
} }
@@ -188,12 +190,12 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
boolean groupKeysChanged = !oldKey.equals(newKey); boolean groupKeysChanged = !oldKey.equals(newKey);
boolean wasGroupChild = isGroupChild(oldNotification); boolean wasGroupChild = isGroupChild(oldNotification);
boolean isGroupChild = isGroupChild(entry.notification); boolean isGroupChild = isGroupChild(entry.notification);
mUpdatingSuppressionBlocked = !groupKeysChanged && wasGroupChild == isGroupChild; mIsUpdatingUnchangedGroup = !groupKeysChanged && wasGroupChild == isGroupChild;
if (mGroupMap.get(getGroupKey(oldNotification)) != null) { if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
onEntryRemovedInternal(entry, oldNotification); onEntryRemovedInternal(entry, oldNotification);
} }
onEntryAdded(entry); onEntryAdded(entry);
mUpdatingSuppressionBlocked = false; mIsUpdatingUnchangedGroup = false;
if (isIsolated(entry.notification)) { if (isIsolated(entry.notification)) {
mIsolatedEntries.put(entry.key, entry.notification); mIsolatedEntries.put(entry.key, entry.notification);
if (groupKeysChanged) { if (groupKeysChanged) {