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

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

Merge "Hiding the summary of notification groups with a single child now" into nyc-dev

am: 49ab4fbb

* commit '49ab4fbb':
  Hiding the summary of notification groups with a single child now
parents 4de3848c 49ab4fbb
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -2060,24 +2060,24 @@ public abstract class BaseStatusBar extends SystemUI implements
        }
        for (int i = 0; i < N; i++) {
            NotificationData.Entry entry = activeNotifications.get(i);
            boolean childNotification = mGroupManager.isChildInGroupWithSummary(entry.notification);
            if (onKeyguard) {
                entry.row.setOnKeyguard(true);
            } else {
                entry.row.setOnKeyguard(false);
                boolean top = (i == 0);
                entry.row.setSystemExpanded(top);
                entry.row.setSystemExpanded(visibleNotifications == 0 && !childNotification);
            }
            boolean childNotification = mGroupManager.isChildInGroupWithSummary(entry.notification);
            boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(entry.notification);
            boolean childWithVisibleSummary = childNotification
                    && mGroupManager.getGroupSummary(entry.notification).getVisibility()
                    == View.VISIBLE;
            boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
            if ((isLockscreenPublicMode() && !mShowLockscreenNotifications) ||
            if (suppressedSummary || (isLockscreenPublicMode() && !mShowLockscreenNotifications) ||
                    (onKeyguard && (visibleNotifications >= maxNotifications
                            && !childWithVisibleSummary
                            || !showOnKeyguard))) {
                entry.row.setVisibility(View.GONE);
                if (onKeyguard && showOnKeyguard && !childNotification) {
                if (onKeyguard && showOnKeyguard && !childNotification && !suppressedSummary) {
                    mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
                }
            } else {
@@ -2086,7 +2086,8 @@ public abstract class BaseStatusBar extends SystemUI implements
                if (!childNotification) {
                    if (wasGone) {
                        // notify the scroller of a child addition
                        mStackScroller.generateAddAnimation(entry.row, true /* fromMoreCard */);
                        mStackScroller.generateAddAnimation(entry.row,
                                !showOnKeyguard /* fromMoreCard */);
                    }
                    visibleNotifications++;
                }
+1 −4
Original line number Diff line number Diff line
@@ -1026,11 +1026,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    private void onChildrenCountChanged() {
        mIsSummaryWithChildren = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS
                && mGroupManager.hasGroupChildren(mStatusBarNotification);
                && mChildrenContainer != null && mChildrenContainer.getChildCount() > 0;
        if (mIsSummaryWithChildren) {
            if (mChildrenContainer == null) {
                mChildrenContainerStub.inflate();
            }
            if (mNotificationHeader == null) {
                recreateNotificationHeader();
            }
+30 −22
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
        } else {
            group.summary = null;
        }
        updateSuppression(group);
        if (group.children.isEmpty()) {
            if (group.summary == null) {
                mGroupMap.remove(groupKey);
@@ -109,15 +110,25 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
        }
        if (isGroupChild) {
            group.children.add(added);
            updateSuppression(group);
        } else {
            group.summary = added;
            group.expanded = added.row.areChildrenExpanded();
            updateSuppression(group);
            if (!group.children.isEmpty()) {
                mListener.onGroupCreatedFromChildren(group);
            }
        }
    }

    private void updateSuppression(NotificationGroup group) {
        boolean prevSuppressed = group.suppressed;
        group.suppressed = group.summary != null && group.children.size() == 1 && !group.expanded;
        if (prevSuppressed != group.suppressed) {
            mListener.onGroupsChanged();
        }
    }

    public void onEntryUpdated(NotificationData.Entry entry,
            StatusBarNotification oldNotification) {
        if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
@@ -126,26 +137,17 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
        onEntryAdded(entry);
    }

    public boolean isVisible(StatusBarNotification sbn) {
        if (!isGroupChild(sbn)) {
            return true;
        }
        NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
        if (group != null && (group.expanded || group.summary == null)) {
            return true;
        }
        return false;
    public boolean isSummaryOfSuppressedGroup(StatusBarNotification sbn) {
        return isGroupSuppressed(sbn) && sbn.getNotification().isGroupSummary();
    }

    public boolean hasGroupChildren(StatusBarNotification sbn) {
        if (!isGroupSummary(sbn)) {
            return false;
    public boolean isChildInSuppressedGroup(StatusBarNotification sbn) {
        return isGroupSuppressed(sbn) && sbn.getNotification().isGroupChild();
    }

    private boolean isGroupSuppressed(StatusBarNotification sbn) {
        NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
        if (group == null) {
            return false;
        }
        return !group.children.isEmpty();
        return group != null && group.suppressed;
    }

    public void setStatusBarState(int newState) {
@@ -163,6 +165,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
            if (group.expanded) {
                setGroupExpanded(group, false);
            }
            updateSuppression(group);
        }
    }

@@ -174,7 +177,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
            return false;
        }
        NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
        if (group == null || group.summary == null) {
        if (group == null || group.summary == null || group.suppressed) {
            return false;
        }
        return true;
@@ -258,7 +261,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
                mHeadsUpedEntries.add(sbn.getKey());
                if (groupChild) {
                    onEntryAdded(entry);
                    mListener.onChildIsolationChanged();
                    mListener.onGroupsChanged();
                }
            }
        } else {
@@ -271,7 +274,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
                mHeadsUpedEntries.remove(sbn.getKey());
                if (isolatedBefore) {
                    onEntryAdded(entry);
                    mListener.onChildIsolationChanged();
                    mListener.onGroupsChanged();
                }
            }
        }
@@ -281,6 +284,10 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
        public final HashSet<NotificationData.Entry> children = new HashSet<>();
        public NotificationData.Entry summary;
        public boolean expanded;
        /**
         * Is this notification group suppressed, i.e its summary is hidden
         */
        public boolean suppressed;
    }

    public interface OnGroupChangeListener {
@@ -301,8 +308,9 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
        void onGroupCreatedFromChildren(NotificationGroup group);

        /**
         * The isolation of a child has changed i.e it's group changes.
         * The groups have changed. This can happen if the isolation of a child has changes or if a
         * group became suppressed / unsuppressed
         */
        void onChildIsolationChanged();
        void onGroupsChanged();
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -114,6 +114,9 @@ public class NotificationIconAreaController {
            if (!PhoneStatusBar.isTopLevelChild(ent)) {
                continue;
            }
            if (ent.row.getVisibility() == View.GONE) {
                continue;
            }
            toShow.add(ent.icon);
        }

+6 −7
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ import com.android.systemui.statusbar.DismissView;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.NotificationData;
@@ -1632,16 +1633,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    private void updateSpeedbump() {
        int speedbumpIndex = -1;
        int currentIndex = 0;
        ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
        final int N = activeNotifications.size();
        final int N = mStackScroller.getChildCount();
        for (int i = 0; i < N; i++) {
            Entry entry = activeNotifications.get(i);
            boolean isChild = !isTopLevelChild(entry);
            if (isChild) {
            View view = mStackScroller.getChildAt(i);
            if (view.getVisibility() == View.GONE || !(view instanceof ExpandableNotificationRow)) {
                continue;
            }
            if (entry.row.getVisibility() != View.GONE &&
                    mNotificationData.isAmbient(entry.key)) {
            ExpandableNotificationRow row = (ExpandableNotificationRow) view;
            if (mNotificationData.isAmbient(row.getStatusBarNotification().getKey())) {
                speedbumpIndex = currentIndex;
                break;
            }
Loading