From 51d21973a0d2be0cf5f47c4c5ef9baba1c3fc1ad Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 19 Jul 2017 17:39:20 -0700 Subject: [PATCH] Fixed a bug where shelf notifications were interactable Even if the notifications were clipped fully they were still interactable and could be expanded into the shelf. This could lead to weird scrolling positions and other things. Test: manual, try expanding when qs is expanded Change-Id: I764a20ba83b19ca9c9c2cb311a5abb9d272c6feb Fixes: 62476893 --- packages/SystemUI/res/values/dimens.xml | 3 +++ .../statusbar/stack/NotificationStackScrollLayout.java | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 1ff7ae4ccf80..fcbe3e99e033 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -101,6 +101,9 @@ 32dp + + 40dp + 13dp diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 00973911ac0d..eef53686629b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -369,6 +369,7 @@ public class NotificationStackScrollLayout extends ViewGroup private NotificationShelf mShelf; private int mMaxDisplayedNotifications = -1; private int mStatusBarHeight; + private int mMinInteractionHeight; private boolean mNoAmbient; private final Rect mClipRect = new Rect(); private boolean mIsClipped; @@ -517,6 +518,8 @@ public class NotificationStackScrollLayout extends ViewGroup R.dimen.min_top_overscroll_to_qs); mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height); mBottomMargin = res.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom); + mMinInteractionHeight = res.getDimensionPixelSize( + R.dimen.notification_min_interaction_height); } public void setDrawBackgroundAsSrc(boolean asSrc) { @@ -1079,7 +1082,7 @@ public class NotificationStackScrollLayout extends ViewGroup final int count = getChildCount(); for (int childIdx = 0; childIdx < count; childIdx++) { ExpandableView slidingChild = (ExpandableView) getChildAt(childIdx); - if (slidingChild.getVisibility() == GONE + if (slidingChild.getVisibility() != VISIBLE || slidingChild instanceof StackScrollerDecorView) { continue; } @@ -1093,7 +1096,8 @@ public class NotificationStackScrollLayout extends ViewGroup int left = 0; int right = getWidth(); - if (touchY >= top && touchY <= bottom && touchX >= left && touchX <= right) { + if (bottom - top >= mMinInteractionHeight + && touchY >= top && touchY <= bottom && touchX >= left && touchX <= right) { if (slidingChild instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) slidingChild; if (!mIsExpanded && row.isHeadsUp() && row.isPinned() @@ -2005,6 +2009,7 @@ public class NotificationStackScrollLayout extends ViewGroup } mContentHeight = height + mTopPadding + mBottomMargin; updateScrollability(); + clampScrollPosition(); mAmbientState.setLayoutMaxHeight(mContentHeight); } @@ -3463,7 +3468,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private void updateScrollPositionOnExpandInBottom(ExpandableView view) { - if (view instanceof ExpandableNotificationRow) { + if (view instanceof ExpandableNotificationRow && !onKeyguard()) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; if (row.isUserLocked() && row != getFirstChildNotGone()) { if (row.isSummaryWithChildren()) { -- 2.11.0