Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java +47 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Objects; /** Loading @@ -37,6 +38,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged private OnGroupChangeListener mListener; private int mBarState = -1; private HashMap<String, StatusBarNotification> mIsolatedEntries = new HashMap<>(); private HeadsUpManager mHeadsUpManager; public void setOnGroupChangeListener(OnGroupChangeListener listener) { mListener = listener; Loading Loading @@ -142,6 +144,9 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged && group.summary.notification.getNotification().isGroupSummary() && hasIsolatedChildren(group))); if (prevSuppressed != group.suppressed) { if (group.suppressed) { handleSuppressedSummaryHeadsUpped(group.summary); } mListener.onGroupsChanged(); } } Loading @@ -160,6 +165,15 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged return count; } private NotificationData.Entry getIsolatedChild(String groupKey) { for (StatusBarNotification sbn : mIsolatedEntries.values()) { if (sbn.getGroupKey().equals(groupKey) && isIsolated(sbn)) { return mGroupMap.get(sbn.getKey()).summary; } } return null; } public void onEntryUpdated(NotificationData.Entry entry, StatusBarNotification oldNotification) { if (mGroupMap.get(getGroupKey(oldNotification)) != null) { Loading Loading @@ -332,6 +346,9 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged // it doesn't lead to an update. updateSuppression(mGroupMap.get(entry.notification.getGroupKey())); mListener.onGroupsChanged(); } else { handleSuppressedSummaryHeadsUpped(entry); } } else { if (mIsolatedEntries.containsKey(sbn.getKey())) { Loading @@ -344,6 +361,32 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged } } private void handleSuppressedSummaryHeadsUpped(NotificationData.Entry entry) { StatusBarNotification sbn = entry.notification; if (!isGroupSuppressed(sbn.getGroupKey()) || !sbn.getNotification().isGroupSummary() || !entry.row.isHeadsUp()) { return; } // The parent of a suppressed group got huned, lets hun the child! NotificationGroup notificationGroup = mGroupMap.get(sbn.getGroupKey()); if (notificationGroup != null) { Iterator<NotificationData.Entry> iterator = notificationGroup.children.iterator(); NotificationData.Entry child = iterator.hasNext() ? iterator.next() : null; if (child == null) { child = getIsolatedChild(sbn.getGroupKey()); } if (child != null) { if (mHeadsUpManager.isHeadsUp(child.key)) { mHeadsUpManager.updateNotification(child, true); } else { mHeadsUpManager.showNotification(child); } } } mHeadsUpManager.releaseImmediately(entry.key); } private boolean shouldIsolate(StatusBarNotification sbn) { NotificationGroup notificationGroup = mGroupMap.get(sbn.getGroupKey()); return (sbn.isGroup() && !sbn.getNotification().isGroupSummary()) Loading @@ -360,6 +403,10 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged || notificationGroup.summary.row.getTranslationY() < 0; } public void setHeadsUpManager(HeadsUpManager headsUpManager) { mHeadsUpManager = headsUpManager; } public static class NotificationGroup { public final HashSet<NotificationData.Entry> children = new HashSet<>(); public NotificationData.Entry summary; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -729,6 +729,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mHeadsUpManager.addListener(mGroupManager); mNotificationPanel.setHeadsUpManager(mHeadsUpManager); mNotificationData.setHeadsUpManager(mHeadsUpManager); mGroupManager.setHeadsUpManager(mHeadsUpManager); if (MULTIUSER_DEBUG) { mNotificationPanelDebugText = (TextView) mNotificationPanel.findViewById( Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL if (alert) { HeadsUpEntry headsUpEntry = mHeadsUpEntries.get(headsUp.key); if (headsUpEntry == null) { // the entry was released before this update (i.e by a listener) This can happen // with the groupmanager return; } headsUpEntry.updateEntry(); setEntryPinned(headsUpEntry, shouldHeadsUpBecomePinned(headsUp)); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java +47 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Objects; /** Loading @@ -37,6 +38,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged private OnGroupChangeListener mListener; private int mBarState = -1; private HashMap<String, StatusBarNotification> mIsolatedEntries = new HashMap<>(); private HeadsUpManager mHeadsUpManager; public void setOnGroupChangeListener(OnGroupChangeListener listener) { mListener = listener; Loading Loading @@ -142,6 +144,9 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged && group.summary.notification.getNotification().isGroupSummary() && hasIsolatedChildren(group))); if (prevSuppressed != group.suppressed) { if (group.suppressed) { handleSuppressedSummaryHeadsUpped(group.summary); } mListener.onGroupsChanged(); } } Loading @@ -160,6 +165,15 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged return count; } private NotificationData.Entry getIsolatedChild(String groupKey) { for (StatusBarNotification sbn : mIsolatedEntries.values()) { if (sbn.getGroupKey().equals(groupKey) && isIsolated(sbn)) { return mGroupMap.get(sbn.getKey()).summary; } } return null; } public void onEntryUpdated(NotificationData.Entry entry, StatusBarNotification oldNotification) { if (mGroupMap.get(getGroupKey(oldNotification)) != null) { Loading Loading @@ -332,6 +346,9 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged // it doesn't lead to an update. updateSuppression(mGroupMap.get(entry.notification.getGroupKey())); mListener.onGroupsChanged(); } else { handleSuppressedSummaryHeadsUpped(entry); } } else { if (mIsolatedEntries.containsKey(sbn.getKey())) { Loading @@ -344,6 +361,32 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged } } private void handleSuppressedSummaryHeadsUpped(NotificationData.Entry entry) { StatusBarNotification sbn = entry.notification; if (!isGroupSuppressed(sbn.getGroupKey()) || !sbn.getNotification().isGroupSummary() || !entry.row.isHeadsUp()) { return; } // The parent of a suppressed group got huned, lets hun the child! NotificationGroup notificationGroup = mGroupMap.get(sbn.getGroupKey()); if (notificationGroup != null) { Iterator<NotificationData.Entry> iterator = notificationGroup.children.iterator(); NotificationData.Entry child = iterator.hasNext() ? iterator.next() : null; if (child == null) { child = getIsolatedChild(sbn.getGroupKey()); } if (child != null) { if (mHeadsUpManager.isHeadsUp(child.key)) { mHeadsUpManager.updateNotification(child, true); } else { mHeadsUpManager.showNotification(child); } } } mHeadsUpManager.releaseImmediately(entry.key); } private boolean shouldIsolate(StatusBarNotification sbn) { NotificationGroup notificationGroup = mGroupMap.get(sbn.getGroupKey()); return (sbn.isGroup() && !sbn.getNotification().isGroupSummary()) Loading @@ -360,6 +403,10 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged || notificationGroup.summary.row.getTranslationY() < 0; } public void setHeadsUpManager(HeadsUpManager headsUpManager) { mHeadsUpManager = headsUpManager; } public static class NotificationGroup { public final HashSet<NotificationData.Entry> children = new HashSet<>(); public NotificationData.Entry summary; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -729,6 +729,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mHeadsUpManager.addListener(mGroupManager); mNotificationPanel.setHeadsUpManager(mHeadsUpManager); mNotificationData.setHeadsUpManager(mHeadsUpManager); mGroupManager.setHeadsUpManager(mHeadsUpManager); if (MULTIUSER_DEBUG) { mNotificationPanelDebugText = (TextView) mNotificationPanel.findViewById( Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL if (alert) { HeadsUpEntry headsUpEntry = mHeadsUpEntries.get(headsUp.key); if (headsUpEntry == null) { // the entry was released before this update (i.e by a listener) This can happen // with the groupmanager return; } headsUpEntry.updateEntry(); setEntryPinned(headsUpEntry, shouldHeadsUpBecomePinned(headsUp)); } Loading