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

Commit 6938f715 authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Fixed a bug where groups would animate the wrong way am: 68bdff16

am: b7af027e

Change-Id: I33d0769496544ba77d99e03e02b717afef87d128
parents 6a34765b b7af027e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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));
                }
            }
        }
+11 −15
Original line number Diff line number Diff line
@@ -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);
        }
    }