Merge "Fixed a bug where groups would animate the wrong way" into nyc-mr1-dev

This commit is contained in:
Selim Cinek
2016-08-03 23:03:03 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 17 deletions

View File

@@ -34,7 +34,6 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.Objects;
/**
@@ -343,7 +342,6 @@ public class NotificationData {
entry.notification.setOverrideGroupKey(overrideGroupKey);
mGroupManager.onEntryUpdated(entry, oldSbn);
}
//mGroupManager.onEntryBundlingUpdated(entry, getOverrideGroupKey(entry.key));
}
}
}

View File

@@ -31,7 +31,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
/**
* A class to handle notifications and their corresponding groups.
@@ -43,6 +42,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
private int mBarState = -1;
private HashMap<String, StatusBarNotification> mIsolatedEntries = new HashMap<>();
private HeadsUpManager mHeadsUpManager;
private boolean mUpdatingSuppressionBlocked;
public void setOnGroupChangeListener(OnGroupChangeListener listener) {
mListener = listener;
@@ -140,17 +140,8 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
}
}
public void onEntryBundlingUpdated(final NotificationData.Entry updated,
final String overrideGroupKey) {
final StatusBarNotification oldSbn = updated.notification.clone();
if (!Objects.equals(oldSbn.getOverrideGroupKey(), overrideGroupKey)) {
updated.notification.setOverrideGroupKey(overrideGroupKey);
onEntryUpdated(updated, oldSbn);
}
}
private void updateSuppression(NotificationGroup group) {
if (group == null) {
if (group == null || mUpdatingSuppressionBlocked) {
return;
}
boolean prevSuppressed = group.suppressed;
@@ -192,19 +183,24 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
public void onEntryUpdated(NotificationData.Entry entry,
StatusBarNotification oldNotification) {
String oldKey = oldNotification.getGroupKey();
String newKey = entry.notification.getGroupKey();
boolean groupKeysChanged = !oldKey.equals(newKey);
boolean wasGroupChild = isGroupChild(oldNotification);
boolean isGroupChild = isGroupChild(entry.notification);
mUpdatingSuppressionBlocked = !groupKeysChanged && wasGroupChild == isGroupChild;
if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
onEntryRemovedInternal(entry, oldNotification);
}
onEntryAdded(entry);
mUpdatingSuppressionBlocked = false;
if (isIsolated(entry.notification)) {
mIsolatedEntries.put(entry.key, entry.notification);
String oldKey = oldNotification.getGroupKey();
String newKey = entry.notification.getGroupKey();
if (!oldKey.equals(newKey)) {
if (groupKeysChanged) {
updateSuppression(mGroupMap.get(oldKey));
updateSuppression(mGroupMap.get(newKey));
}
} else if (!isGroupChild(oldNotification) && isGroupChild(entry.notification)) {
} else if (!wasGroupChild && isGroupChild) {
onEntryBecomingChild(entry);
}
}