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

Commit e108720a authored by Mady Mellor's avatar Mady Mellor
Browse files

Save the notification group key on the bubble

We don't need to persist this because any bubble created
from persisted bubbles in the overflow wouldn't have a
notification to match with it anyways.

Test: atest BubblesTest
Bug: 178620678
Change-Id: I005704cce0e7205e254e71578d40f931c496e8f5
parent d1833c1b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.graphics.drawable.Icon;
import android.os.Parcelable;
import android.os.UserHandle;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;

@@ -59,6 +60,8 @@ public class Bubble implements BubbleViewProvider {
    private static final String TAG = "Bubble";

    private final String mKey;
    @Nullable
    private final String mGroupKey;
    private final Executor mMainExecutor;

    private long mLastUpdated;
@@ -165,6 +168,7 @@ public class Bubble implements BubbleViewProvider {
        mMetadataShortcutId = shortcutInfo.getId();
        mShortcutInfo = shortcutInfo;
        mKey = key;
        mGroupKey = null;
        mFlags = 0;
        mUser = shortcutInfo.getUserHandle();
        mPackageName = shortcutInfo.getPackage();
@@ -182,6 +186,7 @@ public class Bubble implements BubbleViewProvider {
            final Bubbles.PendingIntentCanceledListener intentCancelListener,
            Executor mainExecutor) {
        mKey = entry.getKey();
        mGroupKey = entry.getGroupKey();
        mSuppressionListener = listener;
        mIntentCancelListener = intent -> {
            if (mIntent != null) {
@@ -200,6 +205,14 @@ public class Bubble implements BubbleViewProvider {
        return mKey;
    }

    /**
     * @see StatusBarNotification#getGroupKey()
     * @return the group key for this bubble, if one exists.
     */
    public String getGroupKey() {
        return mGroupKey;
    }

    public UserHandle getUser() {
        return mUser;
    }
+3 −6
Original line number Diff line number Diff line
@@ -892,10 +892,7 @@ public class BubbleController {
            return bubbleChildren;
        }
        for (Bubble bubble : mBubbleData.getActiveBubbles()) {
            // TODO(178620678): Prevent calling into SysUI since this can be a part of a blocking
            //                  call from SysUI to Shell
            final BubbleEntry entry = mSysuiProxy.getPendingOrActiveEntry(bubble.getKey());
            if (entry != null && groupKey.equals(entry.getStatusBarNotification().getGroupKey())) {
            if (bubble.getGroupKey() != null && groupKey.equals(bubble.getGroupKey())) {
                bubbleChildren.add(bubble);
            }
        }
@@ -1064,8 +1061,8 @@ public class BubbleController {
    private boolean isSummaryOfBubbles(BubbleEntry entry) {
        String groupKey = entry.getStatusBarNotification().getGroupKey();
        ArrayList<Bubble> bubbleChildren = getBubblesInGroup(groupKey);
        boolean isSuppressedSummary = (mBubbleData.isSummarySuppressed(groupKey)
                && mBubbleData.getSummaryKey(groupKey).equals(entry.getKey()));
        boolean isSuppressedSummary = mBubbleData.isSummarySuppressed(groupKey)
                && mBubbleData.getSummaryKey(groupKey).equals(entry.getKey());
        boolean isSummary = entry.getStatusBarNotification().getNotification().isGroupSummary();
        return (isSuppressedSummary || isSummary) && !bubbleChildren.isEmpty();
    }