OSDN Git Service

Fixed an issue where heads up notifications would overlap
authorSelim Cinek <cinek@google.com>
Thu, 18 Jul 2019 21:19:54 +0000 (14:19 -0700)
committerSelim Cinek <cinek@google.com>
Thu, 18 Jul 2019 21:19:54 +0000 (14:19 -0700)
We recently fixed the logic where notifications are being displayed
if multiple huns are showing, however we were not clipping to them.
We're now clipping heads up notifications as well by the clipTopAmount

Fixes: 136914021
Test: add two different sized HUNS, so weird overlap.
Change-Id: I68a4c373eff3952b1a4711858c9ce61684f6ff17

packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java

index cc1170f..b444fa5 100644 (file)
@@ -83,6 +83,11 @@ public class SectionHeaderView extends ActivatableNotificationView {
         bindContents();
     }
 
+    @Override
+    public boolean isTransparent() {
+        return true;
+    }
+
     /** Must be called whenever the UI mode changes (i.e. when we enter night mode). */
     void onUiModeChanged() {
         updateBackgroundColors();
index 01e2b28..7655056 100644 (file)
@@ -159,15 +159,13 @@ public class StackScrollAlgorithm {
         float drawStart = !ambientState.isOnKeyguard() ? ambientState.getTopPadding()
                 + ambientState.getStackTranslation() + ambientState.getExpandAnimationTopChange()
                 : 0;
-        float previousNotificationEnd = 0;
-        float previousNotificationStart = 0;
+        float clipStart = 0;
         int childCount = algorithmState.visibleChildren.size();
         for (int i = 0; i < childCount; i++) {
             ExpandableView child = algorithmState.visibleChildren.get(i);
             ExpandableViewState state = child.getViewState();
             if (!child.mustStayOnScreen() || state.headsUpIsVisible) {
-                previousNotificationEnd = Math.max(drawStart, previousNotificationEnd);
-                previousNotificationStart = Math.max(drawStart, previousNotificationStart);
+                clipStart = Math.max(drawStart, clipStart);
             }
             float newYTranslation = state.yTranslation;
             float newHeight = state.height;
@@ -175,10 +173,10 @@ public class StackScrollAlgorithm {
             boolean isHeadsUp = (child instanceof ExpandableNotificationRow)
                     && ((ExpandableNotificationRow) child).isPinned();
             if (mClipNotificationScrollToTop
-                    && !state.inShelf && newYTranslation < previousNotificationEnd
-                    && (!isHeadsUp || ambientState.isShadeExpanded())) {
+                    && (!state.inShelf || isHeadsUp)
+                    && newYTranslation < clipStart) {
                 // The previous view is overlapping on top, clip!
-                float overlapAmount = previousNotificationEnd - newYTranslation;
+                float overlapAmount = clipStart - newYTranslation;
                 state.clipTopAmount = (int) overlapAmount;
             } else {
                 state.clipTopAmount = 0;
@@ -187,8 +185,7 @@ public class StackScrollAlgorithm {
             if (!child.isTransparent()) {
                 // Only update the previous values if we are not transparent,
                 // otherwise we would clip to a transparent view.
-                previousNotificationEnd = newNotificationEnd;
-                previousNotificationStart = newYTranslation;
+                clipStart = Math.max(clipStart, isHeadsUp ? newYTranslation : newNotificationEnd);
             }
         }
     }