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

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

Merge "Fixed a bug where notifications could become orphaned" into nyc-dev am: ed47cf23

am: e91cf548

* commit 'e91cf548':
  Fixed a bug where notifications could become orphaned

Change-Id: I1d946e11264b8a64827642fbfa6065f3a2614040
parents eea84659 e91cf548
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -24,9 +24,12 @@ import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.HeadsUpManager;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;

/**
@@ -69,6 +72,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged

    public void onEntryRemoved(NotificationData.Entry removed) {
        onEntryRemovedInternal(removed, removed.notification);
        mIsolatedEntries.remove(removed.key);
    }

    /**
@@ -425,6 +429,19 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
        mHeadsUpManager = headsUpManager;
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("GroupManager state:");
        pw.println("  number of groups: " +  mGroupMap.size());
        for (Map.Entry<String, NotificationGroup>  entry : mGroupMap.entrySet()) {
            pw.println("\n    key: " + entry.getKey()); pw.println(entry.getValue());
        }
        pw.println("\n    isolated entries: " +  mIsolatedEntries.size());
        for (Map.Entry<String, StatusBarNotification> entry : mIsolatedEntries.entrySet()) {
            pw.print("      "); pw.print(entry.getKey());
            pw.print(", "); pw.println(entry.getValue());
        }
    }

    public static class NotificationGroup {
        public final HashSet<NotificationData.Entry> children = new HashSet<>();
        public NotificationData.Entry summary;
@@ -433,6 +450,16 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
         * Is this notification group suppressed, i.e its summary is hidden
         */
        public boolean suppressed;

        @Override
        public String toString() {
            String result = "    summary:\n      " + summary.notification;
            result += "\n    children size: " + children.size();
            for (NotificationData.Entry child : children) {
                result += "\n      " + child.notification;
            }
            return result;
        }
    }

    public interface OnGroupChangeListener {
+5 −0
Original line number Diff line number Diff line
@@ -3150,6 +3150,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        } else {
            pw.println("  mHeadsUpManager: null");
        }
        if (mGroupManager != null) {
            mGroupManager.dump(fd, pw, args);
        } else {
            pw.println("  mGroupManager: null");
        }
        if (KeyguardUpdateMonitor.getInstance(mContext) != null) {
            KeyguardUpdateMonitor.getInstance(mContext).dump(fd, pw, args);
        }